* gzip.c (main): Disallow an empty --suffix=S also with -d.
Otherwise, "gzip -d -S '' F.gz" would ask if it's ok to remove the
existing file, "F.gz"; if you reply "yes", you'd lose all of that data.
Use of an empty suffix was already rejected in compression mode.
* gzip.1 (--suffix (-S)): Do not recommend to use "gunzip -S '' *".
Describe how the suffix is used when decompressing, too.
* NEWS (Bug fixes): mention the fix.
Reported by Ripduman Sohan.
** Bug fixes
+ "gzip -d -S '' precious.gz" is now rejected immediately. Before,
+ that command would emulate "rm -i precious.gz", but with an easily-
+ misunderstood prompt. I.e., gzip would ask if it's ok to remove the
+ existing file, "precious.gz". If you made the mistake of saying "yes",
+ it would remove that input file before attempting to uncompress it.
+
gzip -cdf now properly handles input consisting of gzip'd data followed
by uncompressed data. Before it would output raw compressed input, too.
For example, now "(printf x|gzip; echo y)|gzip -dcf" prints "xy\n",
Rick Sladkey jrs@world.std.com
Daniel L Smith dls@autodesk.com
Fred Smith fredex%fcshome@merk.merk.com
+Ripduman Sohan Ripduman.Sohan@cl.cam.ac.uk
Stephen Soliday soliday@ncat.edu
Paul Southworth pauls@css.itd.umich.edu
Rob Spencer robbie@winkle.bhpese.oz.au
).
.TP
.B \-S .suf --suffix .suf
-Use suffix .suf instead of .gz. Any suffix can be given, but suffixes
+When compressing, use suffix .suf instead of .gz.
+Any non-empty suffix can be given, but suffixes
other than .z and .gz should be avoided to avoid confusion when files
-are transferred to other systems. A null suffix forces gunzip to try
-decompression on all given files regardless of suffix, as in:
+are transferred to other systems.
- gunzip -S "" * (*.* for MSDOS)
+When decompressing, add .suf to the beginning of the list of
+suffixes to try, when deriving an output file name from an input file name.
-Previous versions of gzip used
-the .z suffix. This was changed to avoid a conflict with
.IR pack "(1)".
.TP
.B \-t --test
program_name);
}
#endif
- if ((z_len == 0 && !decompress) || z_len > MAX_SUFFIX) {
- fprintf(stderr, "%s: incorrect suffix '%s'\n",
- program_name, z_suffix);
+ if (z_len == 0 || z_len > MAX_SUFFIX) {
+ fprintf(stderr, "%s: invalid suffix '%s'\n", program_name, z_suffix);
do_exit(ERROR);
}
+
if (do_lzw && !decompress) work = lzw;
/* Allocate all global buffers (for DYN_ALLOC option) */