m4-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

__program__ may contain spaces


From: Eric Blake
Subject: __program__ may contain spaces
Date: Wed, 04 Mar 2009 06:00:13 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.19) Gecko/20081209 Thunderbird/2.0.0.19 Mnenhy/0.7.6.666

-----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             address@hidden
-----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-----
>From e94228df28e881da59dd86bfb513ad9d07ca392a Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
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 <address@hidden>
---
 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  <address@hidden>

+       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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]