From: Jim Meyering Date: Thu, 5 Jan 2012 15:45:50 +0000 (+0100) Subject: init.sh: don't waste a subshell just to redirect stderr X-Git-Tag: v0.1~1298 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=b301fd3cf02f022cc8d0a5103b2ab3bf4286a81a;p=gnulib.git init.sh: don't waste a subshell just to redirect stderr * tests/init.sh: In testing for diff -u and diff -c, use a stderr-redirecting exec inside `...` rather than a subshell. --- diff --git a/ChangeLog b/ChangeLog index 7f8998d90..23b1e871a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2012-01-05 Jim Meyering + init.sh: don't waste a subshell just to redirect stderr + * tests/init.sh: In testing for diff -u and diff -c, use a + stderr-redirecting exec inside `...` rather than a subshell. + test-init.sh: avoid failure on HP-UX 11.00 * tests/test-init.sh: Skip "diff -u"-comparing step when compare resolves to diff -c or cmp. Reported by Bruno Haible. diff --git a/tests/init.sh b/tests/init.sh index 948549262..65458c797 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -255,7 +255,7 @@ compare_dev_null_ () return 2 } -if diff_out_=`( diff -u "$0" "$0" < /dev/null ) 2>/dev/null`; then +if diff_out_=`exec 2>/dev/null; diff -u "$0" "$0" < /dev/null`; then if test -z "$diff_out_"; then compare_ () { diff -u "$@"; } else @@ -273,7 +273,7 @@ if diff_out_=`( diff -u "$0" "$0" < /dev/null ) 2>/dev/null`; then fi } fi -elif diff_out_=`( diff -c "$0" "$0" < /dev/null ) 2>/dev/null`; then +elif diff_out_=`exec 2>/dev/null; diff -c "$0" "$0" < /dev/null`; then if test -z "$diff_out_"; then compare_ () { diff -c "$@"; } else