GNOME Bugzilla – Bug 637465
bad shell grammar breaks a nested command substitution
Last modified: 2010-12-20 14:27:57 UTC
Created attachment 176592 [details] patch to fix nested command substitution in tools/gnome-doc-utils.make In gnome-doc-utils.make, the rule for $(DOC_H_FILE) will attempt to use nested command substitution using nested backquotes, as in `foo `bar``. However, shells will interpret that expression as `foo` bar ``. Here's the code from tools/gnome-doc-utils.make: _ids ?= `$(PKG_CONFIG) --variable xmldir gnome-doc-utils`/gnome/xslt/docbook/utils/ids.xsl $(DOC_H_FILE): $(DOC_H_DOCS); ... ids=`xsltproc --xinclude --path "$$xmlpath" $(_ids) $$doc`; \ ... After that last line has been expanded by the shell, it becomes: ids=`xsltproc --xinclude --path "$xmlpath" `/usr/bin/pkg-config --variable xmldir gnome-doc-utils`/gnome/xslt/docbook/utils/ids.xsl $doc`; \ Which will not be interpreted as one command substitution within another, but as one command substitution after another: `xsltproc --xinclude --path "$xmlpath" ` and `/gnome/xslt/docbook/utils/ids.xsl $doc` The first command does nothing. The second produces this message: /bin/sh: line 6: /gnome/xslt/docbook/utils/ids.xsl: No such file or directory Then, after the output of the commands has been substituted, the line becomes: ids=/usr/bin/pkg-config --variable xmldir gnome-doc-utils; \ Which tries to run a command named "--variable": /bin/sh: line 6: --variable: command not found I've attached a patch. It uses make's $(shell ...) command instead of backquotes for the inner-most command. It probably won't be acceptable in its current form. The change contrasts badly with the surrounding code. This bug was reported to Gentoo's Bugzilla as a bug in totem. But other than the output messages, it has no actual affect on the build. https://bugs.gentoo.org/show_bug.cgi?id=348403 I've confirmed that the same happens when building totem 2.32.0 on Ubuntu Maverick. And Google has some, but few, results for the warning message: http://www.google.com/search?q="/bin/sh:+line+6:+/gnome/xslt/docbook/utils/ids.xsl:+No+such+file+or+directory"
Pushed to master. Thanks for the patch!
That was quick. Thanks, Shaun!
Shaun, can you make a release or bump the g-d-u's version number in master please, so that Totem can bump its g-d-u dependency to a version which contains this fix? Thanks.
Yup. Version 0.20.3 released.