Hello community, here is the log from the commit of package ncompress for openSUSE:Factory checked in at 2019-12-11 12:02:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ncompress (Old) and /work/SRC/openSUSE:Factory/.ncompress.new.4691 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ncompress" Wed Dec 11 12:02:38 2019 rev:6 rq:754459 version:4.2.4.5 Changes: -------- --- /work/SRC/openSUSE:Factory/ncompress/ncompress.changes 2019-03-01 20:29:15.602013673 +0100 +++ /work/SRC/openSUSE:Factory/.ncompress.new.4691/ncompress.changes 2019-12-11 12:03:07.704790748 +0100 @@ -1,0 +2,27 @@ +Thu Dec 5 15:33:20 UTC 2019 - Martin Pluskal <[email protected]> + +- Update to version 4.2.4.5: + * New homepage https://github.com/vapier/ncompress + * Switch to intmax_t for nlink_t fields when printing + * Make builds more reproducible by dropping datestamps + * Fix integer overflow in maxmaxcode computation by Jakub Wilk + * Don't leak file descriptor in error cases by Pavel Raiskup + * Drop 8.3 filename checks for old DOS/Windows + * Change signal ifdef logic to the signal names + * Fix -Werror=parentheses errors with newer compilers + * Define LSTAT=1 in modern builds by default + * Change pathnames to be dynamic to avoid hardcoded 1k limit + * Add a standard -h (help) option + * Change version output to go to stdout + * Start a testsuite! + * Add support for -- to halt option parsing + * Add a uncompress(1) link to compress(1) +- Drop all upstreamed patches: + * ncompress-2GB.patch + * ncompress-4.2.4.4-drop-datestamp.patch + * ncompress-4.2.4.4-filenamelen.patch + * ncompress-4.2.4.4-lfs2.patch + * ncompress-4.2.4-endians.patch + * ncompress-4.2.4-make.patch + +------------------------------------------------------------------- Old: ---- ncompress-2GB.patch ncompress-4.2.4-endians.patch ncompress-4.2.4-make.patch ncompress-4.2.4.4-drop-datestamp.patch ncompress-4.2.4.4-filenamelen.patch ncompress-4.2.4.4-lfs2.patch ncompress-4.2.4.4.tar.gz New: ---- ncompress-4.2.4.5.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ncompress.spec ++++++ --- /var/tmp/diff_new_pack.UIbjQK/_old 2019-12-11 12:03:08.136790566 +0100 +++ /var/tmp/diff_new_pack.UIbjQK/_new 2019-12-11 12:03:08.140790564 +0100 @@ -1,7 +1,7 @@ # # spec file for package ncompress # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,20 +17,13 @@ Name: ncompress -Version: 4.2.4.4 +Version: 4.2.4.5 Release: 0 Summary: LZW compression and decompression utilities License: SUSE-Public-Domain Group: Productivity/Archiving/Compression -URL: http://ncompress.sourceforge.net/ +URL: https://github.com/vapier/ncompress Source: https://github.com/vapier/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz -Patch0: %{name}-4.2.4-make.patch -Patch1: %{name}-4.2.4.4-lfs2.patch -Patch2: %{name}-4.2.4.4-filenamelen.patch -Patch3: %{name}-2GB.patch -Patch6: %{name}-4.2.4-endians.patch -# PATCH-FIX-UPSTREAM -- drop date to fix build-compare (boo#1047218) -Patch7: ncompress-4.2.4.4-drop-datestamp.patch # gzip provides the uncompress tool in /usr/bin # we don't provide a link here as this conflicts with gzip Requires: gzip @@ -46,32 +39,24 @@ .gz files at all. %prep -%setup -q -%patch0 -p1 -%patch1 -p1 -b .lfs -%patch2 -p1 -b .filenamelen -%patch3 -p1 -b .2GB -%patch6 -p1 -b .endians -%patch7 -p1 +%autosetup %build -export CFLAGS="%{optflags} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" -%ifarch sparc m68k armv4l ppc s390 s390x ppc64 sparc64 -export ENDIAN=1234 -%else -export ENDIAN=4321 -%endif -make %{?_smp_mflags} Makefile # avoid build time race -make %{?_smp_mflags} ENDIAN="$ENDIAN" +export CFLAGS="%{optflags}" +%make_build %install -install -D -p -m 0755 compress \ +install -Dpm 0755 compress \ %{buildroot}%{_bindir}/compress -install -D -p -m 0644 compress.1 \ +install -Dpm 0644 compress.1 \ %{buildroot}%{_mandir}/man1/compress.1 +%check +make %{?_smp_mflags} check + %files -%doc LZW.INFO README +%license UNLICENSE +%doc LZW.INFO README.md %{_bindir}/compress %{_mandir}/man1/compress.1%{?ext_man} ++++++ ncompress-4.2.4.4.tar.gz -> ncompress-4.2.4.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncompress-4.2.4.4/.travis.yml new/ncompress-4.2.4.5/.travis.yml --- old/ncompress-4.2.4.4/.travis.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/ncompress-4.2.4.5/.travis.yml 2019-01-04 11:42:45.000000000 +0100 @@ -0,0 +1,15 @@ +# Travis build integration. +# https://docs.travis-ci.com/ + +language: c +compiler: + - clang + - gcc + +sudo: false + +os: + - linux + - osx + +script: ./travis/main.sh diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncompress-4.2.4.4/Changes new/ncompress-4.2.4.5/Changes --- old/ncompress-4.2.4.4/Changes 2010-09-10 05:40:22.000000000 +0200 +++ new/ncompress-4.2.4.5/Changes 2019-01-04 11:42:45.000000000 +0100 @@ -1,3 +1,20 @@ +(N)compress version 4.2.4.5 + o New homepage https://github.com/vapier/ncompress + o Switch to intmax_t for nlink_t fields when printing + o Make builds more reproducible by dropping datestamps + o Fix integer overflow in maxmaxcode computation by Jakub Wilk + o Don't leak file descriptor in error cases by Pavel Raiskup + o Drop 8.3 filename checks for old DOS/Windows + o Change signal ifdef logic to the signal names + o Fix -Werror=parentheses errors with newer compilers + o Define LSTAT=1 in modern builds by default + o Change pathnames to be dynamic to avoid hardcoded 1k limit + o Add a standard -h (help) option + o Change version output to go to stdout + o Start a testsuite! + o Add support for -- to halt option parsing + o Add a uncompress(1) link to compress(1) + (N)compress version 4.2.4.4 o Add some spelling fixes from Kenneth J. Pronovici o Tweak makefile syntax for make 3.82 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncompress-4.2.4.4/GNUmakefile new/ncompress-4.2.4.5/GNUmakefile --- old/ncompress-4.2.4.4/GNUmakefile 2010-09-10 05:40:22.000000000 +0200 +++ new/ncompress-4.2.4.5/GNUmakefile 2019-01-04 11:42:45.000000000 +0100 @@ -7,15 +7,18 @@ distclean: cleanup rm -f Makefile -Makefile: Makefile.def +Makefile: Makefile.def GNUmakefile sed \ - -e 's:options= :options= $$(CFLAGS) -DNOFUNCDEF -DUTIME_H $$(LDFLAGS) :' \ + -e 's:options= :options= $$(CFLAGS) -DNOFUNCDEF -DUTIME_H -DLSTAT $$(LDFLAGS) :' \ Makefile.def > Makefile +check: + ./tests/runtests.sh + PN = ncompress PV = $(shell awk '{print $$NF; exit}' Changes) P = $(PN)-$(PV) dist: git archive --prefix=$(P)/ HEAD | gzip -9 > $(P).tar.gz -.PHONY: clean cleanup compress dist distclean install +.PHONY: check clean cleanup compress dist distclean install diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncompress-4.2.4.4/LICENSE.txt new/ncompress-4.2.4.5/LICENSE.txt --- old/ncompress-4.2.4.4/LICENSE.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/ncompress-4.2.4.5/LICENSE.txt 2019-01-04 11:42:45.000000000 +0100 @@ -0,0 +1,3 @@ +The ncompress code is released into the public domain. + +See the UNLICENSE file for more details. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncompress-4.2.4.4/Makefile.def new/ncompress-4.2.4.5/Makefile.def --- old/ncompress-4.2.4.4/Makefile.def 2010-09-10 05:40:22.000000000 +0200 +++ new/ncompress-4.2.4.5/Makefile.def 2019-01-04 11:42:45.000000000 +0100 @@ -38,7 +38,7 @@ compress: Makefile compress42.c patchlevel.h - $(CC) -o compress $(options) "-DCOMPILE_DATE=\"`date`\"" compress42.c $(LBOPT) + $(CC) -o compress $(options) compress42.c $(LBOPT) install: compress [ -f $(DESTDIR)$(BINDIR)/compress ] && \ @@ -54,8 +54,8 @@ ln -f $(DESTDIR)$(BINDIR)/compress $(DESTDIR)$(BINDIR)/zcat cp zcmp zdiff zmore $(DESTDIR)$(BINDIR)/. chmod 0755 $(DESTDIR)$(BINDIR)/compress $(DESTDIR)$(BINDIR)/zcmp $(DESTDIR)$(BINDIR)/zdiff $(DESTDIR)$(BINDIR)/zmore - cp compress.1 zcmp.1 zmore.1 $(DESTDIR)$(MANDIR)/. - chmod 0644 $(DESTDIR)$(MANDIR)/compress.1 $(DESTDIR)$(MANDIR)/zcmp.1 $(DESTDIR)$(MANDIR)/zmore.1 + cp compress.1 uncompress.1 zcmp.1 zmore.1 $(DESTDIR)$(MANDIR)/. + chmod 0644 $(DESTDIR)$(MANDIR)/compress.1 $(DESTDIR)$(MANDIR)/uncompress.1 $(DESTDIR)$(MANDIR)/zcmp.1 $(DESTDIR)$(MANDIR)/zmore.1 cleanup: rm -f compress compress.def comp.log diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncompress-4.2.4.4/README new/ncompress-4.2.4.5/README --- old/ncompress-4.2.4.4/README 2010-09-10 05:40:22.000000000 +0200 +++ new/ncompress-4.2.4.5/README 1970-01-01 01:00:00.000000000 +0100 @@ -1,91 +0,0 @@ -This is version 4.2 of (N)compress (an improved version of compress 4.1). - -Compress is a fast, simple LZW file compressor. Compress does not have -the highest compression rate, but it is one of the fastest programs to -compress data. Compress is the defacto standard in the UNIX community -for compressing files. - -'build' is a menu driven shell script for compiling, testing and -installing (N)compress. So to build and install (N)compress all you have to -do is run build. Build will first test your system for default -settings. The current compile settings are stored in a special file -called compress.def. - -For user with problems with build there is a default makefile included -called 'Makefile.def'. Also build is capable te generate a Makefile with -all options (option genmake). - -(N)compress 4.2 has a special, fast compression hash algorithm. This -algorithm uses more memory than the old hash table. If you don't want -the faster hash table algorithm set 'Memory free for compress' below -800000. - -zcmp, zdiff, zmore were copied from version 4.1 without any changes. - -The output of (N)compress 4.2 is fully compatible with that of compress 3.0. -In other words, the output of (N)compress 4.2 may be fed into uncompress 3.0 or -the output of compress 3.0 may be fed into uncompress 4.2. - -The output of (N)compress 4.2 is not compatible with that of -compress 2.0. However, compress 4.2 still accepts the output of -compress 2.0. To generate output that is compatible with compress -2.0, use the undocumented "-C" flag. - -Send comments, complaints and especially patches relating to - [email protected] - - -REMARKS - -- Build is a bourne shell script. On some system it is nessesary to type - 'sh build'. - -- The build script usages tput for nice screen handling of the script. - If your system has no tput no problems. - -- For configuration testing build uses a lot of small C programs. During - those test stderr is redirected to /dev/null. - During the compilation of compress output is NOT redirected. - -- The /bin/sh under Ultrix can't handle ${var:-str} so use ksh for the - build script. - -- If there are any problems with the libary functions definitions in - compress42.c define NOFUNCDEF (-DNOFUNCDEF=1) to disable the definitions. - IBM AIX (RS/6000) uses a different definitions of open(), define -D_IBMRT=1 - to disable the open() definition. - -- The output if (N)compress 4.2 is not exactly the same as compress 4.0 - because of differente table reset point. The output of (N)compress 4.2 - is 100% compatible with compress 4.0 - -- Some systems has performance problems with reads bigger than BUFSIZ - (The read a head function is not working as expected). For those - system use the default BSIZE input buffer size. - -- (N)compress can by slower on small files (<10Kb) because of a greate - table reset overhead. Use cpio or tar to make 1 bigger file if - posible, it is faster and also gives a beter compression ratio most - of the time. - -- (N)compress is slower in vax systems because of removing some - undocumented inline asembler. - -- files compressed on a large machine with more bits than allowed by - a version of compress on a smaller machine cannot be decompressed! Use the - "-b12" flag to generate a file on a large machine that can be uncompressed - on a 16-bit machine. - -- compatibility with compress 3.0 has not been tested in the 4.2 release of - (N)compress. - -- There has been 1 problem report in relation to GCC 2.0 on a sparc - workstation. GCC 2.0 seems to generate a bad compress. Use the - standard c compiler 'cc'. - -=============================================================================== -Peter Jannesen -Network Communication Systems (N.C.S), The Netherlands -Phone: +31104130093 Fax: +31104146452 -Address: Westbaak 96a Email: [email protected] - 3012 KM Rotterdam, The Netherlands diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncompress-4.2.4.4/README.md new/ncompress-4.2.4.5/README.md --- old/ncompress-4.2.4.4/README.md 1970-01-01 01:00:00.000000000 +0100 +++ new/ncompress-4.2.4.5/README.md 2019-01-04 11:42:45.000000000 +0100 @@ -0,0 +1,105 @@ +# About + +This is version 4.2 of (N)compress (an improved version of compress 4.1). + +Compress is a fast, simple LZW file compressor. Compress does not have +the highest compression rate, but it is one of the fastest programs to +compress data. Compress is the defacto standard in the UNIX community +for compressing files. + +(N)compress 4.2 has a special, fast compression hash algorithm. This +algorithm uses more memory than the old hash table. If you don't want +the faster hash table algorithm set 'Memory free for compress' below +800000. + +zcmp, zdiff, zmore were copied from version 4.1 without any changes. + +The output of (N)compress 4.2 is fully compatible with that of compress 3.0. +In other words, the output of (N)compress 4.2 may be fed into uncompress 3.0 or +the output of compress 3.0 may be fed into uncompress 4.2. + +The output of (N)compress 4.2 is not compatible with that of +compress 2.0. However, compress 4.2 still accepts the output of +compress 2.0. To generate output that is compatible with compress +2.0, use the undocumented "-C" flag. + +# Building + +For recent systems with GNU make, you can simply run `make` as the default +'GNUMakefile' will get picked up. + +'build' is a menu driven shell script for compiling, testing and +installing (N)compress. So to build and install (N)compress all you have to +do is run build. Build will first test your system for default +settings. The current compile settings are stored in a special file +called compress.def. + +For user with problems with build there is a default makefile included +called 'Makefile.def'. Also build is capable of generating a Makefile with +all options (option genmake). + +# Support + +[](https://travis-ci.org/vapier/ncompress) + +Send comments, complaints and especially patches relating to + https://github.com/vapier/ncompress/issues + +# Licensing + +The ncompress code is released into the public domain. See the +[UNLICENSE](UNLICENSE) file for more details. + +# Patents + +All existing patents on the LZW algorithm have +[expired world-wide](http://en.wikipedia.org/wiki/LZW#Patent_issues). +So LZW is now patent free. + +# Remarks + +- Build is a bourne shell script. On some system it is necessary to type + 'sh build'. + +- The build script usages tput for nice screen handling of the script. + If your system has no tput no problems. + +- For configuration testing build uses a lot of small C programs. During + those test stderr is redirected to /dev/null. + During the compilation of compress output is NOT redirected. + +- The /bin/sh under Ultrix can't handle ${var:-str} so use ksh for the + build script. + +- If there are any problems with the library function definitions in + compress42.c define NOFUNCDEF (-DNOFUNCDEF=1) to disable the definitions. + IBM AIX (RS/6000) uses a different definitions of open(), define -D_IBMRT=1 + to disable the open() definition. + +- The output if (N)compress 4.2 is not exactly the same as compress 4.0 + because of different table reset point. The output of (N)compress 4.2 + is 100% compatible with compress 4.0 + +- Some systems has performance problems with reads bigger than BUFSIZ + (The read a head function is not working as expected). For those + system use the default BSIZE input buffer size. + +- (N)compress can by slower on small files (<10Kb) because of a great + table reset overhead. Use cpio or tar to make 1 bigger file if + possible, it is faster and also gives a better compression ratio most + of the time. + +- (N)compress is slower in vax systems because of removing some + undocumented inline assembler. + +- files compressed on a large machine with more bits than allowed by + a version of compress on a smaller machine cannot be decompressed! Use the + "-b12" flag to generate a file on a large machine that can be uncompressed + on a 16-bit machine. + +- compatibility with compress 3.0 has not been tested in the 4.2 release of + (N)compress. + +- There has been 1 problem report in relation to GCC 2.0 on a sparc + workstation. GCC 2.0 seems to generate a bad compress. Use the + standard c compiler 'cc'. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncompress-4.2.4.4/UNLICENSE new/ncompress-4.2.4.5/UNLICENSE --- old/ncompress-4.2.4.4/UNLICENSE 1970-01-01 01:00:00.000000000 +0100 +++ new/ncompress-4.2.4.5/UNLICENSE 2019-01-04 11:42:45.000000000 +0100 @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to <http://unlicense.org/> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncompress-4.2.4.4/build new/ncompress-4.2.4.5/build --- old/ncompress-4.2.4.4/build 2010-09-10 05:40:22.000000000 +0200 +++ new/ncompress-4.2.4.5/build 2019-01-04 11:42:45.000000000 +0100 @@ -566,9 +566,9 @@ echo "" echo "Compiling compress ${version}" - echo ${CC} ${options} "-DCOMPILE_DATE=\"`date`\"" compress42.c ${LBOPT} + echo ${CC} ${options} compress42.c ${LBOPT} - if ${CC} ${options} "-DCOMPILE_DATE=\"`date`\"" compress42.c ${LBOPT} + if ${CC} ${options} compress42.c ${LBOPT} then echo "" ./compress -V @@ -599,9 +599,9 @@ echo "" echo "Compiling compress ${version}" - echo ${CC} ${options} "-DCOMPILE_DATE=\"`date`\"" compress42.c + echo ${CC} ${options} compress42.c - ${CC} ${options} "-DCOMPILE_DATE=\"`date`\"" compress42.c + ${CC} ${options} compress42.c echo "" echo ${n} "Press return to continue${c}" read dummy @@ -790,7 +790,7 @@ compress: Makefile compress42.c patchlevel.h - $(CC) -o compress $(options) "-DCOMPILE_DATE=\"\`date\`\"" compress42.c $(LBOPT) + $(CC) -o compress $(options) compress42.c $(LBOPT) install: compress [ -f \$(BINDIR)/compress ] && \\ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncompress-4.2.4.4/compress.1 new/ncompress-4.2.4.5/compress.1 --- old/ncompress-4.2.4.4/compress.1 2010-09-10 05:40:22.000000000 +0200 +++ new/ncompress-4.2.4.5/compress.1 2019-01-04 11:42:45.000000000 +0100 @@ -18,6 +18,8 @@ .B \-b .I bits ] [ +.B \-\- +] [ .I "name \&..." ] .ll -8 @@ -32,6 +34,8 @@ ] [ .B \-V ] [ +.B \-\- +] [ .I "name \&..." ] .br @@ -39,6 +43,8 @@ [ .B \-V ] [ +.B \-\- +] [ .I "name \&..." ] .SH DESCRIPTION @@ -174,6 +180,10 @@ option, a message is printed yielding the percentage of reduction for each file compressed. +.PP +.B \-\- +may be used to halt option parsing and force all remaining arguments to be +treated as paths. .SH "DIAGNOSTICS" Exit status is normally 0; if the last file is larger after (attempted) compression, the status is 2; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncompress-4.2.4.4/compress42.c new/ncompress-4.2.4.5/compress42.c --- old/ncompress-4.2.4.4/compress42.c 2010-09-10 05:40:22.000000000 +0200 +++ new/ncompress-4.2.4.5/compress42.c 2019-01-04 11:42:45.000000000 +0100 @@ -130,6 +130,7 @@ * Add variable bit length output. * */ +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -213,7 +214,6 @@ # define OBUFSIZ BUFSIZ /* Default output buffer size */ #endif -#define MAXPATHLEN 1024 /* MAXPATHLEN - maximum length of a pathname we allow */ #define SIZE_INNER_LOOP 256 /* Size of the inter (fast) compress loop */ /* Defines for third byte of header */ @@ -285,7 +285,6 @@ # define BYTEORDER 4321 # undef NOALLIGN # define NOALLIGN 1 -# define COMPILE_DATE __DATE__ #endif /* DOS */ #ifndef O_BINARY @@ -535,7 +534,7 @@ struct stat infstat; /* Input file status */ char *ifname; /* Input filename */ int remove_ofname = 0; /* Remove output file on a error */ -char ofname[MAXPATHLEN]; /* Output filename */ +char *ofname = NULL; /* Output filename */ int fgnd_flag = 0; /* Running in background (SIGINT=SIGIGN) */ long bytes_in; /* Total number of byte from input */ @@ -642,8 +641,8 @@ #endif int main ARGS((int,char **)); -void Usage ARGS((void)); -void comprexx ARGS((char **)); +void Usage ARGS((int)); +void comprexx ARGS((const char *)); void compdir ARGS((char *)); void compress ARGS((int,int)); void decompress ARGS((int,int)); @@ -700,12 +699,17 @@ { REG3 char **filelist; REG4 char **fileptr; + int seen_double_dash = 0; - if (fgnd_flag = (signal(SIGINT, SIG_IGN) != SIG_IGN)) +#ifdef SIGINT + if ((fgnd_flag = (signal(SIGINT, SIG_IGN)) != SIG_IGN)) signal(SIGINT, (SIG_TYPE)abort_compress); +#endif +#ifdef SIGTERM signal(SIGTERM, (SIG_TYPE)abort_compress); -#ifndef DOS +#endif +#ifdef SIGHUP signal(SIGHUP, (SIG_TYPE)abort_compress); #endif @@ -749,7 +753,13 @@ for (argc--, argv++; argc > 0; argc--, argv++) { - if (**argv == '-') + if (strcmp(*argv, "--") == 0) + { + seen_double_dash = 1; + continue; + } + + if (seen_double_dash == 0 && **argv == '-') {/* A flag argument */ while (*++(*argv)) {/* Process all flags in this arg */ @@ -790,7 +800,7 @@ if (!ARGVAL()) { fprintf(stderr, "Missing maxbits\n"); - Usage(); + Usage(1); } maxbits = atoi(*argv); @@ -812,9 +822,13 @@ #endif break; + case 'h': + Usage(0); + break; + default: fprintf(stderr, "Unknown flag: '%c'; ", **argv); - Usage(); + Usage(1); } } } @@ -833,7 +847,7 @@ if (*filelist != NULL) { for (fileptr = filelist; *fileptr; fileptr++) - comprexx(fileptr); + comprexx(*fileptr); } else {/* Standard input */ @@ -863,41 +877,47 @@ } void -Usage() +Usage(int status) { - fprintf(stderr, "\ -Usage: %s [-dfvcVr] [-b maxbits] [file ...]\n\ + fprintf(status ? stderr : stdout, "\ +Usage: %s [-dfhvcVr] [-b maxbits] [--] [file ...]\n\ -d If given, decompression is done instead.\n\ -c Write output on stdout, don't remove original.\n\ -b Parameter limits the max number of bits/code.\n", progname); - fprintf(stderr, "\ + fprintf(status ? stderr : stdout, "\ -f Forces output file to be generated, even if one already.\n\ exists, and even if no space is saved by compressing.\n\ If -f is not used, the user will be prompted if stdin is.\n\ a tty, otherwise, the output file will not be overwritten.\n\ + -h This help output.\n\ -v Write compression statistics.\n\ - -V Output vesion and compile options.\n\ + -V Output version and compile options.\n\ -r Recursive. If a filename is a directory, descend\n\ into it and compress everything in it.\n"); - exit(1); + exit(status); } void comprexx(fileptr) - char **fileptr; + const char *fileptr; { - int fdin; - int fdout; - char tempname[MAXPATHLEN]; - - if (strlen(*fileptr) > sizeof(tempname) - 3) { - fprintf(stderr, "Pathname too long: %s\n", *fileptr); - exit_code = 1; - return; + int fdin = -1; + int fdout = -1; + int has_z_suffix; + char *tempname; + unsigned long namesize = strlen(fileptr); + + /* Create a temp buffer to add/remove the .Z suffix. */ + tempname = malloc(namesize + 3); + if (tempname == NULL) + { + perror("malloc"); + goto error; } - strcpy(tempname,*fileptr); + strcpy(tempname,fileptr); + has_z_suffix = (namesize >= 2 && strcmp(&tempname[namesize - 2], ".Z") == 0); errno = 0; #ifdef LSTAT @@ -916,9 +936,11 @@ ** This is obviously the wrong thing to do if it's a ** directory, but it shouldn't do any harm. */ - if (strcmp(tempname + strlen(tempname) - 2, ".Z") != 0) + if (!has_z_suffix) { - strcat(tempname,".Z"); + memcpy(&tempname[namesize], ".Z", 3); + namesize += 2; + has_z_suffix = 1; errno = 0; #ifdef LSTAT if (lstat(tempname,&infstat) == -1) @@ -927,37 +949,32 @@ #endif { perror(tempname); - exit_code = 1; - return; + goto error; } if ((infstat.st_mode & S_IFMT) != S_IFREG) { fprintf(stderr, "%s: Not a regular file.\n", tempname); - exit_code = 1; - return ; + goto error; } } else { perror(tempname); - exit_code = 1; - return; + goto error; } break; default: perror(tempname); - exit_code = 1; - return; + goto error; } } else { perror(tempname); - exit_code = 1; - return; + goto error; } } @@ -978,87 +995,66 @@ {/* DECOMPRESSION */ if (!zcat_flg) { - if (strcmp(tempname + strlen(tempname) - 2, ".Z") != 0) + if (!has_z_suffix) { if (!quiet) fprintf(stderr,"%s - no .Z suffix\n",tempname); - return; + goto error; } } - strcpy(ofname, tempname); + free(ofname); + ofname = strdup(tempname); + if (ofname == NULL) + { + perror("strdup"); + goto error; + } /* Strip of .Z suffix */ - - if (strcmp(tempname + strlen(tempname) - 2, ".Z") == 0) - ofname[strlen(tempname) - 2] = '\0'; + if (has_z_suffix) + ofname[namesize - 2] = '\0'; } else {/* COMPRESSION */ if (!zcat_flg) { - if (strcmp(tempname + strlen(tempname) - 2, ".Z") == 0) + if (has_z_suffix) { fprintf(stderr, "%s: already has .Z suffix -- no change\n", tempname); - return; + free(tempname); + return; } if (infstat.st_nlink > 1 && (!force)) { - fprintf(stderr, "%s has %d other links: unchanged\n", - tempname, infstat.st_nlink - 1); - exit_code = 1; - return; + fprintf(stderr, "%s has %jd other links: unchanged\n", + tempname, (intmax_t)(infstat.st_nlink - 1)); + goto error; } } - strcpy(ofname, tempname); - strcat(ofname, ".Z"); + ofname = malloc(namesize + 3); + if (ofname == NULL) + { + perror("malloc"); + goto error; + } + memcpy(ofname, tempname, namesize); + strcpy(&ofname[namesize], ".Z"); } if ((fdin = open(ifname = tempname, O_RDONLY|O_BINARY)) == -1) { perror(tempname); - exit_code = 1; - return; + goto error; } if (zcat_flg == 0) { - int c; - int s; - struct stat statbuf; - struct stat statbuf2; - - if (stat(ofname, &statbuf) == 0) - { - if ((s = strlen(ofname)) > 8) - { - c = ofname[s-1]; - ofname[s-1] = '\0'; - - statbuf2 = statbuf; - - if (!stat(ofname, &statbuf2) && - statbuf.st_mode == statbuf2.st_mode && - statbuf.st_ino == statbuf2.st_ino && - statbuf.st_dev == statbuf2.st_dev && - statbuf.st_uid == statbuf2.st_uid && - statbuf.st_gid == statbuf2.st_gid && - statbuf.st_size == statbuf2.st_size && - statbuf.st_atime == statbuf2.st_atime && - statbuf.st_mtime == statbuf2.st_mtime && - statbuf.st_ctime == statbuf2.st_ctime) - { - fprintf(stderr, "%s: filename too long to tack on .Z\n", tempname); - exit_code = 1; - return; - } - - ofname[s-1] = (char)c; - } - + if (access(ofname, F_OK) == 0) + { if (!force) { inbuf[0] = 'n'; @@ -1092,8 +1088,7 @@ if (inbuf[0] != 'y') { fprintf(stderr, "%s not overwritten\n", ofname); - exit_code = 1; - return; + goto error; } } @@ -1101,56 +1096,16 @@ { fprintf(stderr, "Can't remove old output file\n"); perror(ofname); - exit_code = 1; - return ; + goto error; } } if ((fdout = open(ofname, O_WRONLY|O_CREAT|O_EXCL|O_BINARY,0600)) == -1) { perror(tempname); - return; + goto error; } - if ((s = strlen(ofname)) > 8) - { - if (fstat(fdout, &statbuf)) - { - fprintf(stderr, "Can't get status op output file\n"); - perror(ofname); - exit_code = 1; - return ; - } - - c = ofname[s-1]; - ofname[s-1] = '\0'; - statbuf2 = statbuf; - - if (!stat(ofname, &statbuf2) && - statbuf.st_mode == statbuf2.st_mode && - statbuf.st_ino == statbuf2.st_ino && - statbuf.st_dev == statbuf2.st_dev && - statbuf.st_uid == statbuf2.st_uid && - statbuf.st_gid == statbuf2.st_gid && - statbuf.st_size == statbuf2.st_size && - statbuf.st_atime == statbuf2.st_atime && - statbuf.st_mtime == statbuf2.st_mtime && - statbuf.st_ctime == statbuf2.st_ctime) - { - fprintf(stderr, "%s: filename too long to tack on .Z\n", tempname); - - if (unlink(ofname)) - { - fprintf(stderr, "can't remove bad output file\n"); - perror(ofname); - } - exit_code = 1; - return; - } - - ofname[s-1] = (char)c; - } - if(!quiet) fprintf(stderr, "%s: ", tempname); @@ -1159,7 +1114,6 @@ else { fdout = 1; - ofname[0] = '\0'; remove_ofname = 0; } @@ -1271,6 +1225,24 @@ tempname); break; } + + free(tempname); + if (!remove_ofname) + { + free(ofname); + ofname = NULL; + } + return; + +error: + free(ofname); + ofname = NULL; + free(tempname); + exit_code = 1; + if (fdin != -1) + close(fdin); + if (fdout != -1) + close(fdout); } #ifdef RECURSIVE @@ -1284,13 +1256,28 @@ REG1 struct dirent *dp; #endif REG2 DIR *dirp; - char nbuf[MAXPATHLEN]; - char *nptr = nbuf; + char *nptr; + char *fptr; + unsigned long dir_size = strlen(dir); + /* The +256 is a lazy optimization. We'll resize on demand. */ + unsigned long size = dir_size + 256; + + nptr = malloc(size); + if (nptr == NULL) + { + perror("malloc"); + exit_code = 1; + return; + } + memcpy(nptr, dir, dir_size); + nptr[dir_size] = '/'; + fptr = &nptr[dir_size + 1]; dirp = opendir(dir); if (dirp == NULL) { + free(nptr); printf("%s unreadable\n", dir); /* not stderr! */ return ; } @@ -1308,7 +1295,7 @@ ** think it's worth it. -- Dave Mack */ - while (dp = readdir(dirp)) + while ((dp = readdir(dirp)) != NULL) { if (dp->d_ino == 0) continue; @@ -1316,20 +1303,26 @@ if (strcmp(dp->d_name,".") == 0 || strcmp(dp->d_name,"..") == 0) continue; - if ((strlen(dir)+strlen(dp->d_name)+1) < (MAXPATHLEN - 1)) + if (size < dir_size + strlen(dp->d_name) + 2) { - strcpy(nbuf,dir); - strcat(nbuf,"/"); - strcat(nbuf,dp->d_name); - comprexx(&nptr); + size = dir_size + strlen(dp->d_name) + 2; + nptr = realloc(nptr, size); + if (nptr == NULL) + { + perror("realloc"); + exit_code = 1; + break; + } + fptr = &nptr[dir_size + 1]; } - else - fprintf(stderr,"Pathname too long: %s/%s\n", dir, dp->d_name); + + strcpy(fptr, dp->d_name); + comprexx(nptr); } closedir(dirp); - return; + free(nptr); } #endif /* @@ -1646,7 +1639,6 @@ maxbits = inbuf[2] & BIT_MASK; block_mode = inbuf[2] & BLOCK_MODE; - maxmaxcode = MAXCODE(maxbits); if (maxbits > BITS) { @@ -1657,6 +1649,8 @@ return; } + maxmaxcode = MAXCODE(maxbits); + bytes_in = insize; maxcode = MAXCODE(n_bits = INIT_BITS)-1; bitmask = (1<<n_bits)-1; @@ -1838,7 +1832,7 @@ write_error() { fprintf(stderr, "\nwrite error on"); - perror((ofname[0] != '\0') ? ofname : "stdout"); + perror(ofname ? ofname : "stdout"); abort_compress(); } @@ -1881,45 +1875,48 @@ void about() { - fprintf(stderr, "Compress version: %s, compiled: %s\n", version_id, COMPILE_DATE); - fprintf(stderr, "Compile options:\n "); + printf("Compress version: %s\n", version_id); + printf("Compile options:\n "); #if BYTEORDER == 4321 && NOALLIGN == 1 - fprintf(stderr, "USE_BYTEORDER, "); + printf("USE_BYTEORDER, "); #endif #ifdef FAST - fprintf(stderr, "FAST, "); + printf("FAST, "); #endif #ifdef vax - fprintf(stderr, "vax, "); + printf("vax, "); #endif #ifdef DIRENT - fprintf(stderr,"DIRENT, "); + printf("DIRENT, "); #endif #ifdef SYSDIR - fprintf(stderr,"SYSDIR, "); + printf("SYSDIR, "); #endif #ifdef NO_UCHAR - fprintf(stderr, "NO_UCHAR, "); + printf("NO_UCHAR, "); #endif #ifdef SIGNED_COMPARE_SLOW - fprintf(stderr, "SIGNED_COMPARE_SLOW, "); + printf("SIGNED_COMPARE_SLOW, "); #endif #ifdef MAXSEG_64K - fprintf(stderr, "MAXSEG_64K, "); + printf("MAXSEG_64K, "); #endif #ifdef DOS - fprintf(stderr, "DOS, "); + printf("DOS, "); #endif #ifdef DEBUG - fprintf(stderr, "DEBUG, "); + printf("DEBUG, "); #endif #ifdef LSTAT - fprintf(stderr, "LSTAT, "); + printf("LSTAT, "); #endif - fprintf(stderr, "\n REGISTERS=%d IBUFSIZ=%d, OBUFSIZ=%d, BITS=%d\n", + printf("\n REGISTERS=%d IBUFSIZ=%d, OBUFSIZ=%d, BITS=%d\n", REGISTERS, IBUFSIZ, OBUFSIZ, BITS); - fprintf(stderr, "\n\ + printf("\n\ +Author version 4.2.4.x (Maintenance):\n\ + Mike Frysinger ([email protected])\n\ +\n\ Author version 4.2 (Speed improvement & source cleanup):\n\ Peter Jannesen ([email protected])\n\ \n\ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncompress-4.2.4.4/patchlevel.h new/ncompress-4.2.4.5/patchlevel.h --- old/ncompress-4.2.4.4/patchlevel.h 2010-09-10 05:40:22.000000000 +0200 +++ new/ncompress-4.2.4.5/patchlevel.h 2019-01-04 11:42:45.000000000 +0100 @@ -1,2 +1,2 @@ -static char ident[] = "@(#)(N)compress 4.2.4.3"; +static char ident[] = "@(#)(N)compress 4.2.4.5"; #define version_id (ident+4) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncompress-4.2.4.4/tests/runtests.sh new/ncompress-4.2.4.5/tests/runtests.sh --- old/ncompress-4.2.4.4/tests/runtests.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/ncompress-4.2.4.5/tests/runtests.sh 2019-01-04 11:42:45.000000000 +0100 @@ -0,0 +1,143 @@ +#!/bin/sh +# Ugly, but works ? + +set -e + +TESTDIR="$(dirname "$(realpath "$0" 2>/dev/null || readlink -f "$0")")" +TOP_SRCDIR="$(dirname "${TESTDIR}")" + +if [ -z "${COMPRESS}" ]; then + COMPRESS="${TOP_SRCDIR}/compress" +fi +compress() { "${COMPRESS}" -v "$@"; } +uncompress() { "${COMPRESS}" -v -d "$@"; } + +echo "using compress: ${COMPRESS}" + +echo "Setting up test env" + +TMPDIR="" +trap 'rm -rf "${TMPDIR}"' EXIT +TMPDIR="$(mktemp -d)" + +cd "${TMPDIR}" + +cp "${TOP_SRCDIR}/README.md" input +cp input i +mkdir subdir +cp input i subdir/ +mkdir emptydir +touch emptyfile + +set -x + +: "### Check basic CLI exit status" +compress -V +compress -h >/dev/null + +out=$(compress -h) +[ -n "${out}" ] +( +# The shell trace output can write to stderr which we check here. +set +x +out=$(compress -h 2>&1 >/dev/null) +[ -z "${out}" ] +) + +if compress -X 2>/dev/null; then false; fi + +: "### Check unknown flags spit to stderr only" +out=$(compress -X 2>/dev/null) || : +[ -z "${out}" ] + +out=$(compress -X 2>&1) || : +[ -n "${out}" ] + +: "### Check -- handling" +cp input ./-X +compress -- -X +[ -e ./-X.Z ] +uncompress -- -X +[ -e ./-X ] +rm ./-X + +: "### Check compression" +compress input +[ ! -e input ] +[ -e input.Z ] + +: "### Check compressing .Z file fails" +if compress input.Z; then false; fi + +: "### Check decompression w/explicit .Z" +uncompress input.Z +[ -e input ] +[ ! -e input.Z ] + +: "### Check decompression w/implicit .Z" +compress input +uncompress input.Z +[ -e input ] +[ ! -e input.Z ] + +: "### Check uncompressing non-.Z file fails" +if uncompress input; then false; fi + +: "### Check empty directory compression" +if compress emptydir; then false; fi +if compress -r emptydir; then false; fi + +: "### Check directory compression" +compress -r subdir + +: "### Check empty directory decompression" +if uncompress -r emptydir; then false; fi + +: "### Check directory decompression" +uncompress -r subdir + +: "### Check uncompressed directory decompression" +if uncompress -r subdir; then false; fi + +: "### Check various error edge cases" +if compress missing; then false; fi +if uncompress missing; then false; fi + +: "### Check forced compression" +if compress emptyfile; then false; fi +if compress <emptyfile >/dev/null; then false; fi +compress -f emptyfile +uncompress emptyfile + +: "### Check stdin/stdout handling" +compress -c input >input.Z +[ -e input ] +compress <input >input.Z +uncompress -c input.Z >input.new +cmp input input.new +uncompress <input.Z >input.new +cmp input input.new + +: "### Check existing files" +if compress input </dev/null; then false; fi +compress -f input +mv input.new input +if uncompress input.Z </dev/null; then false; fi +uncompress -f input.Z + +: "### Check empty file names" +if compress ""; then false; fi +if uncompress ""; then false; fi + +: "### Check .Z dir edge case" +mkdir .Z +if uncompress ""; then false; fi +rmdir .Z + +: "### Check short filenames" +compress i +uncompress i +compress i +uncompress i.Z + +: "### All passed!" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncompress-4.2.4.4/travis/lib.sh new/ncompress-4.2.4.5/travis/lib.sh --- old/ncompress-4.2.4.4/travis/lib.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/ncompress-4.2.4.5/travis/lib.sh 2019-01-04 11:42:45.000000000 +0100 @@ -0,0 +1,38 @@ +#!/bin/bash +# Common funcs for working w/Travis. + +travis_fold() { + if [[ -n ${TRAVIS_OS_NAME} ]] ; then + printf 'travis_fold:%s:%s\r\n' "$@" | sed 's: :_:g' + fi +} + +if [[ -n ${TRAVIS_OS_NAME} ]] ; then + whitebg=$(tput setab 7) + blackfg=$(tput setaf 0) + normal=$(tput sgr0) +else + whitebg= + blackbg= + normal= +fi +v() { + local fold="" + case $1 in + --fold=*) fold=${1:7}; shift;; + esac + if [[ -n ${fold} ]] ; then + travis_fold start "${fold}" + echo "\$ $*" + "$@" + travis_fold end "${fold}" + else + echo "${whitebg}${blackfg}\$ $*${normal}" + "$@" + fi +} + +ncpus=$(getconf _NPROCESSORS_ONLN) +m() { + v make -j${ncpus} "$@" +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncompress-4.2.4.4/travis/main.sh new/ncompress-4.2.4.5/travis/main.sh --- old/ncompress-4.2.4.4/travis/main.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/ncompress-4.2.4.5/travis/main.sh 2019-01-04 11:42:45.000000000 +0100 @@ -0,0 +1,10 @@ +#!/bin/bash -e + +. "${0%/*}"/lib.sh + +main() { + m + m check + m install DESTDIR="${PWD}/root" +} +main "$@" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncompress-4.2.4.4/uncompress.1 new/ncompress-4.2.4.5/uncompress.1 --- old/ncompress-4.2.4.4/uncompress.1 1970-01-01 01:00:00.000000000 +0100 +++ new/ncompress-4.2.4.5/uncompress.1 2019-01-04 11:42:45.000000000 +0100 @@ -0,0 +1 @@ +.so compress.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ncompress-4.2.4.4/zmore.1 new/ncompress-4.2.4.5/zmore.1 --- old/ncompress-4.2.4.4/zmore.1 2010-09-10 05:40:22.000000000 +0200 +++ new/ncompress-4.2.4.5/zmore.1 2019-01-04 11:42:45.000000000 +0100 @@ -12,7 +12,7 @@ at the bottom of the screen. If the user then types a carriage return, one more line is displayed. If the user hits a space, -another screenful is displayed. Other possibilites are enumerated later. +another screenful is displayed. Other possibilities are enumerated later. .PP .I Zmore looks in the file
