RFR: JDK-8160491: tar.gz bundles missing files containing $

Erik Joelsson erik.joelsson at oracle.com
Thu Nov 3 14:32:05 UTC 2016


The build logic for tar.gz bundles cannot handle files containing $. For 
the Oracle internal docs bundle, this is a problem since there are 
example inner classes included. Escaping of $ is always a pain point 
when working with make. After having investigated this quite thoroughly 
I have found what I think is the best solution.

What happens here is something like this:

LIST_OF_FILES := $(some find expression creating a list of files)
$(eval $(call SomeMacro, FOO, \
     FILES := $(LIST_OF_FILES), \
     ...  \
))

If LIST_OF_FILES contains a file with a $, that $ will get eaten by the 
$(eval). When we supply arguments to such macros inline, we currently 
have to escape them two times like this (in order to get EXCLUDES to 
contain foo$bar):

$(eval $(call SomeMacro, FOO, \
     EXCLUDES := foo$$$$bar, \
     ...  \
))

Because of this, I think the best solution is to modify the logic 
evaluating the parameters for such macros, with a strategically placed 
call to DoubleDollar to compensate for the extra evaluation of the 
parameter values. Then the first example will just work and the second 
becomes:

$(eval $(call SomeMacro, FOO, \
     EXCLUDES := foo$$bar, \
     ...  \
))

Bug: https://bugs.openjdk.java.net/browse/JDK-8160491
Webrev: http://cr.openjdk.java.net/~erikj/8160491/webrev.01/

/Erik



More information about the build-dev mailing list