tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: make :Q breakage



On May 26,  1:20am, uwe%stderr.spb.ru@localhost (Valery Ushakov) wrote:
-- Subject: make :Q breakage

| Recent commit to make:
| 
|   http://mail-index.netbsd.org/source-changes/2018/05/24/msg095440.html
| 
|   Since ${MAKE} converts $$ -> $ during parsing we need to put it back to
|   preserve the original variable value with :Q.
| 
| broke pkgsrc as tool wrappers it creates now contain code like, e.g.
| 
|   /bin/mkdir -p "$$@"
| 
| instead of the intended "$@"
| 
| 
| A minimal test to demonstrate the problem is
| 
| FOO=doit "$$@"
| default:
|         foo=${FOO:Q}; echo foo=$$foo
| 
| 
| $ make -f q.mk 
| foo=doit\ \"\$\$@\"; echo foo=$foo
| foo=doit "$$@"

Well, the pkgsrc wrappers seem to either try to work around "the bug"...


$ cat << EOF > bar.mk
FOO?=echo $$@
COUNT?=1

all:
.if ${COUNT} != 1111
	echo ${FOO:Q} ${COUNT}
	make -f bar.mk FOO=${FOO:Q} COUNT=${COUNT}1
.endif
EOF

# Before the change:
$ make -f bar.mk
make -f bar.mk
echo echo\ \$@ 1
echo $@ 1
make -f bar.mk FOO=echo\ \$@ COUNT=11
echo echo\ all 11
echo all 11
make -f bar.mk FOO=echo\ all COUNT=111
echo echo\ all 111
echo all 111
make -f bar.mk FOO=echo\ all COUNT=1111

# After the change:
$ make -f bar.mk
echo echo\ \$\$@ 1
echo $$@ 1
make -f bar.mk FOO=echo\ \$\$@ COUNT=11
echo echo\ \$\$@ 11
echo $$@ 11
make -f bar.mk FOO=echo\ \$\$@ COUNT=111
echo echo\ \$\$@ 111
echo $$@ 111
make -f bar.mk FOO=echo\ \$\$@ COUNT=1111

So :Q did not work correctly before (since it cannot be used
recursively and it needs to over quote and over repeat dollars to
DTRT at the first level) and now it does. I am not sure if it is
possible or even worth the brain damage to make it backwards
compatible.

christos


Home | Main Index | Thread Index | Old Index