__program__ may contain spaces

Eric Blake <[email protected]>
Newsgroups gmane.comp.gnu.m4.patches
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On mingw, __program__ is generally absolute, and users typically like (for
whatever stupid reason) to install in directories with spaces.  Yet, the
testsuite attempts to recursively invoke m4 using __program__ as an
argument to syscmd, which falls apart when the shell performs word
splitting on space.  Providing some shell quoting around the expansion of
__program__ reduces the set of absolute file names that can cause grief.
You will never be able to fully eliminate the problem; for example, a
determined user could install m4 with a name that includes unbalanced m4
quoting.  But as malicious file names are less common than spaces in
directory names, I didn't worry about trying to protect against ' in the
file name.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             [email protected]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmue1wACgkQ84KuGfSFAYDTrQCfU8MGw4Jwk90SNr3CQpaWr3cB
akwAn1JE1VEZB2ZpvNdDcSggQizZn6Ly
=csLI
-----END PGP SIGNATURE-----

_______________________________________________
M4-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/m4-patches
m4.patch405 (text/plain, 1.7 KB)
From e94228df28e881da59dd86bfb513ad9d07ca392a Mon Sep 17 00:00:00 2001
From: Eric Blake <[email protected]>
Date: Tue, 3 Mar 2009 16:35:06 -0700
Subject: [PATCH] Try to tolerate spaces in directory names in testsuite.

* doc/m4.texinfo (Diversions, Using frozen files): Provide shell
quoting, in case __program__ contains spaces.

Signed-off-by: Eric Blake <[email protected]>
---
 ChangeLog      |    4 ++++
 doc/m4.texinfo |    6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4bfaf6e..a276ec1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2009-03-03  Eric Blake  <[email protected]>

+	Try to tolerate spaces in directory names in testsuite.
+	* doc/m4.texinfo (Diversions, Using frozen files): Provide shell
+	quoting, in case __program__ contains spaces.
+
 	Improve web-manual maintainer rule.
 	* maint.mk (web-manual): Work with VPATH builds.  Factor
 	package-specific detail...
diff --git a/doc/m4.texinfo b/doc/m4.texinfo
index 6877ecc..f07b9ae 100644
--- a/doc/m4.texinfo
+++ b/doc/m4.texinfo
@@ -5180,7 +5180,7 @@ Diversions
 ')m4exit(`77')')dnl
 changequote(`[', `]')dnl
 syscmd([echo 'divert(1)hi
-format(%1000000d, 1)' | ]__program__[ | sed -n 1p])dnl
+format(%1000000d, 1)' | ']__program__[' | sed -n 1p])dnl
 @result{}hi
 sysval
 @result{}0
@@ -7115,9 +7115,9 @@ Using frozen files
 ')m4exit(`77')')dnl
 changequote(`[', `]')dnl
 syscmd([echo 'changequote([,])pushdef([divnum],[hi])dnl' \
-       | ]__program__[ -F in.m4f \
+       | ']__program__[' -F in.m4f \
      && echo 'divnum popdef([divnum])divnum' \
-       | ]__program__[ -R in.m4f \
+       | ']__program__[' -R in.m4f \
      && rm in.m4f])status sysval
 @result{}hi 0
 @result{}status 0
-- 
1.6.1.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.