Created attachment 585883 [details] Handle command line arguments in abs2rel.lua Description of problem: abs2rel.sh uses its arguments in a string to be evaluated as lua program. Certain special characters in those arguments, e.g. ", can cause it to fail because of an incorrect quoting. This can be fixed by making lua script handle its arguments instead, see attached patch. Not that it makes shell wrapper rather pointless and should allow calling lua directly from .spec scripts: %define abs2rel lua %{_datadir}/java-utils/abs2rel.lua Additional info: Compared to the original perl version, there are few differences not addressed in the patch (but also not relevant to how abs2rel is currently used): - the second argument is not optional - relative paths are handled as absolute
Jiri, can you please investigate?
Well this solution is even more funny but unless there are more affected chars then quotes (what I doubt) then it is going to work and will keep the script nearly untouched. a=`echo $1|sed s,\",\\\\\\\\\",g` ; b=`echo $2|sed s,\",\\\\\\\\\",g` ; (cd `dirname $0` && lua -l abs2rel -e "print(abs2rel(\"$a\", \"$b\"))")
$ ./funny-abs2rel.sh '' '\"));os.execute([[echo BLEH]]);--' BLEH
Created attachment 656831 [details] Reimplement abs2rel.sh using perl File::Spec module This patch resolves 2 bugs (this one and also bug #882578)
I've applied patch from comment 5. & build jpackage-utils.