NUMCPU bug in spec file of samba-3.0.0-2.src.rpm

Nir Soffer nirs at
Mon Oct 6 00:24:31 GMT 2003

The spec file look for number of cpu's by counting line in /proc/cpuinfo
that contain a "processor" filed:

     NUMCPU=`grep processor /proc/cpuinfo | wc -l`

On Yellow Dog Linux, which is a RedHat 9 based, the cpuinfo file does
not contain a processor field. When you install the rpm NUMCPU is zero,
and make fail when called:

     make -j${NUMCPU} proto

     + make -j 0 proto
     make: the `-j' option requires a positive integral argument
     Usage: make [options] [target] ...

This is the cpuinfo in YDL:

     cpu             : 740/750
     temperature     : 63-65 C (uncalibrated)
     clock           : 264MHz
     revision        : 2.2 (pvr 0008 0202)
     bogomips        : 532.48
     machine         : PowerBook
     motherboard     : AAPL,PowerBook1998 MacRISC
     detected as     : 50 (PowerBook Wallstreet)
     pmac flags      : 00000009
     L2 cache        : 1024K unified pipelined-syncro-burst
     memory          : 320MB
     pmac-generation : OldWorld

I don't know if its a problem in YDL, not using the same cpuinfo format
as RedHat 9, or how a multiply cpuinfo looks on YDL,  But It would be
safer to use a default of 1 cpu if NUMCPU is not a positive integer.
That way the rpm will compile on distributions with wired cpuinfo files.
Running slower is better than not running at all.

I suggest this path for the spec file:

--- samba3--old.spec    2003-10-06 00:47:47.000000000 +0200
+++ samba3--new.spec    2003-10-06 01:16:46.000000000 +0200
@@ -68,7 +68,13 @@
+# Get number of cpu's, default for 1 cpu on error
   NUMCPU=`grep processor /proc/cpuinfo | wc -l`
+if [ $NUMCPU -eq 0 ]; then
+       NUMCPU=1;
   if [ ! -f "configure" ]; then

I using this patch now to build samba and it is compiling without 

More information about the samba-technical mailing list