these problems:
1) gzip -vt just prints the contents of a .Z file
2) gzip -vt will print OK even if the .gz file is corrupt
3) gzip -vt prints nothing with a .bz2 file
4) gzip can loop endlessly with a corrupt .bz2 file
Rework logic of gz_{un}compress to make it much less likely to leak fds
(at least 2 non-error paths leaked them!)
Make -S ".xyz" and -S "" both do something sensible.
Make in-situ compression work - only lose the file on error.
Pass an open fd to zopen (renamed zdopen) to avoid fd leakage (was badly borked)
Write header into first 64k output block to writes are aligned.
(more efficient and might avoid some problem with code that doesn't
like receiving partial buffers)
Check file size on compression - double checks against fs full.
Remove some pointless casts, and otherwise simplify some logic.
- fix any decompression on corrupted gzip files. PR#25508
- ask to overwrite files if we have a tty, rather than failing the
operation. PR#25509.
- clean up maybe_err()/maybe_warn(): use maybe_err() only for fatal
errors. maybe_warn() is for processing errors. this allows
"gzip -d file1.gz file2.gz" to decompress file2.gz even if file1.gz
is corrupted, etc.
- change the internal compressor/decompressor API to return "-1" on
failure, not 0. this allows for 0-sized files to be decompressed
correctly.
anymore, use the low-level inflate()/deflate() directly. this
allows support file-type detection on stdin; now can decompress
.Z and .bz2 files fed to stdin (fixes PR#25192) additionally it
makes -v work with stdin or stdout (fixes PR#25215.)
(with these changes, we no longer need gzopenfull(3) in libz.)
thanks to martin@ for the code gzip.c:gz_uncompress() is based on.