From e29649e545550be7cd0b2d2e5c070ae4f1589b08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sloup?= Date: Fri, 24 Jun 2022 12:33:07 +0200 Subject: [PATCH] Rebase to 5.0 Use autosetup Change source links Redo patch files and remove obsolete ones Add runtests.sh Rebase to the latest upstream version (rhbz#1924029) --- .gitignore | 1 + ncompress-4.2.4.4-2GB.patch | 13 ------- ncompress-4.2.4.4-endians.patch | 11 ------ ncompress-4.2.4.4-filenamelen.patch | 60 ----------------------------- ncompress-4.2.4.4-lfs.patch | 23 ----------- ncompress-4.2.4.4-make.patch | 20 ---------- ncompress-4.2.4.4-memmove.patch | 12 ------ ncompress-4.2.4.4-silence-gcc.patch | 33 ---------------- ncompress-5.0-2GB.patch | 12 ++++++ ncompress-5.0-endians.patch | 12 ++++++ ncompress-5.0-lfs.patch | 22 +++++++++++ ncompress-5.0-make.patch | 19 +++++++++ ncompress-5.0-memmove.patch | 11 ++++++ ncompress.spec | 51 ++++++++++++++++++++++-- sources | 2 +- 15 files changed, 126 insertions(+), 176 deletions(-) delete mode 100644 ncompress-4.2.4.4-2GB.patch delete mode 100644 ncompress-4.2.4.4-endians.patch delete mode 100644 ncompress-4.2.4.4-filenamelen.patch delete mode 100644 ncompress-4.2.4.4-lfs.patch delete mode 100644 ncompress-4.2.4.4-make.patch delete mode 100644 ncompress-4.2.4.4-memmove.patch delete mode 100644 ncompress-4.2.4.4-silence-gcc.patch create mode 100644 ncompress-5.0-2GB.patch create mode 100644 ncompress-5.0-endians.patch create mode 100644 ncompress-5.0-lfs.patch create mode 100644 ncompress-5.0-make.patch create mode 100644 ncompress-5.0-memmove.patch diff --git a/.gitignore b/.gitignore index 785b18c..02111c4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /ncompress-4.2.4.4.tar.gz +/v5.0.tar.gz diff --git a/ncompress-4.2.4.4-2GB.patch b/ncompress-4.2.4.4-2GB.patch deleted file mode 100644 index cf1ac52..0000000 --- a/ncompress-4.2.4.4-2GB.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/compress42.c b/compress42.c -index 4d33342..495bdf3 100644 ---- a/compress42.c -+++ b/compress42.c -@@ -1373,7 +1373,7 @@ compress(fdin, fdout) - REG11 int boff; - REG12 int n_bits; - REG13 int ratio; -- REG14 long checkpoint; -+ REG14 unsigned long long checkpoint; - REG15 code_int extcode; - union - { diff --git a/ncompress-4.2.4.4-endians.patch b/ncompress-4.2.4.4-endians.patch deleted file mode 100644 index fdc9662..0000000 --- a/ncompress-4.2.4.4-endians.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ncompress-4.2.4/compress42.c.endians 2006-09-19 13:53:58.000000000 +0200 -+++ ncompress-4.2.4/compress42.c 2006-09-19 13:57:54.000000000 +0200 -@@ -432,7 +432,7 @@ - - union bytes - { -- long word; -+ int word; - struct - { - #if BYTEORDER == 4321 diff --git a/ncompress-4.2.4.4-filenamelen.patch b/ncompress-4.2.4.4-filenamelen.patch deleted file mode 100644 index 49b7841..0000000 --- a/ncompress-4.2.4.4-filenamelen.patch +++ /dev/null @@ -1,60 +0,0 @@ -diff --git a/compress42.c b/compress42.c -index b3b3add..6878046 100644 ---- a/compress42.c -+++ b/compress42.c -@@ -141,6 +141,7 @@ - #include - #include - #include -+#include - - #ifdef DIRENT - # include -@@ -214,7 +215,7 @@ - # define OBUFSIZ BUFSIZ /* Default output buffer size */ - #endif - --#define MAXPATHLEN 1024 /* MAXPATHLEN - maximum length of a pathname we allow */ -+#define MAXPATHLEN PATH_MAX /* 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 */ -@@ -701,6 +702,7 @@ main(argc, argv) - { - REG3 char **filelist; - REG4 char **fileptr; -+ int i; - - if (fgnd_flag = (signal(SIGINT, SIG_IGN) != SIG_IGN)) - signal(SIGINT, (SIG_TYPE)abort_compress); -@@ -714,13 +716,18 @@ main(argc, argv) - nomagic = 1; /* Original didn't have a magic number */ - #endif - -- filelist = (char **)malloc(argc*sizeof(char *)); -+ for (i=0; i(MAXPATHLEN-1)) { -+ fprintf(stderr,"Filename too long\n"); -+ exit(1); -+ } -+ } -+ filelist = fileptr = (char **)malloc(argc*sizeof(char *)); - if (filelist == NULL) - { - fprintf(stderr, "Cannot allocate memory for file list.\n"); - exit (1); - } -- fileptr = filelist; - *filelist = NULL; - - if((progname = strrchr(argv[0], '/')) != 0) -@@ -860,7 +867,9 @@ nextarg: continue; - decompress(0, 1); - } - -+ free(filelist); - exit((exit_code== -1) ? 1:exit_code); -+ return 0; - } - - void diff --git a/ncompress-4.2.4.4-lfs.patch b/ncompress-4.2.4.4-lfs.patch deleted file mode 100644 index 2559799..0000000 --- a/ncompress-4.2.4.4-lfs.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git a/compress42.c b/compress42.c -index 804d099..b3b3add 100644 ---- a/compress42.c -+++ b/compress42.c -@@ -130,6 +130,7 @@ - * Add variable bit length output. - * - */ -+#include - #include - #include - #include -@@ -538,8 +539,8 @@ int remove_ofname = 0; /* Remove output file on a error */ - char ofname[MAXPATHLEN]; /* Output filename */ - int fgnd_flag = 0; /* Running in background (SIGINT=SIGIGN) */ - --long bytes_in; /* Total number of byte from input */ --long bytes_out; /* Total number of byte to output */ -+long long bytes_in; /* Total number of byte from input */ -+long long bytes_out; /* Total number of byte to output */ - - /* - * 8086 & 80286 Has a problem with array bigger than 64K so fake the array diff --git a/ncompress-4.2.4.4-make.patch b/ncompress-4.2.4.4-make.patch deleted file mode 100644 index 3d1878f..0000000 --- a/ncompress-4.2.4.4-make.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/Makefile.def b/Makefile.def -index e493d7c..1e6612f 100644 ---- a/Makefile.def -+++ b/Makefile.def -@@ -31,7 +31,14 @@ MANDIR=/usr/local/man/man1 - # -DDEF_ERRNO=1 Define error (not defined in errno.h). - # -DMAXSEG_64K=1 -BITS=16 Support segment processsor like 80286. - # --options= $(CFLAGS) $(CPPFLAGS) -DDIRENT=1 -DUSERMEM=800000 -DREGISTERS=3 -+options= $(CFLAGS) $(CPPFLAGS) -DDIRENT=1 -DUSERMEM=800000 -DREGISTERS=20 \ -+ -D_FILE_OFFSET_BITS=64 \ -+ -D_LARGEFILE_SOURCE \ -+ -DNOFUNCDEF=1 \ -+ -DOBUFSIZ=1024 \ -+ -DUTIME_H \ -+ -DSYSDIR=1 \ -+ $(ARCH_FLAGS) - - # libary options - LBOPT= $(LDFLAGS) diff --git a/ncompress-4.2.4.4-memmove.patch b/ncompress-4.2.4.4-memmove.patch deleted file mode 100644 index d8fec3e..0000000 --- a/ncompress-4.2.4.4-memmove.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -urNp ncompress-4.2.4-orig/compress42.c ncompress-4.2.4/compress42.c ---- ncompress-4.2.4-orig/compress42.c 2012-01-03 15:13:58.014222927 +0100 -+++ ncompress-4.2.4/compress42.c 2012-01-03 15:15:17.117097419 +0100 -@@ -1441,7 +1441,7 @@ compress(fdin, fdout) - boff = -(((OBUFSIZ<<3)-boff)%(n_bits<<3)); - bytes_out += OBUFSIZ; - -- memcpy(outbuf, outbuf+OBUFSIZ, (outbits>>3)+1); -+ memmove(outbuf, outbuf+OBUFSIZ, (outbits>>3)+1); - memset(outbuf+(outbits>>3)+1, '\0', OBUFSIZ); - } - diff --git a/ncompress-4.2.4.4-silence-gcc.patch b/ncompress-4.2.4.4-silence-gcc.patch deleted file mode 100644 index 738ce80..0000000 --- a/ncompress-4.2.4.4-silence-gcc.patch +++ /dev/null @@ -1,33 +0,0 @@ -diff --git a/compress42.c b/compress42.c -index c3f6b35..834c2f2 100644 ---- a/compress42.c -+++ b/compress42.c -@@ -704,7 +704,7 @@ main(argc, argv) - REG4 char **fileptr; - int i; - -- if (fgnd_flag = (signal(SIGINT, SIG_IGN) != SIG_IGN)) -+ if ((fgnd_flag = (signal(SIGINT, SIG_IGN)) != SIG_IGN)) - signal(SIGINT, (SIG_TYPE)abort_compress); - - signal(SIGTERM, (SIG_TYPE)abort_compress); -@@ -1016,8 +1016,8 @@ comprexx(fileptr) - - if (infstat.st_nlink > 1 && (!force)) - { -- fprintf(stderr, "%s has %d other links: unchanged\n", -- tempname, infstat.st_nlink - 1); -+ fprintf(stderr, "%s has %ld other links: unchanged\n", -+ tempname, (long)(infstat.st_nlink - 1)); - exit_code = 1; - return; - } -@@ -1318,7 +1318,7 @@ compdir(dir) - ** think it's worth it. -- Dave Mack - */ - -- while (dp = readdir(dirp)) -+ while ((dp = readdir(dirp))) - { - if (dp->d_ino == 0) - continue; diff --git a/ncompress-5.0-2GB.patch b/ncompress-5.0-2GB.patch new file mode 100644 index 0000000..013ca35 --- /dev/null +++ b/ncompress-5.0-2GB.patch @@ -0,0 +1,12 @@ +diff -ur v5.0_original/ncompress-5.0/compress.c v5.0/ncompress-5.0/compress.c +--- v5.0_original/ncompress-5.0/compress.c 2021-02-02 09:16:16.000000000 +0100 ++++ v5.0/ncompress-5.0/compress.c 2022-06-24 11:20:37.795568007 +0200 +@@ -1236,7 +1236,7 @@ + int boff; + int n_bits; + int ratio; +- long checkpoint; ++ unsigned long long checkpoint; + code_int extcode; + union + { diff --git a/ncompress-5.0-endians.patch b/ncompress-5.0-endians.patch new file mode 100644 index 0000000..2a35162 --- /dev/null +++ b/ncompress-5.0-endians.patch @@ -0,0 +1,12 @@ +diff -ur v5.0_original/ncompress-5.0/compress.c v5.0/ncompress-5.0/compress.c +--- v5.0_original/ncompress-5.0/compress.c 2021-02-02 09:16:16.000000000 +0100 ++++ v5.0/ncompress-5.0/compress.c 2022-06-24 11:39:42.325726170 +0200 +@@ -357,7 +357,7 @@ + + union bytes + { +- long word; ++ int word; + struct + { + #if BYTEORDER == 4321 diff --git a/ncompress-5.0-lfs.patch b/ncompress-5.0-lfs.patch new file mode 100644 index 0000000..d0b396a --- /dev/null +++ b/ncompress-5.0-lfs.patch @@ -0,0 +1,22 @@ +diff -ur v5.0_original/ncompress-5.0/compress.c v5.0/ncompress-5.0/compress.c +--- v5.0_original/ncompress-5.0/compress.c 2021-02-02 09:16:16.000000000 +0100 ++++ v5.0/ncompress-5.0/compress.c 2022-06-24 11:11:52.435388146 +0200 +@@ -150,6 +150,7 @@ + #include + #include + #include ++#include + + #if !defined(DOS) && !defined(WINDOWS) + # include +@@ -424,8 +425,8 @@ + char *ofname = NULL; /* Output filename */ + int fgnd_flag = 0; /* Running in background (SIGINT=SIGIGN) */ + +-long bytes_in; /* Total number of byte from input */ +-long bytes_out; /* Total number of byte to output */ ++long long bytes_in; /* Total number of byte from input */ ++long long bytes_out; /* Total number of byte to output */ + + /* + * 8086 & 80286 Has a problem with array bigger than 64K so fake the array diff --git a/ncompress-5.0-make.patch b/ncompress-5.0-make.patch new file mode 100644 index 0000000..82aa390 --- /dev/null +++ b/ncompress-5.0-make.patch @@ -0,0 +1,19 @@ +diff -ur v5.0_original/ncompress-5.0/Makefile.def v5.0/ncompress-5.0/Makefile.def +--- v5.0_original/ncompress-5.0/Makefile.def 2021-02-02 09:16:16.000000000 +0100 ++++ v5.0/ncompress-5.0/Makefile.def 2022-06-24 10:23:42.777040729 +0200 +@@ -27,7 +27,14 @@ + # -DBYTEORDER= Byte order (default: unknown). + # -DMAXSEG_64K=1 -BITS=16 Support segment processor like 80286. + # +-options= $(CFLAGS) $(CPPFLAGS) -DUSERMEM=800000 ++options= $(CFLAGS) $(CPPFLAGS) -DDIRENT=1 -DUSERMEM=800000 -DREGISTERS=20 \ ++ -D_FILE_OFFSET_BITS=64 \ ++ -D_LARGEFILE_SOURCE \ ++ -DNOFUNCDEF=1 \ ++ -DOBUFSIZ=1024 \ ++ -DUTIME_H \ ++ -DSYSDIR=1 \ ++ $(ARCH_FLAGS) + + # library options + LBOPT= $(LDFLAGS) diff --git a/ncompress-5.0-memmove.patch b/ncompress-5.0-memmove.patch new file mode 100644 index 0000000..ed863c1 --- /dev/null +++ b/ncompress-5.0-memmove.patch @@ -0,0 +1,11 @@ +--- v5.0_original/ncompress-5.0/compress.c 2021-02-02 09:16:16.000000000 +0100 ++++ v5.0/ncompress-5.0/compress.c 2022-06-24 11:41:59.632028398 +0200 +@@ -1337,7 +1337,7 @@ + boff = -(((OBUFSIZ<<3)-boff)%(n_bits<<3)); + bytes_out += OBUFSIZ; + +- memcpy(outbuf, outbuf+OBUFSIZ, (outbits>>3)+1); ++ memmove(outbuf, outbuf+OBUFSIZ, (outbits>>3)+1); + memset(outbuf+(outbits>>3)+1, '\0', OBUFSIZ); + } + diff --git a/ncompress.spec b/ncompress.spec index c7cff43..035ee60 100644 --- a/ncompress.spec +++ b/ncompress.spec @@ -6,6 +6,39 @@ License: Public Domain URL: https://github.com/vapier/%{name} Source: https://github.com/vapier/%{name}/archive/refs/tags/v%{version}.tar.gz +# allow to build ncompress +# ~> downstream +Patch0: ncompress-5.0-make.patch + +# from dist-git commit 0539779d937 +# (praiskup: removed redundant part as -DNOFUNCDEF is defined) +# ~> downstream +Patch1: ncompress-5.0-lfs.patch + +# exit when too long filename is given (do not segfault) +# ~> #unknown +# ~> downstream +# Patch2: ncompress-4.2.4.4-filenamelen.patch +# Did not segfault, Prints error 'File name too long' + +# permit files > 2GB to be compressed +# ~> #126775 +Patch3: ncompress-5.0-2GB.patch + +# do not fail to compress on ppc/s390x +# ~> #207001 +Patch4: ncompress-5.0-endians.patch + +# use memmove instead of memcpy +# ~> 760657 +# ~> downstream +Patch5: ncompress-5.0-memmove.patch + +# silence gcc warnings +# ~> downstream +# Patch6: ncompress-4.2.4.4-silence-gcc.patch +# Fixed with %ld and brackets are included + BuildRequires: make BuildRequires: gcc BuildRequires: glibc-devel @@ -22,7 +55,15 @@ which are compatible with the original UNIX compress utility. %prep -%autosetup -n %{name}-%{version} +%ifarch sparc m68k armv4l ppc s390 s390x ppc64 sparc64 +ARCH_FLAGS="$ARCH_FLAGS -DBYTEORDER=1234" +%endif + +%ifarch alpha ia64 +ARCH_FLAGS="$ARCH_FLAGS -DNOALLIGN=0" +%endif + +%autosetup -n %{name}-%{version} -p2 %build make CFLAGS="%{optflags} %{?nc_endian} %{?nc_align} %{build_ldflags}" @@ -36,6 +77,9 @@ ln -sf compress $RPM_BUILD_ROOT/%{_bindir}/uncompress install -p -m644 compress.1 $RPM_BUILD_ROOT%{_mandir}/man1 ln -sf compress.1 $RPM_BUILD_ROOT%{_mandir}/man1/uncompress.1 +%check +./tests/runtests.sh + %files %{_bindir}/compress @@ -45,10 +89,11 @@ ln -sf compress.1 $RPM_BUILD_ROOT%{_mandir}/man1/uncompress.1 %changelog -* Wed May 18 2022 Ondrej Sloup - 5.0-1 +* Fri Jun 24 2022 Ondrej Sloup - 5.0-1 - Use autosetup - Change source links -- Remove patch files +- Redo patch files and remove obsolete ones +- Add runtests.sh - Rebase to the latest upstream version (rhbz#1924029) * Thu Jan 20 2022 Fedora Release Engineering - 4.2.4.4-21 diff --git a/sources b/sources index cdc0feb..3689c61 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -4be215caacf3d082bfe24cfdbaba538e ncompress-4.2.4.4.tar.gz +SHA512 (v5.0.tar.gz) = 5bc886f98f25b03d034e8d8ebb0ee9388d727ee3e0c6d8a906698b2f8fa5c930f55d857486244b7f40447c7b74f3c620626600db619d0c6d6fd434f52912be42