1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-01 12:19:28 +00:00

In gunzip(1), treat trailing garbage as a warning and not an error. This

allows scripts to distinguish it between real fatal errors, for instance a
CRC mismatch.

Update manual page for the behavior change.

PR:		bin/203873
Submitted by:	Eugene Grosbein <eugen grosbein net>
MFC after:	2 weeks
This commit is contained in:
Xin LI 2015-10-26 22:29:58 +00:00
parent 3db4ea954e
commit 354ed04257
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=290024
2 changed files with 10 additions and 3 deletions

View File

@ -25,7 +25,7 @@
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.\" $FreeBSD$ .\" $FreeBSD$
.Dd April 6, 2015 .Dd October 26, 2015
.Dt GZIP 1 .Dt GZIP 1
.Os .Os
.Sh NAME .Sh NAME
@ -136,7 +136,7 @@ option, allowing non-compressed data to pass through unchanged.
.It Fl h , -help .It Fl h , -help
This option prints a usage summary and exits. This option prints a usage summary and exits.
.It Fl k , -keep .It Fl k , -keep
Keep (don't delete) input files during compression Keep (do not delete) input files during compression
or decompression. or decompression.
.It Fl L , -license .It Fl L , -license
This option prints This option prints
@ -183,6 +183,12 @@ is set, it is parsed as a white-space separated list of options
handled before any options on the command line. handled before any options on the command line.
Options on the command line will override anything in Options on the command line will override anything in
.Ev GZIP . .Ev GZIP .
.Sh EXIT STATUS
The
.Nm
utility exits 0 on success,
1 on errors,
and 2 if a warning occurs.
.Sh SEE ALSO .Sh SEE ALSO
.Xr bzip2 1 , .Xr bzip2 1 ,
.Xr compress 1 , .Xr compress 1 ,
@ -220,7 +226,7 @@ with unpack support written by
.An Xin LI Aq Mt delphij@FreeBSD.org . .An Xin LI Aq Mt delphij@FreeBSD.org .
.Sh BUGS .Sh BUGS
According to RFC 1952, the recorded file size is stored in a 32-bit According to RFC 1952, the recorded file size is stored in a 32-bit
integer, therefore, it can not represent files larger than 4GB. integer, therefore, it cannot represent files larger than 4GB.
This limitation also applies to This limitation also applies to
.Fl l .Fl l
option of option of

View File

@ -810,6 +810,7 @@ gz_uncompress(int in, int out, char *pre, size_t prelen, off_t *gsizep,
if (in_tot > 0) { if (in_tot > 0) {
maybe_warnx("%s: trailing garbage " maybe_warnx("%s: trailing garbage "
"ignored", filename); "ignored", filename);
exit_value = 2;
goto stop; goto stop;
} }
maybe_warnx("input not gziped (MAGIC0)"); maybe_warnx("input not gziped (MAGIC0)");