After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 637465 - bad shell grammar breaks a nested command substitution
bad shell grammar breaks a nested command substitution
Status: RESOLVED FIXED
Product: gnome-doc-utils
Classification: Deprecated
Component: build utils
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-doc-utils maintainers
gnome-doc-utils maintainers
Depends on:
Blocks:
 
 
Reported: 2010-12-17 14:07 UTC by Chris Coleman
Modified: 2010-12-20 14:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch to fix nested command substitution in tools/gnome-doc-utils.make (1.02 KB, application/octet-stream)
2010-12-17 14:07 UTC, Chris Coleman
Details

Description Chris Coleman 2010-12-17 14:07:33 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"
Comment 1 Shaun McCance 2010-12-17 14:29:04 UTC
Pushed to master. Thanks for the patch!
Comment 2 Chris Coleman 2010-12-17 14:38:14 UTC
That was quick. Thanks, Shaun!
Comment 3 Philip Withnall 2010-12-20 12:21:36 UTC
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.
Comment 4 Shaun McCance 2010-12-20 14:27:57 UTC
Yup. Version 0.20.3 released.