[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-cppi] [PATCH 10/19] maint: update init.sh from gnulib
From: |
Jim Meyering |
Subject: |
[bug-cppi] [PATCH 10/19] maint: update init.sh from gnulib |
Date: |
Wed, 25 Jan 2012 09:22:47 +0100 |
From: Jim Meyering <address@hidden>
* tests/init.sh: Update from gnulib.
---
tests/init.sh | 26 ++++++++++++++++----------
1 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/tests/init.sh b/tests/init.sh
index 6266a25..5985552 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -242,20 +242,20 @@ compare_dev_null_ ()
if test "x$1" = x/dev/null; then
test -s "$2" || return 0
- { emit_diff_u_header_ "$@"; sed 's/^/+/' -- "$2"; } >&2
+ emit_diff_u_header_ "$@"; sed 's/^/+/' "$2"
return 1
fi
if test "x$2" = x/dev/null; then
test -s "$1" || return 0
- { emit_diff_u_header_ "$@"; sed 's/^/-/' -- "$1"; } >&2
+ emit_diff_u_header_ "$@"; sed 's/^/-/' "$1"
return 1
fi
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
@@ -304,11 +304,17 @@ fi
# Otherwise, propagate $? to caller: any diffs have already been printed.
compare ()
{
- compare_dev_null_ "$@"
- case $? in
- 0|1) return $?;;
- *) compare_ "$@";;
- esac
+ # This looks like it can be factored to use a simple "case $?"
+ # after unchecked compare_dev_null_ invocation, but that would
+ # fail in a "set -e" environment.
+ if compare_dev_null_ "$@"; then
+ return 0
+ else
+ case $? in
+ 1) return 1;;
+ *) compare_ "$@";;
+ esac
+ fi
}
# An arbitrary prefix to help distinguish test directories.
@@ -521,7 +527,7 @@ mktempd_ ()
esac
# First, try to use mktemp.
- d=`unset TMPDIR; mktemp -d -t -p "$destdir_" "$template_" 2>/dev/null` \
+ d=`unset TMPDIR; { mktemp -d -t -p "$destdir_" "$template_"; } 2>/dev/null` \
|| fail=1
# The resulting name must be in the specified directory.
--
1.7.9.rc2.2.g183d6
- [bug-cppi] use mostly-non-recursive make, Jim Meyering, 2012/01/25
- [bug-cppi] [PATCH 01/19] build: remove use of vestigial rm_subst, Jim Meyering, 2012/01/25
- [bug-cppi] [PATCH 04/19] maint: man: use dist_man1_MANS, rather than dist_man_MANS, Jim Meyering, 2012/01/25
- [bug-cppi] [PATCH 02/19] update bootstrap; don't recurse into lib/ or src/, Jim Meyering, 2012/01/25
- [bug-cppi] [PATCH 08/19] maint: .gitignore: ignore/adjust a few more, Jim Meyering, 2012/01/25
- [bug-cppi] [PATCH 03/19] maint: remove useless artifacts copied from coreutils, Jim Meyering, 2012/01/25
- [bug-cppi] [PATCH 09/19] build: remove obsolete settings from cfg.mk, Jim Meyering, 2012/01/25
- [bug-cppi] [PATCH 10/19] maint: update init.sh from gnulib,
Jim Meyering <=
- [bug-cppi] [PATCH 11/19] maint: remove redundant build output, Jim Meyering, 2012/01/25
- [bug-cppi] [PATCH 05/19] build: don't recurse into man/ when building, Jim Meyering, 2012/01/25
- [bug-cppi] [PATCH 07/19] build: don't recurse into tests/ when building, Jim Meyering, 2012/01/25
- [bug-cppi] [PATCH 12/19] maint: use gnulib's getopt-gnu, not the deprecated getopt module, Jim Meyering, 2012/01/25
- [bug-cppi] [PATCH 13/19] maint: tweak m4 quoting in AC_CONFIG_FILES, Jim Meyering, 2012/01/25
- [bug-cppi] [PATCH 06/19] tests: add the help-version test, Jim Meyering, 2012/01/25
- [bug-cppi] [PATCH 14/19] build: part two of using subdir-objects: handle e.g., GETOPT_H, Jim Meyering, 2012/01/25
- [bug-cppi] [PATCH 17/19] version 1.16, Jim Meyering, 2012/01/25
- [bug-cppi] [PATCH 18/19] maint: post-release administrivia, Jim Meyering, 2012/01/25
- [bug-cppi] [PATCH 15/19] build: don't depend on help2man when building from dist tarball, Jim Meyering, 2012/01/25