Hi Jim. On 01/05/2012 04:46 PM, Jim Meyering wrote: > Looking at Bruno's recent test-init.sh failure, > I noticed the unnecessary sub-shells here: > > From a815c2160e6d6cc27d934e669ef9486bab310db3 Mon Sep 17 00:00:00 2001 > From: Jim Meyering <meyer...@redhat.com> > Date: Thu, 5 Jan 2012 16:45:50 +0100 > Subject: [PATCH] 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. > --- > ChangeLog | 4 ++++ > tests/init.sh | 4 ++-- > 2 files changed, 6 insertions(+), 2 deletions(-) > > diff --git a/ChangeLog b/ChangeLog > index eb4a3a1..3eb41be 100644 > --- a/ChangeLog > +++ b/ChangeLog > @@ -1,5 +1,9 @@ > 2012-01-05 Jim Meyering <meyer...@redhat.com> > > + 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 9485492..65458c7 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 > Wouldn't it be simpler and better to leave that redirection out altogether? The output of the test scripts should be redirected to `.log' files by the testsuite harness, so by being more verbose we can make those files more informative, all without cluttering the make output.
Regards, Stefano