Commit Graph

19 Commits

Author SHA1 Message Date
Xin LI
deb6327793 Correct a stack underflow in gzip:
- Limit suffix to be no more than 30 bytes long.  This matches GNU
   behavior.
 - Correct usage of memcpy().

Note that this commit only corrects the stack underflow issue, we
still need some other fixes to cover other edges. [1]

Reported by:	Ron Jude <ronj wytheville org>
Discussed with:	Matthew Green (original NetBSD gzip author),
		Eygene Ryabinkin <rea-fbsd codelabs ru> [1]
Approved by:	re (kib)
2009-07-31 08:37:27 +00:00
Xin LI
b47ed83de8 Sync with NetBSD:
- gzip -n does not store timestamp; [1]
 - Reduce diff against NetBSD by moving some casts in our local
   versions.

PR:		bin/134955
Obtained from:	NetBSD
MFC after:	1 month
2009-06-24 21:51:02 +00:00
Xin LI
4ca8a62bb3 Add support for uncompressing pack(1)'ed files. Pack(1) is a program found
in some commercial Unix systems, which utilizes Huffman minimum redundancy
code tree to compress files.  This implementation supports the "new" pack
format only, just like GNU gzip did.

Thanks for oliver@'s archive set which I can test against, and Mingyan Guo
for providing helpful review of my code.

PR:		bin/109567
MFC after:	1 month
2009-06-21 09:39:43 +00:00
Xin LI
80b807fef2 Two fixes for SMALL case when compiling with WARNS=6:
- Reduce scope where return value can be referenced.
 - Add a dummy access to timestamp to silence warning.

Submitted by:	Mingyan Guo <guomingyan gmail com>
2009-06-19 19:28:21 +00:00
Colin Percival
80d61a6a48 Mark functions as __dead2 in order to help the LLVM static checker
understand which code paths aren't possible.

Reported by:	edwin
2008-08-04 07:36:53 +00:00
Xin LI
bf15662677 Sync with NetBSD's license changes. 2008-07-23 00:03:36 +00:00
Xin LI
a9f1ad5de1 Reflect the fact that we actually have NetBSD revision 1.3. 2008-06-30 23:53:15 +00:00
Xin LI
fec65af1ca Remove clause 3 and 4 of NetBSD license.
Obtained from:	NetBSD
2008-06-30 23:23:31 +00:00
Xin LI
0889440a08 Make it clear that gzcat expects each argument to be separate files.
PR:		docs/123010
Submitted by:	Andrew Wright <andrewhw ieee org>
MFC after:	2 weeks
2008-06-30 17:45:47 +00:00
Robert Watson
3c23548899 Teach gunzip that .tbz and .tbz2 uncompress to .tar, in a manner similar to
its existing understanding that .tgz uncompresses to .tar.

MFC after:	3 days
PR:		121519
Submitted by:	Ighighi <ighighi at gmail.com>
2008-03-09 13:49:09 +00:00
Robert Watson
c7b65254c4 When gzipping to a target file, only set the source file flags on the
target file after the timestamp has been set; otherwise setting the
timestamp will fail if the flags don't permit it (i.e., uchg).

MFC after:	1 week
PR:		120208
Submitted by:	Ighighi <ighighi at gmail.com>
2008-03-09 11:16:42 +00:00
Yaroslav Tykhiy
cf99a6bebb Fix a few obvious errors in the znew(1) script.
PR:		bin/120249
Submitted by:	Jaakko Heinonen <see the PR for email>
2008-02-09 13:04:01 +00:00
Xin LI
78b8781ab1 - Simulate GNU gzip(1) behavior where full filename is
being output in verbose mode when doing recursive[1].
 - Use better representation of S:

PR:		bin/114470
Submitted by:	Ighighi <ighighi gmail com> [1]
Approved by:	re (hrs)
2007-07-12 01:17:14 +00:00
Xin LI
bca072af62 Mention 'k' option of gunzip.
Pointed out by:	ighighi gmail.com
2007-06-06 02:51:54 +00:00
Xin LI
2a8e7ac9c8 Add a '-k' flag which is similar with its bzip2(1) counterpart,
meaning that the user wants the input file to be left intact.

Feature request: Ighighi <ighighi gmail.com>
PR:		 bin/103006
MFC after:	 1 month
2007-05-28 08:20:46 +00:00
Xin LI
2bab61b0b4 Mention a limitation that was inherted from RFC1952, making
it impossible to obtain correct file size from a file that
is larger than 4GB before compression.

PR:		bin/110329
MFC after:	1 week
2007-03-16 03:50:53 +00:00
Simon L. B. Nielsen
fc8405c644 Do not install zgrep, or links to zgrep, since zgrep is provided by
src/gnu/usr.bin/grep.

Reviewed by:	delphij
2007-02-10 13:49:39 +00:00
Xin LI
161c3dc4b0 Fix typo.
Obtained from:	DragonFly
2007-01-31 07:13:25 +00:00
Xin LI
9a9ea25f4a Replace the GNU gzip with a slightly modified NetBSD gzip. The
NetBSD version is a feature-to-feature re-implementation of GNU
gzip using the freely-redistributable zlib and this version is
expected to be mostly bug-to-bug compatible with the GNU
implementation.

 - Because this is a piece of mature code and we want to make
   changes so it is added directly rather than importing to
   src/contrib.
 - Connect newly added code to src/usr.bin/ and rescue/rescue
   build.
 - Disconnect the GNU gzip code from build for now, they will
   be eventually removed completely.
 - Provide two new src.conf(5) knobs, WITHOUT_BZIP2_SUPPORT and
   WITHOUT_BZIP2.

Tested by:	kris (full exp-7 pointyhat build)
Approved by:	core (importing a 4-clause BSD licensed file)
Approved by:	re (adding new utility during -HEAD code slush)
2007-01-26 10:19:08 +00:00