- Update to 2.5 fixes rhbz#1919623
This commit is contained in:
parent
7a5313a1e5
commit
e13232b0fa
276
c9de6c53dcf3eb1071c7999c8accc43ef2b3f458.patch
Normal file
276
c9de6c53dcf3eb1071c7999c8accc43ef2b3f458.patch
Normal file
@ -0,0 +1,276 @@
|
||||
From c9de6c53dcf3eb1071c7999c8accc43ef2b3f458 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Adler <madler@alumni.caltech.edu>
|
||||
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 <stdio.h> // 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));
|
49
f310c0868634a1dbacdcdcb2dbce9501a8a87868.patch
Normal file
49
f310c0868634a1dbacdcdcb2dbce9501a8a87868.patch
Normal file
@ -0,0 +1,49 @@
|
||||
From f310c0868634a1dbacdcdcb2dbce9501a8a87868 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Adler <madler@alumni.caltech.edu>
|
||||
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 ||
|
22
pigz.spec
22
pigz.spec
@ -1,16 +1,20 @@
|
||||
Name: pigz
|
||||
Version: 2.4
|
||||
Release: 8%{?dist}
|
||||
Version: 2.5
|
||||
Release: 1%{?dist}
|
||||
Summary: Parallel implementation of gzip
|
||||
|
||||
License: zlib
|
||||
URL: https://www.zlib.net/pigz/
|
||||
Source0: https://www.zlib.net/%{name}/%{name}-%{version}.tar.gz
|
||||
|
||||
BuildRequires: make
|
||||
# [PATCH0] Portability improvements
|
||||
Patch0: c9de6c53dcf3eb1071c7999c8accc43ef2b3f458.patch
|
||||
# [PATCH1] Fix usage of x2nmodp() when compiling for no threads
|
||||
Patch1: f310c0868634a1dbacdcdcb2dbce9501a8a87868.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: zlib-devel
|
||||
BuildRequires: make
|
||||
BuildRequires: ncompress
|
||||
BuildRequires: zlib-devel
|
||||
|
||||
%description
|
||||
pigz, which stands for parallel implementation of gzip,
|
||||
@ -19,12 +23,11 @@ multiple processors and multiple cores to the hilt when
|
||||
compressing data.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%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
|
||||
@ -33,15 +36,16 @@ 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 Feb 01 2021 Filipe Rosset <rosset.filipe@gmail.com> - 2.5-1
|
||||
- Update to 2.5 fixes rhbz#1919623
|
||||
|
||||
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.4-8
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (pigz-2.4.tar.gz) = 79b2357176f93b9f3e2bc07fee393fc4d79b7bd0041808f8ddfd23eafccde72e60ca95e97595bb624a4f732fe3612bf46d57c44541c36ae62f9aa6336abe16ba
|
||||
SHA512 (pigz-2.5.tar.gz) = 8f52900b8664c67b5b1813ac2f6e226d899c72ba19eefd6424181dc4dc0416d38ad3c7e5fe3dce6bdb58f5ac34ec0269f846c43f9aef6f69a121713113c1643a
|
||||
|
Loading…
Reference in New Issue
Block a user