[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] `compile' with spaces in arguments
From: |
Alexandre Duret-Lutz |
Subject: |
Re: [PATCH] `compile' with spaces in arguments |
Date: |
Sun, 26 Sep 2004 22:33:36 +0200 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) |
Sorry for the delay.
>>> "Ralf" == Ralf Wildenhues <address@hidden> writes:
[...]
Ralf> *snip*
>> +eat=
>> +
>> +for arg
>> +do
>> + if test -n "$eat"; then
Ralf> Please do not use test here, since it might fork, and
Ralf> that several times at this point. This enhances
Ralf> complaints about `compile' being slow. `case' is safe.
I really wouldn't care about that. test is used so much all
around the autotools that shaking the code to avoid it seems
pointless. People who are annoyed by this fork should do
themselves a favor and install some decent shell.
>> +# -o 'a c' should not be stripped because 'a c' is not an object
>> +# (it does not matter whether touch creates ./-- or not)
>> +./compile touch a.o -- -o 'a c' a.c
Ralf> Please consider using also args with two or more consecutive spaces.
Ralf> Those bugs are really tedious to find (like v='a b'; echo $v).
Thanks for the idea, I'm checking this in.
2004-09-26 Alexandre Duret-Lutz <address@hidden>
* tests/compile.test, tests/instsh2.test, tests/instspc.test: Use
two consecutive spaces in filename instead of one, to catch mistake
like `echo $val | ...`.
* tests/README: Suggest this.
Suggested by Ralf Wildenhues.
Index: tests/README
===================================================================
RCS file: /cvs/automake/automake/tests/README,v
retrieving revision 1.3
diff -u -r1.3 README
--- tests/README 3 Jul 2003 18:58:50 -0000 1.3
+++ tests/README 26 Sep 2004 20:27:26 -0000
@@ -100,6 +100,10 @@
before the following runs. On fast machines the new `configure.in'
could otherwise have the same timestamp as the old `autom4te.cache'.
+ Use filenames with two consecutive spaces when testing that some
+ code preserves filenames with spaces. This will catch errors like
+ `echo $filename | ...`.
+
Before commit: make sure the test is executable, add the tests to
TESTS in Makefile.am, add it to XFAIL_TESTS in addition if needed,
write a ChangeLog entry, send the diff to <address@hidden>.
Index: tests/compile.test
===================================================================
RCS file: /cvs/automake/automake/tests/compile.test,v
retrieving revision 1.2
diff -u -r1.2 compile.test
--- tests/compile.test 19 Sep 2004 21:42:09 -0000 1.2
+++ tests/compile.test 26 Sep 2004 20:27:26 -0000
@@ -26,18 +26,18 @@
cp $testsrcdir/../lib/compile .
-# -o 'a c' should not be stripped because 'a c' is not an object
+# -o 'a c' should not be stripped because 'a c' is not an object
# (it does not matter whether touch creates ./-- or not)
-./compile touch a.o -- -o 'a c' a.c
-test -f 'a c'
+./compile touch a.o -- -o 'a c' a.c
+test -f 'a c'
test -f ./-o
test -f a.o
test -f a.c
-rm -f 'a c' ./-o a.o a.c
+rm -f 'a c' ./-o a.o a.c
-./compile touch a.o -- -o 'a c.o' a.c
-test -f 'a c.o'
+./compile touch a.o -- -o 'a c.o' a.c
+test -f 'a c.o'
test ! -f ./-o
test ! -f a.o
test -f a.c
Index: tests/instsh2.test
===================================================================
RCS file: /cvs/automake/automake/tests/instsh2.test,v
retrieving revision 1.4
diff -u -r1.4 instsh2.test
--- tests/instsh2.test 5 Jul 2004 07:07:55 -0000 1.4
+++ tests/instsh2.test 26 Sep 2004 20:27:26 -0000
@@ -72,8 +72,8 @@
./install-sh -T x d3 && exit 1
# Ensure that install-sh works with names that include spaces
-touch 'a b'
-mkdir 'x y'
-./install-sh 'a b' 'x y'
-test -f x\ y/a\ b
-test -f 'a b'
+touch 'a b'
+mkdir 'x y'
+./install-sh 'a b' 'x y'
+test -f x\ \ y/a\ \ b
+test -f 'a b'
Index: tests/instspc.test
===================================================================
RCS file: /cvs/automake/automake/tests/instspc.test,v
retrieving revision 1.1
diff -u -r1.1 instspc.test
--- tests/instspc.test 28 Jan 2004 20:50:43 -0000 1.1
+++ tests/instspc.test 26 Sep 2004 20:27:26 -0000
@@ -33,7 +33,7 @@
set -e
# Make sure this system supports spaces in filenames.
-mkdir 'a b' || exit 77
+mkdir 'a b' || exit 77
cat >> configure.in <<'EOF'
AC_PROG_CC
@@ -65,21 +65,21 @@
sub_libnobase_a_SOURCES = source.c
test-install-space: install
- test -f "$(DESTDIR)/more space/foo/sub/nobase.h"
- test ! -f "$(DESTDIR)/more space/foo/nobase.h"
- test -f "$(DESTDIR)/more space/foo/base.h"
- test -f "$(DESTDIR)/more space/foo/sub/nobase.dat"
- test ! -f "$(DESTDIR)/more space/foo/nobase.dat"
- test -f "$(DESTDIR)/more space/foo/base.dat"
- test -f "$(DESTDIR)/more space/foo/sub/nobase.sh"
- test ! -f "$(DESTDIR)/more space/foo/nobase.sh"
- test -f "$(DESTDIR)/more space/foo/base.sh"
- test -f "$(DESTDIR)/more space/foo/sub/nobase$(EXEEXT)"
- test ! -f "$(DESTDIR)/more space/foo/nobase$(EXEEXT)"
- test -f "$(DESTDIR)/more space/foo/base$(EXEEXT)"
- test -f "$(DESTDIR)/more space/foo/sub/libnobase.a"
- test ! -f "$(DESTDIR)/more space/foo/libnobase.a"
- test -f "$(DESTDIR)/more space/foo/libbase.a"
+ test -f "$(DESTDIR)/more space/foo/sub/nobase.h"
+ test ! -f "$(DESTDIR)/more space/foo/nobase.h"
+ test -f "$(DESTDIR)/more space/foo/base.h"
+ test -f "$(DESTDIR)/more space/foo/sub/nobase.dat"
+ test ! -f "$(DESTDIR)/more space/foo/nobase.dat"
+ test -f "$(DESTDIR)/more space/foo/base.dat"
+ test -f "$(DESTDIR)/more space/foo/sub/nobase.sh"
+ test ! -f "$(DESTDIR)/more space/foo/nobase.sh"
+ test -f "$(DESTDIR)/more space/foo/base.sh"
+ test -f "$(DESTDIR)/more space/foo/sub/nobase$(EXEEXT)"
+ test ! -f "$(DESTDIR)/more space/foo/nobase$(EXEEXT)"
+ test -f "$(DESTDIR)/more space/foo/base$(EXEEXT)"
+ test -f "$(DESTDIR)/more space/foo/sub/libnobase.a"
+ test ! -f "$(DESTDIR)/more space/foo/libnobase.a"
+ test -f "$(DESTDIR)/more space/foo/libbase.a"
EOF
mkdir sub
@@ -107,7 +107,7 @@
mkdir build
cd build
-../configure --prefix '/more space'
+../configure --prefix '/more space'
$MAKE
-dest=`pwd`/'with space';
-DESTDIR="$dest" $MAKE -e test-install-space
+dest=`pwd`/'with space';
+DESTDIR=$dest $MAKE -e test-install-space
--
Alexandre Duret-Lutz