autoconf-patches
[Top][All Lists]
Advanced

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

Re: [PATCH 1/10] Proper file name escaping in Autoconf programs and Perl


From: Eric Blake
Subject: Re: [PATCH 1/10] Proper file name escaping in Autoconf programs and Perl modules.
Date: Wed, 12 Dec 2007 22:55:43 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de> writes:

> +AT_SETUP([autom4te and whitespace in file names])
> +
> +x=
> +export x
> +rm -f a b
> +# the first one omits special characters that are not w32 safe.
> +for funny in \
> +  'with  funny '\'' $x & #! name ' \
> +  'with  funny \ '\'' \'\'' " <a >b * ? name '

w32 also strips trailing spaces; usually not a problem when creating files 
(since subsequent attempts to use the space also get stripped), but fatal 
when 'mkdir "dir /"' silently creates "dir/", but you are still attempting to 
reference "dir /sub" (you'd think that if w32 was going to silently strip 
spaces, they could at least do it before directory separators as well, but no).

> +do
> +  file=" file $funny"
> +  dir=" dir $funny"
> +  cachedir=" cache$dir"
> +  TMPDIR=" tmp$dir"
> +  export TMPDIR
> +
> +  cat >"$file.m4" <<'END'

This also caused a failure.  On cygwin, bash is using my patch to prefer 
$TMPDIR rather than /tmp for creating here-docs, so you are using $TMPDIR set 
to a non-existent directory.  [Note to self: fix the cygwin port of bash to 
fall back on /tmp if $TMPDIR doesn't exist.]

...
++ TMPDIR=' tmp dir with  funny '\'' $x & #! name'
++ export TMPDIR
++ cat
/home/eblake/autoconf/tests/testsuite.dir/at-test-source: line 29: cannot 
create temp file for here document: No such file or directory
++ set +x


This patch at least lets test 5 skip rather than fail, and I verified that it 
is not skipping until after the first of the two candidate funny names has 
succeeded, thus giving some test coverage on cygwin.

From: Eric Blake <address@hidden>
Date: Wed, 12 Dec 2007 15:50:31 -0700
Subject: [PATCH] Fix some whitespace tests on cygwin.

* tests/tools.at (autom4te and whitespace in file names): Restore
font-lock.  Create $TMPDIR before it might be used.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog      |    4 ++++
 tests/tools.at |   12 +++++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index bcf598a..47cdf2e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2007-12-12  Eric Blake  <address@hidden>
 
+       Fix some whitespace tests on cygwin.
+       * tests/tools.at (autom4te and whitespace in file names): Restore
+       font-lock.  Create $TMPDIR before it might be used.
+
        Fix spurious testsuite failure with M4 1.4.11.
        * tests/local.at (AT_CHECK_M4): Cater to new m4 error message.
 
diff --git a/tests/tools.at b/tests/tools.at
index 8c0794f..e5f9ae8 100644
--- a/tests/tools.at
+++ b/tests/tools.at
@@ -146,10 +146,11 @@ AT_SETUP([autom4te and whitespace in file names])
 x=
 export x
 rm -f a b
-# the first one omits special characters that are not w32 safe.
+# the first one omits special characters and trailing spaces,
+# which are not w32 safe.
 for funny in \
-  'with  funny '\'' $x & #! name ' \
-  'with  funny \ '\'' \'\'' " <a >b * ? name '
+  'with  funny '\'' $x & #! name' \
+  'with  funny \ '\'' \'\'' " <a >b * ? name ' # "restore font-lock
 do
   file=" file $funny"
   outfile="$file out "
@@ -158,13 +159,14 @@ do
   TMPDIR=" tmp$dir"
   export TMPDIR
 
+  # skip if we cannot create such a file or directory
+  AT_CHECK([mkdir "$dir" "$cachedir" "$TMPDIR" && touch "$file" || exit 77])
+
   cat >"$file" <<'END'
 [m4@&address@hidden(foo.m4)
 m4@&address@hidden(0)d@&address@hidden
 FOO]
 END
-  # skip if we cannot create such a file or directory
-  AT_CHECK([mkdir "$dir" "$cachedir" "$TMPDIR" && test -f "$file" || exit 77])
   cat >"$dir"/foo.m4 <<'END'
 [m4@&address@hidden([FOO], [bar])]
 END
-- 
1.5.3.5







reply via email to

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