Subject: Re: Another build failure - "unexpected operator" in maketars
To: None <current-users@netbsd.org>
From: Charlie Root <root@whooppee.com>
List: current-users
Date: 02/04/2007 15:13:20
I inserted a 'set -x'/'set +x' in /usr/src/distrib/sets/sets.subr and 
discovered that in function list_set_lists() the variable $MACHINE_CPU 
has a strange value of "--- all --- " and this results in four of the 
"unexpected operator" error messages for each set being listed.

It seems that this is a side-effect of running a parallel make!

The routine arch_to_cpu in sets.subr finds a value for $MACHINE_CPU by 
doing:

 	MACHINE_ARCH=${1} ${MAKE} -f- all <<EOMAKE
 	.include <bsd.own.mk>
 	all:
 		@echo \${MACHINE_CPU}
 	EOMAKE

Unfortunately when running make with -j3, make preceeds each bit of 
output with a line that looks like

 	--- <target> ---

So the above code sticks "--- all ---" into the the output instead of a 
empty string (which is what you get when running the above commands
manually).

These errors don't seem to hurt anything, at least not on a architecture 
that doesn't have a MACHINE_CPU value.  But it probably breaks something 
on other architectures, at least when doing a parallel build.

#    create  set lists
cd /usr/src/distrib/sets &&  DESTDIR=/usr/obj/destdir.amd64  MACHINE=amd64 MACHINE_ARCH=x86_64  CKSUM=/usr/obj/tools.x86_64.amd64/bin/nbcksum  DB=/usr/obj/tools.x86_64.amd64/bin/nbdb  HOST_SH=/bin/sh  MAKE=/usr/obj/tools.x86_64.amd64/bin/nbmake  MKTEMP=/usr/obj/tools.x86_64.amd64/bin/nbmktemp  MTREE=/usr/obj/tools.x86_64.amd64/bin/nbmtree  PAX=/usr/obj/tools.x86_64.amd64/bin/nbpax  TSORT=/usr/obj/tools.x86_64.amd64/bin/nbtsort\ -q  /bin/sh ./maketars -S -d /usr/obj/destdir.amd64   -N /usr/src/etc -b -t /usr/obj/reldir/amd64/binary/sets
+ setname=base
+ setdir=./lists/base
+ echo ./lists/base/mi
+ [ amd64 != x86_64 ]
+ [ -f ./lists/base/ad.x86_64 ]
+ [ -f ./lists/base/ad.--- all --- x86_64 ]
[: all: unexpected operator
+ [ elf != no -a -f ./lists/base/ad.--- all --- x86_64.shl ]
[: all: unexpected operator
+ [ -f ./lists/base/md.amd64.x86_64 ]
<snip>
+ [ amd64 != x86_64 ]
+ [ -f ./lists/base/rescue.ad.x86_64 ]
+ [ -f ./lists/base/rescue.ad.--- all --- x86_64 ]
[: all: unexpected operator
+ [ elf != no -a -f ./lists/base/rescue.ad.--- all --- x86_64.shl ]
[: all: unexpected operator
+ set +x


----------------------------------------------------------------------
|   Paul Goyette   | PGP DSS Key fingerprint: |  E-mail addresses:   |
| Network Engineer | FA29 0E3B 35AF E8AE 6651 |  paul@whooppee.com   |
|                  | 0786 F758 55DE 53BA 7731 | pgoyette@juniper.net |
----------------------------------------------------------------------