From 90d328715bac43d0e0568d137602d7dab36c29d1 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Sat, 7 May 2011 11:49:40 +0200 Subject: [PATCH] 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. --- ChangeLog | 11 +++++++++++ tests/depmod-tests.sh | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 541955c..f427fa8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2011-05-07 Stefano Lattarini + + 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 tests: extend tests on dependency tracking with VPATH diff --git a/tests/depmod-tests.sh b/tests/depmod-tests.sh index 4eb8419..2be8af0 100755 --- a/tests/depmod-tests.sh +++ b/tests/depmod-tests.sh @@ -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 -- 2.7.4