Bug 24104
| Summary: | zgrep should catch SIGPIPE | ||
|---|---|---|---|
| Product: | [Retired] Red Hat Linux | Reporter: | Karsten Hopp <karsten> |
| Component: | gzip | Assignee: | Trond Eivind Glomsrxd <teg> |
| Status: | CLOSED RAWHIDE | QA Contact: | David Lawrence <dkl> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.1 | ||
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | i386 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2001-01-31 00:16:23 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Karsten Hopp
2001-01-16 12:39:16 UTC
I agree that it's a problem... patch? :) adding a line with 'trap break SIGPIPE' before the for loop, an 'echo' at the end of the loop and a line 'trap - SIGPIPE' seems to work here, but I can't say if this breaks anything else. The echo is needed or the trap won't be executed until the for loop is finished. I can't get that working... exactly how does your script look? Only the last few lines of zgrep:
res=0
trap break SIGPIPE
for i do
if test $list -eq 1; then
gzip -cdfq "$i" | $grep $opt "$pat" > /dev/null && echo $i
r=$?
elif test $# -eq 1 -o $silent -eq 1; then
gzip -cdfq "$i" | $grep $opt "$pat"
r=$?
else
gzip -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${i}:|"
r=$?
fi
test "$r" -ne 0 && res="$r"
echo
done
trap - SIGPIPE
exit $res
Fixed in gzip-1.3-11... I added the echo after the loop. Doh. |