Package: grep Version: 2.5.1.ds1-4 Severity: normal Tags: patch The bulk of zgrep's work is done by this loop:
for i do gzip -cdfq "$i" | if test $files_with_matches -eq 1; then $grep $opt "$pat" > /dev/null && echo $i elif test $files_without_matches -eq 1; then $grep $opt "$pat" > /dev/null || echo $i elif test $with_filename -eq 0 && { test $# -eq 1 || test $no_filename -eq 1; }; then $grep $opt "$pat" else i=`echo $i | sed -e 's/|/\\\\|/g'` if test $with_filename -eq 1; then sed_script="s|^[^:]*:|${i}:|" else sed_script="s|^|${i}:|" fi $grep $opt "$pat" | sed "$sed_script" fi r=$? test $res -lt $r && res=$r done If the else clause of the if is taken, then grep's return code is lost. The patch below fixes this, assuming that /bin/sh is bash, which I guess is safe for Debian, but perhaps not upstream. I spent quite a while but didn't manage to find a more general fix. --- /bin/zgrep 2004-07-24 09:30:47.000000000 +0200 +++ zgrep 2005-01-30 23:02:13.000000000 +0100 @@ -107,6 +107,7 @@ sed_script="s|^|${i}:|" fi $grep $opt "$pat" | sed "$sed_script" + exit ${PIPESTATUS[0]} fi r=$? test $res -lt $r && res=$r -- System Information: Debian Release: 3.1 APT prefers testing APT policy: (500, 'testing') Architecture: i386 (i686) Kernel: Linux 2.6.8 Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) Versions of packages grep depends on: ii libc6 2.3.2.ds1-20 GNU C Library: Shared libraries an -- no debconf information -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]