zgrep: fix shell portability bug with -f; fix mishandling of "-e -"
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 9 Nov 2010 21:17:57 +0000 (13:17 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 9 Nov 2010 21:18:10 +0000 (13:18 -0800)
commiteca422584b9aca740d13c02e92e113225bc8c30f
tree47eabf7cf048cbf48f8bf19eb4c30d67de20d930
parent50ee35c903cdecf6c643d107015125f517620102
zgrep: fix shell portability bug with -f; fix mishandling of "-e -"

* tests/zgrep-f: Check for "zgrep -e -" bug, too.
* zgrep.in: Don't assume that if the shell redirects fd 6, then
this redirection is visible to the subsidiary grep.  POSIX doesn't
guarantee this visibility except for file descriptors 0, 1, and 2,
and ksh does not support it.  Problem reported by Thomas Schulz in
<http://lists.gnu.org/archive/html/bug-gzip/2010-11/msg00000.html>.
Also, fix a related bug: "-e -" was mishandled.  These two bugs
were introduced by commit 5b54db4546b84ec97ff57a62f8ddb98faacf77f2
dated 2009-10-09.
(escape): Change the convention: do not assume that a stray X
is present at the end of the last line.  All uses changed.
There was no longer any need for this convention, and fixing this
made it a bit easier to use 'sed' in a later part of the fix.
tests/zgrep-f
zgrep.in