tech-toolchain archive

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

Re: make :Q breakage



On Fri, May 25, 2018 at 20:05:34 -0400, Christos Zoulas wrote:

> 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 "$$@"
[...]
> 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.

I'm confused.  Let's change my example to

p=XXX
FOO=doit $p "$$@"
default:
        p=ZZZ; foo=${FOO:Q}; echo foo=$$foo


It was doing

  p=ZZZ; foo=doit\ XXX\ \"\$@\"; echo foo=$foo

before, and it does

  p=ZZZ; foo=doit\ XXX\ \"\$\$@\"; echo foo=$foo

now.

So why $p is expanded and $$ (that expands to "$") is not expanded?
When does :Q logically happen w.r.t. expandion?

-uwe


Home | Main Index | Thread Index | Old Index