source: scripts/untested/blfs-patches/ncompress_4.2.4-15.patch@ 16fbfc51

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 16fbfc51 was 16fbfc51, checked in by Jim Gifford <clfs@…>, 19 years ago

r575@server (orig r573): ryan | 2005-06-09 08:51:24 -0700
Add ncompress build script


gcc-3.4 fixes patch is from gentoo
ncompress_4.2.4-15 patch (add bounds checking to fix buffer overflow) from
debian



  • Property mode set to 100644
File size: 19.8 KB
RevLine 
[16fbfc51]1Submitted By: Ryan Oliver <ryan.oliver@pha.com.au>
2Date: 2005-06-08
3Initial Package Version: 4.2.4
4Upstream Status: Unknown
5Origin: Debian
6 http://ftp.debian.org/debian/pool/main/n/ncompress/ncompress_4.2.4-15.diff.gz
7Description: Add bounds checking to fix buffer overflow
8
9--- ncompress-4.2.4.orig/debian/README.debian
10+++ ncompress-4.2.4/debian/README.debian
11@@ -0,0 +1,138 @@
12+General Notes
13+-------------
14+
15+In this package, 'uncompress' is installed as 'uncompress.real' to avoid
16+conflict with the gzip package. Most of the utility scripts distributed with
17+the source code (zdiff, zmore, zcmp) are not installed.
18+
19+The uncompress.real program installed to /usr/bin is just a symlink to the
20+compress program. Same goes for the uncompress.real manpage in
21+/usr/share/man/man1.
22+
23+Please note that this version of ncompress does not support files larger than
24+2GB. I have toyed with increasing this limit, but I haven't been overly
25+successful. It looks to be possible to increase the limit up to 4GB, but
26+that's still an arbitrary limit, and given my level of understanding of this
27+code, I'm leery of doing it for no real gain. If you need support for very
28+large files, I suggest using gzip rather than compress.
29+
30+Also, note that prior to fixing bug #220820 (in November of 2003, version
31+4.2.4-13), there was a data-corruption bug with 'compress -b9'. If you created
32+files using -b9 (maxbits of 9) prior to this version, your file was probably
33+corrupted, and you will only be able to recover parts of it. I have "fixed"
34+this bug by disallowing maxbits less than 10. The uncompress.real program will
35+still decompress 9-bit files created by other compress programs (such as the
36+ones from Solaris or AIX) but the compress program will not create 9-bit files.
37+
38+This package was moved to main in August of 2004. Prior to that, it was kept
39+out of main because it implements the patented LZW algorithm. The consensus is
40+that patents on that algorithm have expired as of July 2004.
41+
42+
43+Upstream Source Code
44+--------------------
45+
46+Christoph apparently downloaded the original tarball from:
47+
48+ ftp://sunsite.unc.edu/pub/linux/utils/compress/ncompress-4.2.4.tar.Z
49+
50+In the meantime, however, sunsite.unc.edu has disappeared, and has been
51+replaced by ibiblio.org, so the current URL is:
52+
53+ ftp://ftp.ibiblio.org/pub/linux/utils/compress/ncompress-4.2.4.tar.Z
54+
55+This probably doesn't matter much at all, since there hasn't been a new
56+"upstream" release in more than 10 years. In any case, the contents of the
57+packgae orig.tar.gz file match exactly with the contents of the file currently
58+on ibiblio.org.
59+
60+
61+Copyright and Patent Discussion
62+-------------------------------
63+
64+The following article is from James A. Woods, one of the earlier authors of
65+compress. The article discusses the Unisys patent on the LZW compression
66+method, and how that affects ncompress.
67+
68+From uunet!zephyr.ens.tek.com!uw-beaver!mit-eddie!wuarchive!usc!ucsd!ucbvax!agate!riacs!jaw Wed Aug 1 15:06:59 EDT 1990
69+Article: 1282 of gnu.misc.discuss
70+Path: alembic!uunet!zephyr.ens.tek.com!uw-beaver!mit-eddie!wuarchive!usc!ucsd!ucbvax!agate!riacs!jaw
71+From: jaw@riacs.edu (James A. Woods)
72+Newsgroups: gnu.misc.discuss
73+Subject: Sperry patent #4,558,302 does *not* affect 'compress'
74+Keywords: data compression, algorithm, patent
75+Message-ID: <1990Jul31.220935.1424@riacs.edu>
76+Date: 31 Jul 90 22:09:35 GMT
77+Organization: RIACS, NASA Ames Research Center
78+Lines: 69
79+
80+# "The chief defect of Henry King
81+ Was chewing little bits of string."
82+
83+ -- Hilaire Belloc, Cautionary Tales [1907]
84+
85+ As a co-author of 'compress' who has had contact with an attorney for
86+Unisys (nee Sperry), I would like to relay a very basic admission from Unisys
87+that noncommercial use of 'compress' is perfectly legal. 'Compress' is also
88+commercially distributed by AT&T as part of Unix System 5 release 4,
89+with no further restrictions placed upon the use of the binary, as far
90+as I am aware.
91+
92+ From conversations with Professor Abraham Lempel and others, it
93+appears that neither AT&T, Sun Microsystems, Hewlett Packard, nor IBM
94+are paying any sort of license fees to Unisys in conjunction with patent
95+#4,558,302. It may be true that some organizations are paying fees for
96+data compression technology licensed from one or more of the many holders
97+of compression patents, but this is all independent from 'compress'.
98+
99+ In particular, I received a letter at NASA dated October 1, 1987 from
100+John B. Sowell of the Unisys law department, informing me for the first
101+time that some form of LZW was patented. I naturally expressed
102+skepticism that an algorithm could be patented (a murky legal area
103+which remains so), stated that 'compress' is not identical to LZW,
104+and in fact was designed, developed, and distributed before the ink
105+on the patent was dry. Several telephone conversations later, Mr. Sowell
106+intimated that they would *not* seek any fees from users of 'compress'
107+but instead were signing licensees for hardware implementations of LZW.
108+
109+ So, regardless of what you believe about a shady legal area, if anyone
110+from Unisys contacts you to extract tribute for the use of 'compress', please
111+tell them that, first, it is not theirs to begin with, and, second, there is
112+someone who will testify in court about the conversation above.
113+It is not even clear if anyone can "own" 'compress', since original developer
114+Spencer Thomas, myself, and others placed the code in the public domain
115+long before the adoption of the Berne copyright convention.
116+
117+ In light of the events above, it seems that the Free Software
118+Foundation is being unduly paranoid about the use of 'compress'.
119+Now I can well believe that FSF is more likely to be a legal target
120+than a behemoth like AT&T, but if they are simply redistributing
121+untouched free software developed years ago in the public sector,
122+I see no problem.
123+
124+ Aside: I am investigating, possibly for a case history to be
125+recycled to USENET, the particulars of data compression patents.
126+I am aware of the following patents: IBM's Miller-Wegman LZ variant,
127+those of Telcor and ACT [losing candidates for the British Telecom modem
128+standard], James A. Storer's work on limited lookahead as explicated in his
129+text "Data Compression (methods and theory)", Computer Science Press, 1988,
130+and the various patents pending associated with the Fiala and Greene
131+CACM article of April, 1989 on textual substitution methods.
132+If you have any lore, send it this way.
133+
134+
135+
136+ Sincerely,
137+
138+ James A. Woods
139+ NASA Ames Research Center (RIACS)
140+ jaw@riacs.edu (or ames!jaw)
141+
142+
143+P.S. The algorithm patent issue certainly is a "topic A" at the moment.
144+One useful reference is the review article by Anthony and Colwell --
145+"Litigating the Validity and Infringement of Software Patents" in
146+Washington and Lee Law Review, volume 41, fall 1984. I know Robert Colwell
147+personally. As a practicing patent attorney, he tells me that, at a minimum,
148+use of an invention "for research purposes" is legitimate.
149+
150--- ncompress-4.2.4.orig/debian/changelog
151+++ ncompress-4.2.4/debian/changelog
152@@ -0,0 +1,137 @@
153+ncompress (4.2.4-15) unstable; urgency=low
154+
155+ * Move to main now that LZW patent has expired (closes: #261282).
156+ * Update debian/copyright to be clearer about public domain status.
157+ * Move James A. Woods letter from copyright file to README.Debian.
158+ * Move detailed location information from copyright file to README.Debian.
159+
160+ -- Kenneth J. Pronovici <pronovic@debian.org> Wed, 25 Aug 2004 13:38:42 -0500
161+
162+ncompress (4.2.4-14) unstable; urgency=low
163+
164+ * Bumped standards version to 3.6.1 (no package changes).
165+ * Fix gcc-3.4 build problem (closes: #260723).
166+ - Add -DNOFUNCDEFS to gcc command, to prevent custom prototypes for
167+ standard functions from being used by the compiler.
168+
169+ -- Kenneth J. Pronovici <pronovic@debian.org> Wed, 21 Jul 2004 20:49:01 -0500
170+
171+ncompress (4.2.4-13) unstable; urgency=low
172+
173+ * Disallow maxbits less than 10, to avoid data corruption (closes: #220820).
174+ * Added note in debian/README.Debian about 9-bit corruption.
175+
176+ -- Kenneth J. Pronovici <pronovic@debian.org> Fri, 14 Nov 2003 15:47:08 -0600
177+
178+ncompress (4.2.4-12) unstable; urgency=low
179+
180+ * Upstream source changed (ibiblio.org replaced sunsite.unc.edu).
181+ - Updated debian/watch to use correct URL
182+ - Updated debian/copyright to note new download location
183+ - Updated debian/copyright to clarify packaging history
184+
185+ -- Kenneth J. Pronovici <pronovic@debian.org> Fri, 19 Sep 2003 10:40:56 -0500
186+
187+ncompress (4.2.4-11) unstable; urgency=low
188+
189+ * Changed debian/README.debian to document (lack of) large file support.
190+ * Changed section to 'optional' in debian/control to match overrides.
191+
192+ -- Kenneth J. Pronovici <pronovic@debian.org> Mon, 14 Apr 2003 15:34:36 -0500
193+
194+ncompress (4.2.4-10) unstable; urgency=low
195+
196+ * New maintainer (closes: #182937).
197+ * Updated debian/copyright to reflect new maintainer.
198+ * Removed local variables from debian/changelog.
199+ * Updated debian/control file.
200+ - Reflect new maintainer.
201+ - Change standards version to 3.5.9.
202+ - Update debhelper depends to (>= 4.0.2).
203+ - Rewrite and clarify short and long descriptions.
204+ - Fix spelling error in long description (closes: #125169).
205+ * Updated comments in debian/README.debian.
206+ * Brought debian/rules up to "modern" standards.
207+ * Updated debian/copyright to clarify download location.
208+ * Added debian/watch file.
209+ * Added debian/compat file at compatibility level 4.
210+ * Changed prototype of main() in compress42.c, to quiet gcc.
211+ * Updated compress.1 manpage (closes: #99585).
212+ - Reference 'uncompress.real' rather than 'uncompress'.
213+ - No longer reference zcat at all.
214+
215+ -- Kenneth J. Pronovici <pronovic@debian.org> Mon, 7 Apr 2003 17:52:47 -0500
216+
217+ncompress (4.2.4-9.1) unstable; urgency=low
218+
219+ * NMU based on patch by Stephen Stafford <bagpuss@debian.org>:
220+ - FHS transition (closes: #91011, #91596).
221+ - Added build-depends on debhelper.
222+ - Uncommented call to dh_installdeb so the debhelper postinst and prerm
223+ files get installed with the FHS transition symlink stuff.
224+ - Bumped standards to 3.5.0.
225+
226+ -- Colin Watson <cjwatson@debian.org> Wed, 25 Jul 2001 11:52:18 +0100
227+
228+ncompress (4.2.4-9) frozen unstable; urgency=low
229+
230+ * Upload for frozen.
231+
232+ -- Adam Klein <aklein@debian.org> Thu, 3 Dec 1998 19:57:56 -0800
233+
234+ncompress (4.2.4-8) unstable; urgency=low
235+
236+ * No longer segfaults on long file names. (closes: #26416)
237+ * Standards version 2.5.0.0 (no changes).
238+
239+ -- Adam Klein <aklein@debian.org> Wed, 2 Dec 1998 23:19:45 -0800
240+
241+ncompress (4.2.4-7) unstable; urgency=low
242+
243+ * Removed dh_du invocation from debian/rules
244+
245+ -- Adam Klein <aklein@debian.org> Wed, 11 Mar 1998 23:17:13 -0500
246+
247+ncompress (4.2.4-6) unstable; urgency=low
248+
249+ * Moved exit status info to DIAGNOSTICS section (closes: #16640)
250+
251+ -- Adam Klein <aklein@debian.org> Tue, 10 Feb 1998 21:27:56 -0800
252+
253+ncompress (4.2.4-5) unstable; urgency=low
254+
255+ * New maintainer
256+ * README.debian now mentions uncompress.real
257+ * Treat argv[0] value of "uncompress.real" as "uncompress" (closes: #16621)
258+ * Use debhelper (closes: #9674, #14503)
259+ * Control file now lists section as non-free/utils
260+ * Use standards version 2.4.0.0
261+
262+ -- Adam Klein <aklein@debian.org> Tue, 27 Jan 1998 09:28:38 -0800
263+
264+ncompress (4.2.4-4) unstable; urgency=low
265+
266+ * Rebuilt for hamm
267+
268+ -- Christoph Lameter <clameter@waterf.org> Mon, 29 Sep 1997 22:38:22 -0700
269+
270+ncompress (4.2.4-3) unstable; urgency=low
271+
272+ * new Maintainer
273+
274+ -- Helmut Geyer <Helmut.Geyer@iwr.uni-heidelberg.de> Fri, 6 Jun 1997 07:31:46 +0200
275+
276+ncompress (4.2.4-2) unstable; urgency=low
277+
278+ * install uncompress as uncompress.real since gzip maintainer did not
279+ want to use alternative and gzip already installs a link for uncompress
280+ to gzip.
281+
282+ -- Christoph Lameter <clameter@debian.org> Mon, 30 Dec 1996 16:24:03 -0800
283+
284+ncompress (4.2.4-1) unstable; urgency=low
285+
286+ * Initial Release.
287+
288+ -- Christoph Lameter <clameter@debian.org> Sun, 22 Dec 1996 10:14:17 -0800
289+
290--- ncompress-4.2.4.orig/debian/compat
291+++ ncompress-4.2.4/debian/compat
292@@ -0,0 +1 @@
293+4
294--- ncompress-4.2.4.orig/debian/control
295+++ ncompress-4.2.4/debian/control
296@@ -0,0 +1,22 @@
297+Source: ncompress
298+Section: utils
299+Priority: optional
300+Maintainer: Kenneth J. Pronovici <pronovic@debian.org>
301+Standards-Version: 3.6.1
302+Build-Depends: debhelper (>= 4.0.2)
303+
304+Package: ncompress
305+Architecture: any
306+Depends: ${shlibs:Depends}
307+Description: Original Lempel-Ziv compress/uncompress programs
308+ This package provides the original programs that are the de facto standard, in
309+ much of the UNIX community, for compressing and uncompressing files. The
310+ programs implement a fast, simple LZW file compression algorithm. The LZW
311+ algorithm does not have as high a rate of compression as some other
312+ algorithms, but LZW implementations such as this one often compress files
313+ faster than other, similar programs such as gzip.
314+ .
315+ For Debian, the standard uncompress program is installed as uncompress.real.
316+ .
317+ This package contains a copyright notice from one of the original authors in
318+ the file /usr/doc/ncompress/README.Debian.
319--- ncompress-4.2.4.orig/debian/copyright
320+++ ncompress-4.2.4/debian/copyright
321@@ -0,0 +1,15 @@
322+This package was originally debianized by Christoph Lameter on 22 Dec 1996.
323+Since then, it has been maintained by Helmut Geyer, Christoph Lameter and Adam
324+Klein, and is currently maintained by Kenneth J. Pronovici <pronovic@debian.org>.
325+
326+It may be downloaded from: ftp://ftp.ibiblio.org/pub/linux/utils/compress/ncompress-4.2.4.tar.Z
327+
328+Upstream Authors: Spencer W. Thomas & James A. Woods,
329+ Jim McKie, Steve Davies, Ken Turkowski,
330+ Joe Orost, Dave Mack, Peter Jannesen
331+
332+Copyright:
333+
334+ Placed in the public domain by Spencer W. Thomas and James A. Woods.
335+ See README.Debian for some more background information.
336+
337--- ncompress-4.2.4.orig/debian/dirs
338+++ ncompress-4.2.4/debian/dirs
339@@ -0,0 +1,2 @@
340+usr/bin
341+usr/share/man/man1
342--- ncompress-4.2.4.orig/debian/rules
343+++ ncompress-4.2.4/debian/rules
344@@ -0,0 +1,45 @@
345+#!/usr/bin/make -f
346+
347+binary: binary-arch
348+
349+binary-arch: build install
350+ dh_testdir
351+ dh_testroot
352+ dh_installdocs Acknowleds README
353+ dh_installchangelogs Changes
354+ dh_strip
355+ dh_fixperms
356+ dh_compress
357+ dh_installdeb
358+ dh_shlibdeps
359+ dh_gencontrol
360+ dh_md5sums
361+ dh_builddeb
362+
363+binary-indep:
364+
365+install: build
366+ dh_testdir
367+ dh_testroot
368+ dh_installdirs
369+ install -o root -g root compress debian/ncompress/usr/bin
370+ ln -s compress debian/ncompress/usr/bin/uncompress.real
371+ install -o root -g root -m 644 compress.1 debian/ncompress/usr/share/man/man1
372+ ln -s compress.1 debian/ncompress/usr/share/man/man1/uncompress.real.1
373+
374+build: build-stamp
375+build-stamp:
376+ dh_testdir
377+ gcc -O2 -g -o compress -DNOFUNCDEF -DCOMPILE_DATE="\"`date`\"" compress42.c
378+ touch build-stamp
379+
380+configure:
381+
382+clean:
383+ dh_testdir
384+ dh_testroot
385+ rm -f build-stamp
386+ rm -f compress
387+ dh_clean
388+
389+.PHONY: binary binary-arch binary-indep install build configure clean
390--- ncompress-4.2.4.orig/debian/watch
391+++ ncompress-4.2.4/debian/watch
392@@ -0,0 +1,2 @@
393+version=2
394+ftp://ftp.ibiblio.org/pub/linux/utils/compress/ncompress-(.*)\.tar.Z debian uupdate
395--- ncompress-4.2.4.orig/compress.1
396+++ ncompress-4.2.4/compress.1
397@@ -1,7 +1,7 @@
398 .PU
399 .TH COMPRESS 1 local
400 .SH NAME
401-compress, uncompress, zcat \- compress and expand data (version 4.1)
402+compress, uncompress.real \- compress and expand data (version 4.2)
403 .SH SYNOPSIS
404 .ll +8
405 .B compress
406@@ -23,7 +23,7 @@
407 ]
408 .ll -8
409 .br
410-.B uncompress
411+.B uncompress.real
412 [
413 .B \-f
414 ] [
415@@ -36,13 +36,15 @@
416 .I "name \&..."
417 ]
418 .br
419-.B zcat
420-[
421-.B \-V
422-] [
423-.I "name \&..."
424-]
425 .SH DESCRIPTION
426+.PP
427+Note that the program that would normally be installed as
428+.I uncompress
429+is installed for Debian as
430+.I uncompress.real.
431+This has been done to avoid conflicting with the more-commonly-used
432+program with the same name that is part of the gzip package.
433+.PP
434 .I Compress
435 reduces the size of the named files using adaptive Lempel-Ziv coding.
436 Whenever possible,
437@@ -68,11 +70,9 @@
438 the user is prompted as to whether an existing file should be overwritten.
439 .PP
440 Compressed files can be restored to their original form using
441-.I uncompress
442-or
443-.I zcat.
444+.I uncompress.real.
445 .PP
446-.I uncompress
447+.I uncompress.real
448 takes a list of files on its command line and replaces each
449 file whose name ends with
450 .B "\&.Z"
451@@ -85,22 +85,9 @@
452 The
453 .B \-c
454 option makes
455-.I compress/uncompress
456+.I compress/uncompress.real
457 write to the standard output; no files are changed.
458 .PP
459-.I zcat
460-is identical to
461-.I uncompress
462-.B \-c.
463-.I zcat
464-uncompresses either a list of files on the command line or its
465-standard input and writes the uncompressed data on standard output.
466-.I zcat
467-will uncompress files that have the correct magic number whether
468-they have a
469-.B "\&.Z"
470-suffix or not.
471-.PP
472 If the
473 .B \-r
474 flag is specified,
475@@ -148,7 +135,7 @@
476 Note that the
477 .B \-b
478 flag is omitted for
479-.I uncompress,
480+.I uncompress.real,
481 since the
482 .I bits
483 parameter specified during compression
484@@ -175,13 +162,13 @@
485 option,
486 a message is printed yielding the percentage of
487 reduction for each file compressed.
488-.PP
489-Exit status is normally 0;
490-if the last file is larger after (attempted) compression, the status is 2;
491-if an error occurs, exit status is 1.
492 .SH "SEE ALSO"
493 pack(1), compact(1)
494 .SH "DIAGNOSTICS"
495+Exit status is normally 0;
496+if the last file is larger after (attempted) compression, the status is 2;
497+if an error occurs, exit status is 1.
498+.PP
499 Usage: compress [\-dfvcVr] [\-b maxbits] [file ...]
500 .in +8
501 Invalid options were specified on the command line.
502@@ -195,7 +182,7 @@
503 not in compressed format
504 .in +8
505 The file specified to
506-.I uncompress
507+.I uncompress.real
508 has not been compressed.
509 .in -8
510 .IR file :
511@@ -272,13 +259,14 @@
512 a small process data space (64KB or less, as exhibited by the DEC PDP
513 series, the Intel 80286, etc.)
514 .PP
515-Invoking compress with a \-r
516+Invoking compress with a
517+.BR \-r
518 flag will occasionally cause it to produce spurious error warnings of the form
519 .PP
520 .in 8
521 "<filename>.Z already has .Z suffix - ignored"
522 .in -8
523 .PP
524-These warnings can be ignored. See the comments in compress.c:compdir()
525-for an explanation.
526+These warnings can be ignored. See the comments in compress42.c:compdir()
527+in the source distribution for an explanation.
528
529--- ncompress-4.2.4.orig/compress42.c
530+++ ncompress-4.2.4/compress42.c
531@@ -230,6 +230,8 @@
532
533 #define INIT_BITS 9 /* initial number of bits/code */
534
535+#define MIN_MAXBITS 10 /* min value for -b maxbits (smaller causes corruption) */
536+
537 #ifndef SACREDMEM
538 /*
539 * SACREDMEM is the amount of physical memory saved for others; compress
540@@ -638,7 +640,7 @@
541 } ;
542 #endif
543
544-void main ARGS((int,char **));
545+int main ARGS((int,char **));
546 void Usage ARGS((void));
547 void comprexx ARGS((char **));
548 void compdir ARGS((char *));
549@@ -691,7 +693,7 @@
550 * deterministic, and can be done on the fly. Thus, the decompression
551 * procedure needs no input table, but tracks the way the table was built.
552 */
553-void
554+int
555 main(argc, argv)
556 REG1 int argc;
557 REG2 char *argv[];
558@@ -719,7 +721,8 @@
559 else
560 progname = argv[0];
561
562- if (strcmp(progname, "uncompress") == 0)
563+ if (strcmp(progname, "uncompress") == 0
564+ || strcmp(progname, "uncompress.real") == 0)
565 do_decomp = 1;
566 else
567 if (strcmp(progname, "zcat") == 0)
568@@ -819,7 +822,7 @@
569 nextarg: continue;
570 }
571
572- if (maxbits < INIT_BITS) maxbits = INIT_BITS;
573+ if (maxbits < MIN_MAXBITS) maxbits = MIN_MAXBITS;
574 if (maxbits > BITS) maxbits = BITS;
575
576 if (*filelist != NULL)
577@@ -883,6 +886,10 @@
578 int fdout;
579 char tempname[MAXPATHLEN];
580
581+ if (strlen(*fileptr) > (MAXPATHLEN - 1)) {
582+ fprintf(stderr, "Pathname too long: %s\n", *fileptr);
583+ return;
584+ }
585 strcpy(tempname,*fileptr);
586 errno = 0;
587
Note: See TracBrowser for help on using the repository browser.