]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
depmod tests: fix bug in depmodes list extraction
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 7 May 2011 09:49:40 +0000 (11:49 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 7 May 2011 09:49:40 +0000 (11:49 +0200)
* tests/depmod-tests.sh (get_depmodes): Use `echo $all_depmodes'
instead of `... | tr "$nl" "$sp"' to strip extra whitespaces and
newlines from `$all_depmodes'.  The latter idiom with `tr' is
wrong since it gets run before `./defs' is sourced, and thus `$nl'
and `$sp' are undefined.
Bug revealad by FreeBSD tr(1) implementation, which doesn't accept
empty strings as arguments.

ChangeLog
tests/depmod-tests.sh

index 541955c29ff12f072e90d6612c59d2f0ecf888dd..f427fa8adf464a41db22474bae9e518359d20b17 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-05-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       depmod tests: fix bug in depmodes list extraction
+       * tests/depmod-tests.sh (get_depmodes): Use `echo $all_depmodes'
+       instead of `... | tr "$nl" "$sp"' to strip extra whitespaces and
+       newlines from `$all_depmodes'.  The latter idiom with `tr' is
+       wrong since it gets run before `./defs' is sourced, and thus `$nl'
+       and `$sp' are undefined.
+       Bug revealad by FreeBSD tr(1) implementation, which doesn't accept
+       empty strings as arguments.
+
 2011-05-01  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        tests: extend tests on dependency tracking with VPATH
index 4eb8419fb8030fcb39e4aff5a05091bc2037b3d6..2be8af0528d58fa7c112da1939c1176c4d6f91cf 100755 (executable)
@@ -141,7 +141,9 @@ get_depmodes ()
 {
   # Keep this in sync with the contents of depend.m4.
   all_depmodes=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < "$1" \
-    | grep -v '^none$' | tr "$nl" "$sp"` \
+                  | grep -v '^none$'` \
+    && : Turn newlines and tabs into spaces, and strip extra whitespace. \
+    && all_depmodes=`echo $all_depmodes` \
     && test -n "$all_depmodes" || {
       echo "$2: failed to extract list of valid depmodes from '$1'" >&2
       exit 99