From 84023942b6098c03f332f1023b014e1b14cc5cc6 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 02 2021 11:07:43 +0000 Subject: import pigz-2.5-3.el9 --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..66b9429 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/pigz-2.5.tar.gz diff --git a/.pigz.metadata b/.pigz.metadata new file mode 100644 index 0000000..3efff3c --- /dev/null +++ b/.pigz.metadata @@ -0,0 +1 @@ +82eef9525c2b4f4b1881d824a6cf621c74214cd0 SOURCES/pigz-2.5.tar.gz diff --git a/SOURCES/c9de6c53dcf3eb1071c7999c8accc43ef2b3f458.patch b/SOURCES/c9de6c53dcf3eb1071c7999c8accc43ef2b3f458.patch new file mode 100644 index 0000000..43b1da0 --- /dev/null +++ b/SOURCES/c9de6c53dcf3eb1071c7999c8accc43ef2b3f458.patch @@ -0,0 +1,276 @@ +From c9de6c53dcf3eb1071c7999c8accc43ef2b3f458 Mon Sep 17 00:00:00 2001 +From: Mark Adler +Date: Sun, 24 Jan 2021 22:00:00 -0800 +Subject: [PATCH] Portability improvements. + +Avoid many bogus warnings across versions of gcc. Work around +missing definitions on some systems. Fix some printf format types. +--- + pigz.c | 77 ++++++++++++++++++++----------------- + try.h | 6 +-- + zopfli/src/zopfli/cache.c | 2 +- + zopfli/src/zopfli/deflate.c | 13 ++++--- + 4 files changed, 53 insertions(+), 45 deletions(-) + +diff --git a/pigz.c b/pigz.c +index 7430e1e..6ec3a82 100644 +--- a/pigz.c ++++ b/pigz.c +@@ -333,7 +333,7 @@ + // Portability defines. + #define _FILE_OFFSET_BITS 64 // Use large file functions + #define _LARGE_FILES // Same thing for AIX +-#define _POSIX_C_SOURCE 200809L // For MinGW ++#define _XOPEN_SOURCE 700 // For POSIX 2008 + + // Included headers and what is expected from each. + #include // fflush(), fprintf(), fputs(), getchar(), putc(), +@@ -874,10 +874,10 @@ local void log_dump(void) { + ; + log_free(); + if (mem_track.num || mem_track.size) +- complain("memory leak: %lu allocs of %lu bytes total", ++ complain("memory leak: %zu allocs of %zu bytes total", + mem_track.num, mem_track.size); + if (mem_track.max) +- fprintf(stderr, "%lu bytes of memory used in %lu allocs\n", ++ fprintf(stderr, "%zu bytes of memory used in %zu allocs\n", + mem_track.max, mem_track.tot); + } + +@@ -993,7 +993,7 @@ local size_t writen(int desc, void const *buf, size_t len) { + size_t left = len; + + while (left) { +- size_t const max = SIZE_MAX >> 1; // max ssize_t ++ size_t const max = SSIZE_MAX; + ssize_t ret = write(desc, next, left > max ? max : left); + if (ret < 1) + throw(errno, "write error on %s (%s)", g.outf, strerror(errno)); +@@ -1668,26 +1668,32 @@ local void compress_thread(void *dummy) { + size_t len; // remaining bytes to compress/check + #if ZLIB_VERNUM >= 0x1260 + int bits; // deflate pending bits +-#endif +-#ifndef NOZOPFLI +- struct space *temp = NULL; // temporary space for zopfli input + #endif + int ret; // zlib return code +- z_stream strm; // deflate stream + ball_t err; // error information from throw() + + (void)dummy; + + try { +- // initialize the deflate stream for this thread +- strm.zfree = ZFREE; +- strm.zalloc = ZALLOC; +- strm.opaque = OPAQUE; +- ret = deflateInit2(&strm, 6, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY); +- if (ret == Z_MEM_ERROR) +- throw(ENOMEM, "not enough memory"); +- if (ret != Z_OK) +- throw(EINVAL, "internal error"); ++ z_stream strm; // deflate stream ++#ifndef NOZOPFLI ++ struct space *temp = NULL; ++ // get temporary space for zopfli input ++ if (g.level > 9) ++ temp = get_space(&out_pool); ++ else ++#endif ++ { ++ // initialize the deflate stream for this thread ++ strm.zfree = ZFREE; ++ strm.zalloc = ZALLOC; ++ strm.opaque = OPAQUE; ++ ret = deflateInit2(&strm, 6, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY); ++ if (ret == Z_MEM_ERROR) ++ throw(ENOMEM, "not enough memory"); ++ if (ret != Z_OK) ++ throw(EINVAL, "internal error"); ++ } + + // keep looking for work + for (;;) { +@@ -1714,11 +1720,8 @@ local void compress_thread(void *dummy) { + (void)deflateParams(&strm, g.level, Z_DEFAULT_STRATEGY); + #ifndef NOZOPFLI + } +- else { +- if (temp == NULL) +- temp = get_space(&out_pool); ++ else + temp->len = 0; +- } + #endif + + // set dictionary if provided, release that input or dictionary +@@ -1912,11 +1915,15 @@ local void compress_thread(void *dummy) { + } + + // found job with seq == -1 -- return to join ++ release(compress_have); + #ifndef NOZOPFLI +- drop_space(temp); ++ if (g.level > 9) ++ drop_space(temp); ++ else + #endif +- release(compress_have); +- (void)deflateEnd(&strm); ++ { ++ (void)deflateEnd(&strm); ++ } + } + catch (err) { + THREADABORT(err); +@@ -3078,7 +3085,7 @@ local void show_info(int method, unsigned long check, length_t len, int cont) { + strncpy(tag, "<...>", max + 1); + else if (g.hname == NULL) { + n = strlen(g.inf) - compressed_suffix(g.inf); +- strncpy(tag, g.inf, n > max + 1 ? max + 1 : n); ++ memcpy(tag, g.inf, n > max + 1 ? max + 1 : n); + if (strcmp(g.inf + n, ".tgz") == 0 && n < max + 1) + strncpy(tag + n, ".tar", max + 1 - n); + } +@@ -3802,37 +3809,33 @@ local char *justname(char *path) { + return p == NULL ? path : p + 1; + } + +-#pragma GCC diagnostic push +-#pragma GCC diagnostic ignored "-Wunused-result" +- + // Copy file attributes, from -> to, as best we can. This is best effort, so no + // errors are reported. The mode bits, including suid, sgid, and the sticky bit + // are copied (if allowed), the owner's user id and group id are copied (again + // if allowed), and the access and modify times are copied. +-local void copymeta(char *from, char *to) { ++local int copymeta(char *from, char *to) { + struct stat st; + struct timeval times[2]; + + // get all of from's Unix meta data, return if not a regular file + if (stat(from, &st) != 0 || (st.st_mode & S_IFMT) != S_IFREG) +- return; ++ return -4; + + // set to's mode bits, ignore errors +- (void)chmod(to, st.st_mode & 07777); ++ int ret = chmod(to, st.st_mode & 07777); + + // copy owner's user and group, ignore errors +- (void)chown(to, st.st_uid, st.st_gid); ++ ret += chown(to, st.st_uid, st.st_gid); + + // copy access and modify times, ignore errors + times[0].tv_sec = st.st_atime; + times[0].tv_usec = 0; + times[1].tv_sec = st.st_mtime; + times[1].tv_usec = 0; +- (void)utimes(to, times); ++ ret += utimes(to, times); ++ return ret; + } + +-#pragma GCC diagnostic pop +- + // Set the access and modify times of fd to t. + local void touch(char *path, time_t t) { + struct timeval times[2]; +@@ -4430,6 +4433,7 @@ local int option(char *arg) { + puts("Subject to the terms of the zlib license."); + puts("No warranty is provided or implied."); + exit(0); ++ break; // avoid warning + case 'M': g.headis |= 0xa; break; + case 'N': g.headis = 0xf; break; + #ifndef NOZOPFLI +@@ -4443,13 +4447,16 @@ local int option(char *arg) { + if (g.verbosity > 1) + printf("zlib %s\n", zlibVersion()); + exit(0); ++ break; // avoid warning + case 'Y': g.sync = 1; break; + case 'Z': + throw(EINVAL, "invalid option: LZW output not supported: %s", + bad); ++ break; // avoid warning + case 'a': + throw(EINVAL, "invalid option: no ascii conversion: %s", + bad); ++ break; // avoid warning + case 'b': get = 1; break; + case 'c': g.pipeout = 1; break; + case 'd': if (!g.decode) g.headis >>= 2; g.decode = 1; break; +diff --git a/try.h b/try.h +index 03289dd..3009f7d 100644 +--- a/try.h ++++ b/try.h +@@ -304,8 +304,8 @@ struct try_s_ { + # define try_stack_ ((try_t_ *)pthread_getspecific(try_key_)) + # define try_stack_set_(next) \ + do { \ +- int try_ret_ = pthread_setspecific(try_key_, next); \ +- assert(try_ret_ == 0 && "try: pthread_setspecific() failed"); \ ++ assert(pthread_setspecific(try_key_, next) == 0 && \ ++ "try: pthread_setspecific() failed"); \ + } while (0) + #else /* !PTHREAD_ONCE_INIT */ + extern try_t_ *try_stack_; +@@ -320,7 +320,7 @@ struct try_s_ { + #define TRY_TRY_ \ + do { \ + try_t_ try_this_; \ +- int try_pushed_ = 1; \ ++ volatile int try_pushed_ = 1; \ + try_this_.ball.code = 0; \ + try_this_.ball.free = 0; \ + try_this_.ball.why = NULL; \ +diff --git a/zopfli/src/zopfli/cache.c b/zopfli/src/zopfli/cache.c +index f5559c3..e5934df 100644 +--- a/zopfli/src/zopfli/cache.c ++++ b/zopfli/src/zopfli/cache.c +@@ -33,7 +33,7 @@ void ZopfliInitCache(size_t blocksize, ZopfliLongestMatchCache* lmc) { + lmc->sublen = (unsigned char*)malloc(ZOPFLI_CACHE_LENGTH * 3 * blocksize); + if(lmc->sublen == NULL) { + fprintf(stderr, +- "Error: Out of memory. Tried allocating %lu bytes of memory.\n", ++ "Error: Out of memory. Tried allocating %zu bytes of memory.\n", + ZOPFLI_CACHE_LENGTH * 3 * blocksize); + exit (EXIT_FAILURE); + } +diff --git a/zopfli/src/zopfli/deflate.c b/zopfli/src/zopfli/deflate.c +index abe7360..f7b62e4 100644 +--- a/zopfli/src/zopfli/deflate.c ++++ b/zopfli/src/zopfli/deflate.c +@@ -431,22 +431,23 @@ Changes the population counts in a way that the consequent Huffman tree + compression, especially its rle-part, will be more likely to compress this data + more efficiently. length contains the size of the histogram. + */ +-void OptimizeHuffmanForRle(int length, size_t* counts) { +- int i, k, stride; ++void OptimizeHuffmanForRle(unsigned length, size_t* counts) { ++ unsigned i; ++ int k, stride; + size_t symbol, sum, limit; + int* good_for_rle; + + /* 1) We don't want to touch the trailing zeros. We may break the + rules of the format by adding more data in the distance codes. */ +- for (; length >= 0; --length) { +- if (length == 0) { +- return; +- } ++ for (; length > 0; --length) { + if (counts[length - 1] != 0) { + /* Now counts[0..length - 1] does not have trailing zeros. */ + break; + } + } ++ if (length == 0) { ++ return; ++ } + /* 2) Let's mark all population counts that already can be encoded + with an rle code.*/ + good_for_rle = (int*)malloc(length * sizeof(int)); diff --git a/SOURCES/f310c0868634a1dbacdcdcb2dbce9501a8a87868.patch b/SOURCES/f310c0868634a1dbacdcdcb2dbce9501a8a87868.patch new file mode 100644 index 0000000..8c1fe2d --- /dev/null +++ b/SOURCES/f310c0868634a1dbacdcdcb2dbce9501a8a87868.patch @@ -0,0 +1,49 @@ +From f310c0868634a1dbacdcdcb2dbce9501a8a87868 Mon Sep 17 00:00:00 2001 +From: Mark Adler +Date: Sun, 24 Jan 2021 21:39:26 -0800 +Subject: [PATCH] Fix usage of x2nmodp() when compiling for no threads. + +--- + pigz.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/pigz.c b/pigz.c +index e5a094a..7430e1e 100644 +--- a/pigz.c ++++ b/pigz.c +@@ -545,7 +545,9 @@ local struct { + int procs; // maximum number of compression threads (>= 1) + int setdict; // true to initialize dictionary in each thread + size_t block; // uncompressed input size per thread (>= 32K) ++#ifndef NOTHREAD + crc_t shift; // pre-calculated CRC-32 shift for length block ++#endif + + // saved gzip/zip header data for decompression, testing, and listing + time_t stamp; // time stamp from gzip header +@@ -4286,13 +4288,13 @@ local void defaults(void) { + // blocksplittingmax = 15 + ZopfliInitOptions(&g.zopts); + #endif ++ g.block = 131072UL; // 128K + #ifdef NOTHREAD + g.procs = 1; + #else + g.procs = nprocs(8); +-#endif +- g.block = 131072UL; // 128K + g.shift = x2nmodp(g.block, 3); ++#endif + g.rsync = 0; // don't do rsync blocking + g.setdict = 1; // initialize dictionary each thread + g.verbosity = 1; // normal message level +@@ -4480,7 +4482,9 @@ local int option(char *arg) { + if (get == 1) { + n = num(arg); + g.block = n << 10; // chunk size ++#ifndef NOTHREAD + g.shift = x2nmodp(g.block, 3); ++#endif + if (g.block < DICT) + throw(EINVAL, "block size too small (must be >= 32K)"); + if (n != g.block >> 10 || diff --git a/SPECS/pigz.spec b/SPECS/pigz.spec new file mode 100644 index 0000000..e49ebc5 --- /dev/null +++ b/SPECS/pigz.spec @@ -0,0 +1,155 @@ +Name: pigz +Version: 2.5 +Release: 3%{?dist} +Summary: Parallel implementation of gzip +License: zlib +URL: https://www.zlib.net/pigz/ +Source0: https://www.zlib.net/%{name}/%{name}-%{version}.tar.gz + +# [PATCH0] Portability improvements +Patch0: c9de6c53dcf3eb1071c7999c8accc43ef2b3f458.patch +# [PATCH1] Fix usage of x2nmodp() when compiling for no threads +Patch1: f310c0868634a1dbacdcdcb2dbce9501a8a87868.patch + +BuildRequires: gcc +BuildRequires: make +BuildRequires: ncompress +BuildRequires: zlib-devel + +%description +pigz, which stands for parallel implementation of gzip, +is a fully functional replacement for gzip that exploits +multiple processors and multiple cores to the hilt when +compressing data. + +%prep +%autosetup -p1 + +%build +%make_build CFLAGS="$RPM_OPT_FLAGS" + +%install +install -p -D pigz $RPM_BUILD_ROOT%{_bindir}/pigz +pushd $RPM_BUILD_ROOT%{_bindir}; ln pigz unpigz; popd +install -p -D pigz.1 -m 0644 $RPM_BUILD_ROOT%{_datadir}/man/man1/pigz.1 + +%check +make tests CFLAGS="$RPM_OPT_FLAGS" + +%files +%doc pigz.pdf README +%{_bindir}/pigz +%{_bindir}/unpigz +%{_datadir}/man/man1/pigz.* + +%changelog +* Mon Aug 09 2021 Mohan Boddu - 2.5-3 +- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags + Related: rhbz#1991688 + +* Fri Apr 16 2021 Mohan Boddu - 2.5-2 +- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 + +* Mon Feb 01 2021 Filipe Rosset - 2.5-1 +- Update to 2.5 fixes rhbz#1919623 + +* Wed Jan 27 2021 Fedora Release Engineering - 2.4-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Tue Jul 28 2020 Fedora Release Engineering - 2.4-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Thu Jan 30 2020 Fedora Release Engineering - 2.4-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Fri Jul 26 2019 Fedora Release Engineering - 2.4-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Sat Feb 02 2019 Fedora Release Engineering - 2.4-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Fri Jul 13 2018 Fedora Release Engineering - 2.4-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Fri Feb 09 2018 Fedora Release Engineering - 2.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Tue Jan 02 2018 Adel Gadllah - 2.4-1 +- New upstream release + +* Thu Aug 03 2017 Fedora Release Engineering - 2.3.4-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Thu Jul 27 2017 Fedora Release Engineering - 2.3.4-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Sat Feb 11 2017 Fedora Release Engineering - 2.3.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Sat Dec 03 2016 Filipe Rosset - 2.3.4-1 +- Rebuilt for new upstream release 2.3.4, fixes rhbz #1381067 + +* Sat Dec 03 2016 Filipe Rosset - 2.3.3-5 +- Spec clean up + +* Thu Feb 04 2016 Fedora Release Engineering - 2.3.3-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Thu Jun 18 2015 Fedora Release Engineering - 2.3.3-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Sat Feb 21 2015 Till Maas - 2.3.3-2 +- Rebuilt for Fedora 23 Change + https://fedoraproject.org/wiki/Changes/Harden_all_packages_with_position-independent_code + +* Fri Jan 30 2015 Orion Poplawski - 2.3.3-1 +- Update to 2.3.3, fixes CVE-2015-1191 (bug #1181045) + +* Sun Aug 17 2014 Fedora Release Engineering - 2.3.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sat Jun 07 2014 Fedora Release Engineering - 2.3.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Mon May 19 2014 Adel Gadllah - 2.3.1-1 +- Update to 2.3.1 + +* Sun Aug 04 2013 Fedora Release Engineering - 2.2.5-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Thu Feb 14 2013 Fedora Release Engineering - 2.2.5-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Tue Jul 31 2012 Ville Skyttä - 2.2.5-1 +- Update to 2.2.5. +- Hardlink binaries instead of shipping duplicates (#785834). +- Build with $RPM_LD_FLAGS. +- Run test suite during build. + +* Sat Jul 21 2012 Fedora Release Engineering - 2.2.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Wed Mar 14 2012 Adel Gadllah - 2.2.4-1 +- New upstream release + +* Wed Jan 18 2012 Adel Gadllah - 2.2.3-1 +- New upstream release + +* Sat Jan 14 2012 Fedora Release Engineering - 2.1.6-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Wed Feb 09 2011 Fedora Release Engineering - 2.1.6-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Mon Apr 26 2010 Adel Gadllah - 2.1.6-1 +- New upstream release + +* Sat Sep 26 2009 Adel Gadllah - 2.1.5-3 +- Preserve timestamps + +* Sat Sep 26 2009 Adel Gadllah - 2.1.5-2 +- Fix license tag + +* Fri Sep 25 2009 Adel Gadllah - 2.1.5-1 +- Initial package +