Import upstream version 1.26
[debian/tar] / tests / remfiles01.at
index 940fd953af79f1f154f103d83fced9f0429468d6..1fb0fadc547d67c91974af11a2e56d343d79a1ad 100644 (file)
@@ -30,7 +30,9 @@ AT_KEYWORDS([create remove-files remfiles01 gzip])
 
 unset TAR_OPTIONS
 AT_CHECK([
+AT_UNPRIVILEGED_PREREQ
 AT_GZIP_PREREQ
+AT_SIGPIPE_PREREQ
 AT_SORT_PREREQ
 
 mkdir dir
@@ -46,7 +48,11 @@ mkdir c
 # or
 #  tar: Child returned status 2
 
-tar -c -f a -z --remove-files b c 2>err
+# Discard diagnostics that some shells generate about broken pipes,
+# and discard all of tar's diagnostics except for the ones saying "(child)".
+# Gzip's exit code is propagated to the shell.  Usually it is 141.
+# Convert all non-zero exits to 2 to make it predictable.
+(tar -c -f a -z --remove-files b c 2>err || (exit 2) ) 2>/dev/null
 EC=$?
 sed -n '/(child)/p' err >&2
 rm err