From 95840551cef2279e44533fe4f94714c37356fc9f Mon Sep 17 00:00:00 2001 From: zyppe <210hcl@gmail.com> Date: Thu, 29 Feb 2024 16:09:12 +0800 Subject: [PATCH] Initialize for zstd --- .gitignore | 1 + .zstd.metadata | 1 + Disallow-empty-output-directory.patch | 63 +++++ Fix-buffer-underflow-for-null-dir1.patch | 62 +++++ baselibs.conf | 6 + pzstd.1.patch | 17 ++ zstd-1.5.0.tar.gz.sig | 17 ++ zstd.changes | 299 +++++++++++++++++++++++ zstd.spec | 124 ++++++++++ 9 files changed, 590 insertions(+) create mode 100644 .gitignore create mode 100644 .zstd.metadata create mode 100644 Disallow-empty-output-directory.patch create mode 100644 Fix-buffer-underflow-for-null-dir1.patch create mode 100644 baselibs.conf create mode 100644 pzstd.1.patch create mode 100644 zstd-1.5.0.tar.gz.sig create mode 100644 zstd.changes create mode 100644 zstd.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7fcf052 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +zstd-1.5.0.tar.gz diff --git a/.zstd.metadata b/.zstd.metadata new file mode 100644 index 0000000..431fa6c --- /dev/null +++ b/.zstd.metadata @@ -0,0 +1 @@ +36a14da681bc3d57b9544cd9082abbec9f58d77cb9d1fb36c46aeff8a0732cf4 zstd-1.5.0.tar.gz diff --git a/Disallow-empty-output-directory.patch b/Disallow-empty-output-directory.patch new file mode 100644 index 0000000..de4505e --- /dev/null +++ b/Disallow-empty-output-directory.patch @@ -0,0 +1,63 @@ +From f9f27de91c89d826c6a39c3ef44fb1b02f9a43aa Mon Sep 17 00:00:00 2001 +From: Elliot Gorokhovsky +Date: Fri, 29 Jul 2022 14:44:22 -0700 +Subject: [PATCH] Disallow empty output directory + +--- + programs/zstdcli.c | 18 ++++++++++++++++-- + tests/cli-tests/basic/output_dir.sh | 7 +++++++ + tests/cli-tests/basic/output_dir.sh.stderr.exact | 2 ++ + tests/cli-tests/basic/output_dir.sh.stdout.exact | 2 ++ + 4 files changed, 27 insertions(+), 2 deletions(-) + create mode 100755 tests/cli-tests/basic/output_dir.sh + create mode 100644 tests/cli-tests/basic/output_dir.sh.stderr.exact + create mode 100644 tests/cli-tests/basic/output_dir.sh.stdout.exact + +--- a/programs/zstdcli.c ++++ b/programs/zstdcli.c +@@ -931,9 +931,23 @@ int main(int const argCount, const char* + if (longCommandWArg(&argument, "--stream-size=")) { streamSrcSize = readSizeTFromChar(&argument); continue; } + if (longCommandWArg(&argument, "--target-compressed-block-size=")) { targetCBlockSize = readSizeTFromChar(&argument); continue; } + if (longCommandWArg(&argument, "--size-hint=")) { srcSizeHint = readSizeTFromChar(&argument); continue; } +- if (longCommandWArg(&argument, "--output-dir-flat")) { NEXT_FIELD(outDirName); continue; } ++ if (longCommandWArg(&argument, "--output-dir-flat")) { ++ NEXT_FIELD(outDirName); ++ if (strlen(outDirName) == 0) { ++ DISPLAY("error: output dir cannot be empty string (did you mean to pass '.' instead?)\n"); ++ CLEAN_RETURN(1); ++ } ++ continue; ++ } + #ifdef UTIL_HAS_MIRRORFILELIST +- if (longCommandWArg(&argument, "--output-dir-mirror")) { NEXT_FIELD(outMirroredDirName); continue; } ++ if (longCommandWArg(&argument, "--output-dir-mirror")) { ++ NEXT_FIELD(outMirroredDirName); ++ if (strlen(outMirroredDirName) == 0) { ++ DISPLAY("error: output dir cannot be empty string (did you mean to pass '.' instead?)\n"); ++ CLEAN_RETURN(1); ++ } ++ continue; ++ } + #endif + #ifndef ZSTD_NOTRACE + if (longCommandWArg(&argument, "--trace")) { char const* traceFile; NEXT_FIELD(traceFile); TRACE_enable(traceFile); continue; } +--- /dev/null ++++ b/tests/cli-tests/basic/output_dir.sh +@@ -0,0 +1,7 @@ ++#!/bin/sh ++ ++println "+ zstd -r * --output-dir-mirror=\"\"" ++zstd -r * --output-dir-mirror="" && die "Should not allow empty output dir!" ++println "+ zstd -r * --output-dir-flat=\"\"" ++zstd -r * --output-dir-flat="" && die "Should not allow empty output dir!" ++exit 0 +--- /dev/null ++++ b/tests/cli-tests/basic/output_dir.sh.stderr.exact +@@ -0,0 +1,2 @@ ++error: output dir cannot be empty string (did you mean to pass '.' instead?) ++error: output dir cannot be empty string (did you mean to pass '.' instead?) +--- /dev/null ++++ b/tests/cli-tests/basic/output_dir.sh.stdout.exact +@@ -0,0 +1,2 @@ +++ zstd -r * --output-dir-mirror="" +++ zstd -r * --output-dir-flat="" diff --git a/Fix-buffer-underflow-for-null-dir1.patch b/Fix-buffer-underflow-for-null-dir1.patch new file mode 100644 index 0000000..b55954a --- /dev/null +++ b/Fix-buffer-underflow-for-null-dir1.patch @@ -0,0 +1,62 @@ +From e1873ad576cb478fff0e6e44ad99599cd5fd2846 Mon Sep 17 00:00:00 2001 +From: Elliot Gorokhovsky +Date: Fri, 29 Jul 2022 11:10:47 -0700 +Subject: [PATCH] Fix buffer underflow for null dir1 + +--- + programs/util.c | 40 ++++++++++++++++++++-------------------- + 1 file changed, 20 insertions(+), 20 deletions(-) + +--- a/programs/util.c ++++ b/programs/util.c +@@ -809,30 +809,30 @@ static const char * trimPath(const char + + static char* mallocAndJoin2Dir(const char *dir1, const char *dir2) + { +- const size_t dir1Size = strlen(dir1); +- const size_t dir2Size = strlen(dir2); +- char *outDirBuffer, *buffer, trailingChar; +- + assert(dir1 != NULL && dir2 != NULL); +- outDirBuffer = (char *) malloc(dir1Size + dir2Size + 2); +- CONTROL(outDirBuffer != NULL); +- +- memcpy(outDirBuffer, dir1, dir1Size); +- outDirBuffer[dir1Size] = '\0'; ++ { const size_t dir1Size = strlen(dir1); ++ const size_t dir2Size = strlen(dir2); ++ char *outDirBuffer, *buffer; ++ ++ outDirBuffer = (char *) malloc(dir1Size + dir2Size + 2); ++ CONTROL(outDirBuffer != NULL); ++ ++ memcpy(outDirBuffer, dir1, dir1Size); ++ outDirBuffer[dir1Size] = '\0'; ++ ++ if (dir2[0] == '.') ++ return outDirBuffer; ++ ++ buffer = outDirBuffer + dir1Size; ++ if (dir1Size > 0 && *(buffer - 1) != PATH_SEP) { ++ *buffer = PATH_SEP; ++ buffer++; ++ } ++ memcpy(buffer, dir2, dir2Size); ++ buffer[dir2Size] = '\0'; + +- if (dir2[0] == '.') + return outDirBuffer; +- +- buffer = outDirBuffer + dir1Size; +- trailingChar = *(buffer - 1); +- if (trailingChar != PATH_SEP) { +- *buffer = PATH_SEP; +- buffer++; + } +- memcpy(buffer, dir2, dir2Size); +- buffer[dir2Size] = '\0'; +- +- return outDirBuffer; + } + + /* this function will return NULL if input srcFileName is not valid name for mirrored output path */ diff --git a/baselibs.conf b/baselibs.conf new file mode 100644 index 0000000..979fc7d --- /dev/null +++ b/baselibs.conf @@ -0,0 +1,6 @@ +libzstd1 + obsoletes "libzstd- < " + provides "libzstd- = " +libzstd-devel + requires -libzstd- + requires "libzstd1- = " diff --git a/pzstd.1.patch b/pzstd.1.patch new file mode 100644 index 0000000..49e0b87 --- /dev/null +++ b/pzstd.1.patch @@ -0,0 +1,17 @@ +Index: zstd-1.4.7/programs/zstd.1 +=================================================================== +--- zstd-1.4.7.orig/programs/zstd.1 ++++ zstd-1.4.7/programs/zstd.1 +@@ -223,6 +223,12 @@ Using environment variables to set param + .P + They can both be overridden by corresponding command line arguments: \fB\-#\fR for compression level and \fB\-T#\fR for number of compression threads\. + . ++.SH Parallel Zstd OPTIONS ++Additional options for the pzstd utility ++.TP ++.BR \-p ", " --processes ++ number of threads to use for (de)compression (default:4) ++. + .SH "DICTIONARY BUILDER" + \fBzstd\fR offers \fIdictionary\fR compression, which greatly improves efficiency on small files and messages\. It\'s possible to train \fBzstd\fR with a set of samples, the result of which is saved into a file called a \fBdictionary\fR\. Then during compression and decompression, reference the same dictionary, using command \fB\-D dictionaryFileName\fR\. Compression of small files similar to the sample set will be greatly improved\. + . diff --git a/zstd-1.5.0.tar.gz.sig b/zstd-1.5.0.tar.gz.sig new file mode 100644 index 0000000..d744408 --- /dev/null +++ b/zstd-1.5.0.tar.gz.sig @@ -0,0 +1,17 @@ +-----BEGIN PGP SIGNATURE----- + +iQJFBAADCAAvFiEETvSsY0VfyfRUXZt974/plSi1L/0FAmCetpsRHHNpZ25pbmdA +enN0ZC5uZXQACgkQ74/plSi1L/35IA/+K6cAjoErVr92dvObAAtXpel+5VBixWjE +fxC7c5PDc4iU/KX4I3Jy9UqaM89roYil0C80K69/5NUIYksr6KZ+Ky+8nNrfmJtn +bbXDF5xEpHuYZl3+0YQaRx85R+bVfe7Zg5BK9JiqRBAQ5ViQBtIeV8Qm52e9Y2qM +zqEqzOWQKnDQITry0vOntl2YDrNOt/LkL0g8jqJpgjpOaCeITbHelg4iH+GZswTo +Nzm4CKqtW6pmdiIfw8s4+/2jzjeGx4WqfoXgn/NHu00pbGjL7o5A0Aa97PX1qIrN +kj9edtt5yOcq68FqZvDnJLS72z1E/RbHabmqUH/gXhK80t/FA0OeB/Cqk8HheN8F +V5nXsJCjbLuu0uCRmdwWAqFK4yCBcEfC6zDs/K2kXdJsZ7sU9sACwRhOGp3JkUyB +9u17n3qLBlNcK13/1t7EJZ3F5hv+uXwfbttSSkKZ81b10S6+KgD7L0sVZT8HpUEO +B+uf3mxII/HU08AV1oAq9B12tJvcP9i/hNHCEmb11PMMVbXuIrBlE1Tcb8nB+Jlr +t9NL+lYdkZ36zxqZO7FVPoUSloPDWVRfaATY0Bde6DI27yCQzMV8XJ8a8+4yrrSN +Yybb2AJMvumP6vf1NZ1rwR84/ZjntCOM5B9KCKJE1IY5usRWAXP0Y447xPPKo/eZ +W/aDitqa1N8= +=BVY7 +-----END PGP SIGNATURE----- diff --git a/zstd.changes b/zstd.changes new file mode 100644 index 0000000..e0dfb78 --- /dev/null +++ b/zstd.changes @@ -0,0 +1,299 @@ +* Tue Mar 21 2023 ali.abdallah@suse.com +- Fix CVE-2022-4899, bsc#1209533 + * Fix buffer underflow when dir1 == "" + * Disallow empty string as an argument for --output-dir-flat="" + and --output-dir-mirror="". +- Added patches: + * Disallow-empty-output-directory.patch + * Fix-buffer-underflow-for-null-dir1.patch +* Fri Nov 26 2021 ali.abdallah@suse.com +- Update to version 1.5.0 (jsc#SLE-20392) + * https://github.com/facebook/zstd/releases/tag/v1.5.0 + * Improved Middle-Level Compression Speed + * Improved High-Level Compression Ratio + * Faster Decompression Speed + * Dynamic Library Supports Multithreading by Default +* Thu Mar 4 2021 bwiedemann@suse.com +- Update to version 1.4.9 + * https://github.com/facebook/zstd/releases/tag/v1.4.9 + * >2x Faster Long Distance Mode + * New Experimental Decompression Feature: ZSTD_d_refMultipleDDicts + * bug: Use umask() to Constrain Created File Permissions + * bug: Make Simple Single-Pass Functions Ignore Advanced Parameters + * cli: Fix --output-dir-mirror's Rejection of ..-Containing Paths + * cli: Allow Input From Console When -f/--force is Passed +* Fri Jan 22 2021 bwiedemann@suse.com +- Add libzstd-devel-32bit (boo#1181272) +* Sat Dec 19 2020 bwiedemann@suse.com +- Update to version 1.4.8 to fix i586+s390x +* Thu Dec 17 2020 bwiedemann@suse.com +- Update to version 1.4.7 + * Improved --long mode + * --long now automatically enabled for any window size >= 128MB + * Faster decompression of small blocks + * CLI improvements + + accept parameter through environment variable ZSTD_NBTHREADS + + new command --output-dir-mirror + + more accurate warning and error messages + * New experimental features + + Shared Thread Pool + + Faster Dictionary Compression + + New Sequence Ingestion API + * Drop upstream fix-lib-build.patch +* Wed Jul 8 2020 mliska@suse.cz +- Remove not needed exports in %%install section. +* Wed Jul 8 2020 mliska@suse.cz +- Use %%make_build macro. +- Add upstream patch fix-lib-build.patch which fixes lib-mt target. +* Fri May 22 2020 idonmez@suse.com +- Update to version 1.4.5 + * perf: Improved decompression speed (x64 >+5%%, ARM >+15%%) + * perf: Automatically downsizes ZSTD_DCtx when too large for too + * perf: Improved fast compression speed on aarch64 (#2040, ~+3%%) + * perf: Small level 1 compression speed gains (depending on compiler) + * fix: Compression ratio regression on huge files (> 3 GB) using high + levels (--ultra) and multithreading + * api: ZDICT_finalizeDictionary() is promoted to stable + * api: new experimental parameter ZSTD_d_stableOutBuffer + * cli: New --patch-from command, create and apply patches from files + * cli: --filelist= : Provide a list of files to operate upon from a file + * cli: -b can now benchmark multiple files in decompression mode + * cli: New --no-content-size command + * cli: New --show-default-cparams command + * misc: new diagnosis tool, checked_flipped_bits, in contrib/ + * misc: Extend largeNbDicts benchmark to compression + * misc: experimental edit-distance match finder in contrib/ +* Tue Nov 5 2019 idonmez@suse.com +- Update to version 1.4.4 + * perf: Improved decompression speed, by > 10%% + * perf: Better compression speed when re-using a context + * perf: Fix compression ratio when compressing large files with + small dictionary + * perf: zstd reference encoder can generate RLE blocks + * perf: minor generic speed optimization + * api: new ability to extract sequences from the parser for analysis + * api: fixed decoding of magic-less frames + * api: fixed ZSTD_initCStream_advanced() performance with fast modes + * cli: Named pipes support + * cli: short tar's extension support + * cli: command --output-dir-flat=DIE , generates target files into + requested directory + * cli: commands --stream-size=# and --size-hint=# + * cli: command --exclude-compressed + * cli: faster -t test mode + * cli: improved some error messages + * cli: fix rare deadlock condition within dictionary builder + * misc: Improved documentation : ZSTD_CLEVEL, DYNAMIC_BMI2, + ZSTD_CDict, function deprecation, zstd format + * misc: fixed educational decoder : accept larger literals section, + and removed UNALIGNED() macro +- Refresh pzstd.1.patch +* Tue Aug 20 2019 idonmez@suse.com +- Update to version 1.4.3 + * bug: Fix Dictionary Compression Ratio Regression (#1709) + * bug: Fix Buffer Overflow in v0.3 Decompression (#1722) + * build: Add support for IAR C/C++ Compiler for Arm (#1705) + * misc: Add NULL pointer check in util.c (#1706) +* Tue Jul 30 2019 bwiedemann@suse.com +- Add disk _constraints to fix ppc64le build +* Fri Jul 26 2019 bwiedemann@suse.com +- Update to version 1.4.2: + * bug: Fix bug in zstd-0.5 decoder by @terrelln (#1696) + * bug: Fix seekable decompression in-memory API by @iburinoc (#1695) + * bug: Close minor memory leak in CLI by @LeeYoung624 (#1701) + * misc: Validate blocks are smaller than size limit by @vivekmig (#1685) + * misc: Restructure source files by @ephiepark (#1679) +* Mon Jul 22 2019 mpluskal@suse.com +- Update to version 1.4.1: + * bug: Fix data corruption in niche use cases by @terrelln (#1659) + * bug: Fuzz legacy modes, fix uncovered bugs by @terrelln (#1593, #1594, #1595) + * bug: Fix out of bounds read by @terrelln (#1590) + * perf: Improve decode speed by ~7%% @mgrice (#1668) + * perf: Slightly improved compression ratio of level 3 and 4 (ZSTD_dfast) by @cyan4973 (#1681) + * perf: Slightly faster compression speed when re-using a context by @cyan4973 (#1658) + * perf: Improve compression ratio for small windowLog by @cyan4973 (#1624) + * perf: Faster compression speed in high compression mode for repetitive data by @terrelln (#1635) + * api: Add parameter to generate smaller dictionaries by @tyler-tran (#1656) + * cli: Recognize symlinks when built in C99 mode by @felixhandte (#1640) + * cli: Expose cpu load indicator for each file on -vv mode by @ephiepark (#1631) + * cli: Restrict read permissions on destination files by @chungy (#1644) + * cli: zstdgrep: handle -f flag by @felixhandte (#1618) + * cli: zstdcat: follow symlinks by @vejnar (#1604) + * doc: Remove extra size limit on compressed blocks by @felixhandte (#1689) + * doc: Fix typo by @yk-tanigawa (#1633) + * doc: Improve documentation on streaming buffer sizes by @cyan4973 (#1629) + * build: CMake: support building with LZ4 @leeyoung624 (#1626) + * build: CMake: install zstdless and zstdgrep by @leeyoung624 (#1647) + * build: CMake: respect existing uninstall target by @j301scott (#1619) + * build: Make: skip multithread tests when built without support by @michaelforney (#1620) + * build: Make: Fix examples/ test target by @sjnam (#1603) + * build: Meson: rename options out of deprecated namespace by @lzutao (#1665) + * build: Meson: fix build by @lzutao (#1602) + * build: Visual Studio: don't export symbols in static lib by @scharan (#1650) + * build: Visual Studio: fix linking by @absotively (#1639) + * build: Fix MinGW-W64 build by @myzhang1029 (#1600) + * misc: Expand decodecorpus coverage by @ephiepark (#1664) +* Thu Jul 11 2019 dimstar@opensuse.org +- Add baselibs.conf: libarchive gained zstd support and provides + - 32bit libraries. This means, zstd also needs to provide -32bit + libs. +* Fri Jun 14 2019 idonmez@suse.com +- Remove googletest-devel BuildRequires and pzstd-global-gtest.patch + because we want zstd in ring0 (due to rpm's zstd payload support) + Since googletest is only used in build time (it's for testing after + all), this should be fine. +* Sun Jun 2 2019 jengelh@inai.de +- Update description with 1.4.0 statistics. +* Fri Apr 26 2019 mliska@suse.cz +- Use FAT LTO objects in order to provide proper static library (boo#1133297). +* Wed Apr 17 2019 jengelh@inai.de +- Update to new upstream release 1.4.0 + * perf: level 1 compression speed was improved by ~6–8%% + * cli: added --[no-]compress-literals flag to enable or disable + literal compression +- Reword "real-time" in description by some actual statistics, + because 603MB/s (lowest zstd level) is not "real-time" for + quite some applications. +* Sat Jan 5 2019 astieger@suse.com +- zstd 1.3.8: + * better decompression speed on large files (+7%%) and cold + dictionaries (+15%%) + * slightly better compression ratio at high compression modes + * new --rsyncable mode + * support decompression of empty frames into NULL (used to be an + error) + * support ZSTD_CLEVEL environment variable + * --no-progress flag, preserving final summary + * various CLI fixes + * fix race condition in one-pass compression functions that could + allow out of bounds write (CVE-2019-11922, boo#1142941) +* Wed Oct 24 2018 astieger@suse.com +- zstd 1.3.7: + * fix ratio for dictionary compression at levels 9 and 10 + * add man pages for zstdless and zstdgrep +- includes changes from zstd 1.3.6: + * faster dictionary builder, also the new default for --train + * previous (slower, slightly higher quality) dictionary builder + to be selected via --train-cover + * Faster dictionary decompression and compression under memory + limits with many dictionaries used simultaneously + * New command --adapt for compressed network piping of data + adjusted to the perceived network conditions +- drop zstd-1.3.5-fix-list-stdin.patch, upstream +- switch from git tag snaphshot to bootstrapped tarball +* Tue Jul 3 2018 astieger@suse.com +- update to 1.3.5: + * much faster dictionary compression + * small quality improvement for dictionary generation + * slightly improved performance at high compression levels + * automatic memory release for long duration contexts + * fix overlapLog can be manually set + * fix decoding invalid lz4 frames + * fix performance degradation for dictionary compression when + using advanced API +- add zstd-1.3.5-fix-list-stdin.patch to avoid test issues with + - -list when stdin is not a tty, patch from upstream +- disable failing pzstd tests +* Thu Jun 14 2018 sweet_f_a@gmx.de +- fix pzstd tests +- add pzstd-global-gtest.patch +* Thu Jun 14 2018 sweet_f_a@gmx.de +- enable pzstd (parallel zstd) +- add pzstd.1.patch, taken from Fedora package (git 21908004) +* Thu May 24 2018 kukuk@suse.de +- Use %%license instead of %%doc [bsc#1082318] +* Wed Mar 28 2018 idonmez@suse.com +- Update to 1.3.4 + * perf: faster speed (especially decoding speed) on recent cpus + (haswell+) + * perf: much better performance associating --long with + multi-threading + * perf: better compression at levels 13-15 + * cli : asynchronous compression by default, for faster + experience (use --single-thread for former behavior) + * cli : smoother status report in multi-threading mode + * cli : added command --fast=#, for faster compression modes + * cli : fix crash when not overwriting existing files + * api : `nbThreads` becomes `nbWorkers` : 1 triggers + asynchronous mode + * api : compression levels can be negative, for even more speed + * api : ZSTD_getFrameProgression() : get precise progress + status of ZSTDMT anytime + * api : ZSTDMT can accept new compression parameters during + compression + * api : implemented all advanced dictionary decompression prototypes +* Mon Feb 5 2018 dsterba@suse.cz +- build the static library (depency for btrfsprogs-static) +* Thu Dec 21 2017 idonmez@suse.com +- Update to 1.3.3 + * perf: improved zstd_opt strategy (levels 16-19) + * fix : bug #944 : multithreading with shared ditionary and + large data, reported by @gsliepen + * cli : fix : content size written in header by default + * cli : fix : improved LZ4 format support, by @felixhandte + * cli : new : hidden command -b -S, to benchmark multiple files + and generate one result per file + * api : change : when setting pledgedSrcSize, use + ZSTD_CONTENTSIZE_UNKNOWN macro value to mean "unknown" + * api : fix : support large skippable frames, by @terrelln + * api : fix : re-using context could result in suboptimal + block size in some corner case scenarios + * api : fix : streaming interface was adding a useless + 3-bytes null block to small frames +* Sun Oct 29 2017 astieger@suse.com +- update to 1.3.2: + * new long range mode, using --long command + * new ability to generate and decode magicless frames + * changed maximum nb of threads reduced to 200, to avoid address + space exhaustion in 32-bits mode + * fix multi-threading compression works with custom allocators + * fix ZSTD_sizeof_CStream() was over-evaluating memory usage + * fix a rare compression bug when compression generates very large + distances and bunch of other conditions + (only possible at --ultra -22) + * fix 32-bits build can now decode large offsets (levels 21+) + * cli added LZ4 frame support by default + * cli improved --list output + * cli now can split input file for dictionary training, using + command -B# + * cli new clean operation artefact on Ctrl-C interruption + * do not change /dev/null permissions when using command -t with + root access + * cli fix write file size in header in multiple-files mode + * api: added macro ZSTD_COMPRESSBOUND() for static allocation + * api: new advanced decompression API + * api: sizeof_CCtx() used to over-estimate + * build: fix : no-multithread variant compiles without pool.c + dependency + * build: better compatibility with reproducible builds + * license: changed /examples license to BSD + GPLv2 + * license: fix a few header files to reflect new license +* Mon Aug 21 2017 idonmez@suse.com +- Update to v1.3.1 + * License is now BSD + GPL-2.0 + * See https://github.com/facebook/zstd/releases for the + complete changelog. +* Mon Mar 27 2017 idonmez@suse.com +- Update to v1.1.4 + See https://github.com/facebook/zstd/releases for details. +- Drop zstd-lib-no-rebuild.patch +* Wed Dec 7 2016 idonmez@suse.com +- Fix group name for the shared library +* Sun Dec 4 2016 idonmez@suse.com +- Update to version 1.1.1 + * New : cli commands -M#, --memory=, --memlimit=, + - -memlimit-decompress= to limit allowed memory consumption + during decompression + * Improved : slightly better compression ratio at --ultra levels + * Improved : better memory usage when using streaming + compression API + * Added : API : ZSTD_initCStream_usingCDict(), + ZSTD_initDStream_usingDDict() (experimental section) + * Changed : zstd_errors.h is now installed within /include + (and replaces errors_public.h) + * Fixed : several sanitizer warnings +* Sun Oct 16 2016 jengelh@inai.de +- Update descriptions +* Wed Oct 5 2016 bwiedemann@suse.com +- initial package version 1.1.0 + based on https://pbrady.fedorapeople.org/zstd.spec diff --git a/zstd.spec b/zstd.spec new file mode 100644 index 0000000..a25dc23 --- /dev/null +++ b/zstd.spec @@ -0,0 +1,124 @@ +# +# spec file for package zstd +# +# Copyright (c) 2022-2023 ZhuningOS +# + + +%define major 1 +%define libname lib%{name}%{major} +Name: zstd +Version: %{major}.5.0 +Release: 150400.3.3.1 +Summary: Zstandard compression tools +License: BSD-3-Clause AND GPL-2.0-only +Group: Productivity/Archiving/Compression +URL: https://github.com/facebook/zstd +Source0: https://github.com/facebook/zstd/releases/download/v%{version}/%{name}-%{version}.tar.gz +Source1: https://github.com/facebook/zstd/releases/download/v%{version}/%{name}-%{version}.tar.gz.sig +Source99: baselibs.conf +Patch1: pzstd.1.patch +# CVE-2022-4899 https://github.com/facebook/zstd/pull/3220 +Patch2: Disallow-empty-output-directory.patch +Patch3: Fix-buffer-underflow-for-null-dir1.patch +BuildRequires: gcc +# C++ is needed for pzstd only +BuildRequires: gcc-c++ +BuildRequires: pkgconfig + +%description +Zstd, short for Zstandard, is a lossless compression algorithm. Speed +vs. compression trade-off is configurable in small increments. +Decompression speed is preserved and remains roughly the same at all +settings, a property shared by most LZ compression algorithms, such +as zlib or lzma. + +At roughly the same ratio, zstd (v1.4.0) achieves ~870%% faster +compression than gzip. For roughly the same time, zstd achives a +~12%% better ratio than gzip. LZMA outperforms zstd by ~10%% faster +compression for same ratio, or ~1–4%% size reduction for same time. + +# This compression summary is based on https://lists.opensuse.org/opensuse-factory/2019-05/msg00344.html + +%package -n %{libname} +Summary: Zstd compression library +Group: System/Libraries + +%description -n %{libname} +Zstd, short for Zstandard, is a lossless compression algorithm, +targeting faster compression than zlib at comparable ratios. + +This subpackage contains the implementation as a shared library. + +%package -n lib%{name}-devel +Summary: Development files for the Zstd compression library +Group: Development/Libraries/C and C++ +Requires: %{libname} = %{version} +Requires: glibc-devel + +%description -n lib%{name}-devel +Zstd, short for Zstandard, is a lossless compression algorithm, +targeting faster compression than zlib at comparable ratios. + +Needed for compiling programs that link with the library. + +%package -n lib%{name}-devel-static +Summary: Development files for the Zstd compression library +Group: Development/Libraries/C and C++ +BuildRequires: glibc-devel-static +Requires: lib%{name}-devel = %{version} + +%description -n lib%{name}-devel-static +Zstd, short for Zstandard, is a lossless compression algorithm, +targeting faster compression than zlib at comparable ratios. + +Needed for compiling programs that link with the library. + +%prep +%autosetup -p1 + +%build +%global _lto_cflags %{_lto_cflags} -ffat-lto-objects +export CFLAGS="%{optflags}" +export CXXFLAGS="%{optflags} -std=c++11" +# lib-mt is alias for multi-threaded library support +%make_build -C lib lib-mt +for dir in programs contrib/pzstd; do + %make_build -C "$dir" +done + +%check +export CFLAGS="%{optflags}" +export CXXFLAGS="%{optflags} -std=c++11" +%make_build -C tests test-zstd +#make %{?_smp_mflags} -C contrib/pzstd test-pzstd + +%install +%make_install V=1 VERBOSE=1 PREFIX=%{_prefix} LIBDIR=%{_libdir} +install -D -m755 contrib/pzstd/pzstd %{buildroot}%{_bindir}/pzstd +install -D -m644 programs/zstd.1 %{buildroot}%{_mandir}/man1/pzstd.1 + +%files +%license COPYING LICENSE +%doc README.md CHANGELOG +%{_bindir}/* +%{_mandir}/man1/*.1%{?ext_man} + +%files -n %{libname} +%license COPYING LICENSE +%{_libdir}/libzstd.so.* + +%files -n lib%{name}-devel +%license COPYING LICENSE +%{_includedir}/*.h +%{_libdir}/pkgconfig/libzstd.pc +%{_libdir}/libzstd.so + +%files -n lib%{name}-devel-static +%license COPYING LICENSE +%{_libdir}/libzstd.a + +%post -n %{libname} -p /sbin/ldconfig +%postun -n %{libname} -p /sbin/ldconfig + +%changelog