]> git.ipfire.org Git - thirdparty/zstd.git/log
thirdparty/zstd.git
2 years agoadded a Clang-CL Windows test to CI 3579/head
Yann Collet [Wed, 29 Mar 2023 00:37:23 +0000 (17:37 -0700)] 
added a Clang-CL Windows test to CI

If I understand correctly,
this should trigger the issue notified in #3569.

2 years agoMerge pull request #3569 from tru/linker_flag_fix
Yann Collet [Wed, 29 Mar 2023 05:05:07 +0000 (22:05 -0700)] 
Merge pull request #3569 from tru/linker_flag_fix

Disable linker flag detection on MSVC/ClangCL.

2 years agoMerge pull request #3573 from facebook/dependabot/github_actions/github/codeql-action...
Yann Collet [Tue, 28 Mar 2023 23:59:41 +0000 (16:59 -0700)] 
Merge pull request #3573 from facebook/dependabot/github_actions/github/codeql-action-2.2.8

Bump github/codeql-action from 2.2.6 to 2.2.8

2 years agommap for windows (#3557)
daniellerozenblit [Tue, 28 Mar 2023 23:44:53 +0000 (19:44 -0400)] 
mmap for windows (#3557)

* mmap for windows

* remove enabling mmap for testing

* rename FIO dictionary initialization methods + un-const dictionary objects in free functions

* remove enabling mmap for testing

* initDict returns void, underlying setDictBuffer methods return the size of the set buffer

* fix comment

2 years agoMerge pull request #3551 from embg/seq_prod_fuzz
Elliot Gorokhovsky [Tue, 28 Mar 2023 21:20:54 +0000 (14:20 -0700)] 
Merge pull request #3551 from embg/seq_prod_fuzz

Provide an interface for fuzzing sequence producer plugins

2 years agoProvide an interface for fuzzing sequence producer plugins 3551/head
Elliot Gorokhovsky [Tue, 14 Mar 2023 16:40:53 +0000 (09:40 -0700)] 
Provide an interface for fuzzing sequence producer plugins

2 years agoMerge pull request #3568 from facebook/readme_cmake_fat
Yann Collet [Tue, 28 Mar 2023 17:48:39 +0000 (10:48 -0700)] 
Merge pull request #3568 from facebook/readme_cmake_fat

Add instructions for building Universal2 on macOS via CMake

2 years agoMerge pull request #3574 from felixhandte/pzstd-max-cpp-std
Felix Handte [Mon, 27 Mar 2023 23:44:07 +0000 (16:44 -0700)] 
Merge pull request #3574 from felixhandte/pzstd-max-cpp-std

[contrib/pzstd] Detect and Select Maximum Available C++ Standard

2 years agoSwitch Strategies: Only Set `-std=c++11` When Default is Older 3574/head
W. Felix Handte [Mon, 27 Mar 2023 22:37:19 +0000 (18:37 -0400)] 
Switch Strategies: Only Set `-std=c++11` When Default is Older

2 years agoUpdate README.md 3568/head
Yann Collet [Mon, 27 Mar 2023 16:09:22 +0000 (09:09 -0700)] 
Update README.md

fix minor doc mistake (`ninja build` doesn't work)

2 years agoMerge pull request #3570 from facebook/rsync_doc
Yann Collet [Mon, 27 Mar 2023 16:07:13 +0000 (09:07 -0700)] 
Merge pull request #3570 from facebook/rsync_doc

[easy] minor doc update for --rsyncable

2 years ago[contrib/pzstd] Detect and Select Maximum Available C++ Standard
W. Felix Handte [Mon, 27 Mar 2023 15:24:47 +0000 (11:24 -0400)] 
[contrib/pzstd] Detect and Select Maximum Available C++ Standard

Rather than remove the flag entirely, as proposed in #3499, this commit uses
the newest C++ standard the compiler supports. This retains the selection of
using only standardized features (excluding GNU extensions) and keeps the
recency requirements of the codebase explicit.

Tested with various versions of `g++` and `clang++`.

2 years agoMerge pull request #3572 from facebook/dependabot/github_actions/actions/checkout...
Yann Collet [Mon, 27 Mar 2023 14:07:55 +0000 (07:07 -0700)] 
Merge pull request #3572 from facebook/dependabot/github_actions/actions/checkout-3.5.0

Bump actions/checkout from 3.3.0 to 3.5.0

2 years agoBump github/codeql-action from 2.2.6 to 2.2.8 3573/head
dependabot[bot] [Mon, 27 Mar 2023 06:06:11 +0000 (06:06 +0000)] 
Bump github/codeql-action from 2.2.6 to 2.2.8

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.2.6 to 2.2.8.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/16964e90ba004cdf0cd845b866b5df21038b7723...67a35a08586135a9573f4327e904ecbf517a882d)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years agoBump actions/checkout from 3.3.0 to 3.5.0 3572/head
dependabot[bot] [Mon, 27 Mar 2023 06:06:05 +0000 (06:06 +0000)] 
Bump actions/checkout from 3.3.0 to 3.5.0

Bumps [actions/checkout](https://github.com/actions/checkout) from 3.3.0 to 3.5.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/ac593985615ec2ede58e132d2e21d2b1cbd6127c...8f4b7f84864484a7bf31766abe9204da3cbe65b3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years agominor doc update on --rsyncable 3570/head
Yann Collet [Thu, 23 Mar 2023 09:05:13 +0000 (03:05 -0600)] 
minor doc update on --rsyncable

as requested by @devZer0.
fix #3567

2 years agoMerge branch 'readme_cmake_fat' of github.com:facebook/zstd into readme_cmake_fat
Rick Mark [Thu, 23 Mar 2023 16:44:06 +0000 (09:44 -0700)] 
Merge branch 'readme_cmake_fat' of github.com:facebook/zstd into readme_cmake_fat

2 years agoAdd instructions for building Universal2 on macOS via CMake
Rick Mark [Wed, 22 Mar 2023 18:28:03 +0000 (11:28 -0700)] 
Add instructions for building Universal2 on macOS via CMake

2 years agoDisable linker flag detection on MSVC/ClangCL. 3569/head
Tobias Hieta [Wed, 22 Mar 2023 21:13:57 +0000 (22:13 +0100)] 
Disable linker flag detection on MSVC/ClangCL.

This fixes compilation with clang-cl on Windows. There
is a bug in cmake so that check_linker_flag() doesn't give
the correct result when using link.exe/lld-link.exe.

Details in CMake's gitlab: https://gitlab.kitware.com/cmake/cmake/-/issues/22023

Fixes #3522

2 years agoAdd instructions for building Universal2 on macOS via CMake
Rick Mark [Wed, 22 Mar 2023 18:28:03 +0000 (11:28 -0700)] 
Add instructions for building Universal2 on macOS via CMake

2 years agofix window update (#3556)
daniellerozenblit [Tue, 21 Mar 2023 17:28:26 +0000 (13:28 -0400)] 
fix window update (#3556)

2 years ago[lazy] Skip over incompressible data
Nick Terrell [Fri, 10 Mar 2023 01:26:07 +0000 (17:26 -0800)] 
[lazy] Skip over incompressible data

Every 256 bytes the lazy match finders process without finding a match,
they will increase their step size by 1. So for bytes [0, 256) they search
every position, for bytes [256, 512) they search every other position,
and so on. However, they currently still insert every position into
their hash tables. This is different from fast & dfast, which only
insert the positions they search.

This PR changes that, so now after we've searched 2KB without finding
any matches, at which point we'll only be searching one in 9 positions,
we'll stop inserting every position, and only insert the positions we
search. The exact cutoff of 2KB isn't terribly important, I've just
selected a cutoff that is reasonably large, to minimize the impact on
"normal" data.

This PR only adds skipping to greedy, lazy, and lazy2, but does not
touch btlazy2.

| Dataset | Level | Compiler     | CSize ∆ | Speed ∆ |
|---------|-------|--------------|---------|---------|
| Random  |     5 | clang-14.0.6 |    0.0% |   +704% |
| Random  |     5 | gcc-12.2.0   |    0.0% |   +670% |
| Random  |     7 | clang-14.0.6 |    0.0% |   +679% |
| Random  |     7 | gcc-12.2.0   |    0.0% |   +657% |
| Random  |    12 | clang-14.0.6 |    0.0% |  +1355% |
| Random  |    12 | gcc-12.2.0   |    0.0% |  +1331% |
| Silesia |     5 | clang-14.0.6 | +0.002% |  +0.35% |
| Silesia |     5 | gcc-12.2.0   | +0.002% |  +2.45% |
| Silesia |     7 | clang-14.0.6 | +0.001% |  -1.40% |
| Silesia |     7 | gcc-12.2.0   | +0.007% |  +0.13% |
| Silesia |    12 | clang-14.0.6 | +0.011% | +22.70% |
| Silesia |    12 | gcc-12.2.0   | +0.011% |  -6.68% |
| Enwik8  |     5 | clang-14.0.6 |    0.0% |  -1.02% |
| Enwik8  |     5 | gcc-12.2.0   |    0.0% |  +0.34% |
| Enwik8  |     7 | clang-14.0.6 |    0.0% |  -1.22% |
| Enwik8  |     7 | gcc-12.2.0   |    0.0% |  -0.72% |
| Enwik8  |    12 | clang-14.0.6 |    0.0% | +26.19% |
| Enwik8  |    12 | gcc-12.2.0   |    0.0% |  -5.70% |

The speed difference for clang at level 12 is real, but is probably
caused by some sort of alignment or codegen issues. clang is
significantly slower than gcc before this PR, but gets up to parity with
it.

I also measured the ratio difference for the HC match finder, and it
looks basically the same as the row-based match finder. The speedup on
random data looks similar. And performance is about neutral, without the
big difference at level 12 for either clang or gcc.

2 years agoSimplify line splitting in the CLI tests
Peter Pentchev [Sat, 18 Mar 2023 20:43:56 +0000 (22:43 +0200)] 
Simplify line splitting in the CLI tests

2 years agoFix a Python bytes/int mismatch in CLI tests
Peter Pentchev [Sat, 18 Mar 2023 20:32:42 +0000 (22:32 +0200)] 
Fix a Python bytes/int mismatch in CLI tests

In Python 3.x, a single element of a bytes array is returned as
an integer number. Thus, NEWLINE is an int variable, and attempting
to add it to the line array will fail with a type mismatch error
that may be demonstrated as follows:

    [roam@straylight ~]$ python3 -c 'b"hello" + b"\n"[0]'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    TypeError: can't concat int to bytes
    [roam@straylight ~]$

2 years agoMerge pull request #3553 from facebook/ldm_dict
Yann Collet [Thu, 16 Mar 2023 18:20:32 +0000 (11:20 -0700)] 
Merge pull request #3553 from facebook/ldm_dict

added documentation for LDM + dictionary compatibility

2 years agoDeprecated bufferless and block level APIs
Nick Terrell [Tue, 24 Jan 2023 20:21:49 +0000 (12:21 -0800)] 
Deprecated bufferless and block level APIs

* Mark all bufferless and block level functions as deprecated
* Update documentation to suggest not using these functions
* Add `_deprecated()` wrappers for functions that we use internally and
  call those instead

2 years agopatch-from speed optimization (#3545)
daniellerozenblit [Wed, 15 Mar 2023 00:36:56 +0000 (20:36 -0400)] 
patch-from speed optimization (#3545)

* patch-from speed optimization: only load portion of dictionary into normal matchfinders

* test regression for x8 multiplier

* fix off-by-one error for bit shift bound

* restrict patchfrom speed optimization to strategy < ZSTD_btultra

* update results.csv

* update regression test

2 years agoadded documentation for LDM + dictionary compatibility 3553/head
Yann Collet [Wed, 15 Mar 2023 00:17:21 +0000 (17:17 -0700)] 
added documentation for LDM + dictionary compatibility

2 years agoMerge pull request #3547 from facebook/seekable_doc
Yann Collet [Tue, 14 Mar 2023 03:25:58 +0000 (20:25 -0700)] 
Merge pull request #3547 from facebook/seekable_doc

added documentation for the seekable format

2 years agoAdd salt into row hash (#3528 part 2) (#3533)
Yonatan Komornik [Mon, 13 Mar 2023 22:34:13 +0000 (15:34 -0700)] 
Add salt into row hash (#3528 part 2) (#3533)

Part 2 of #3528

Adds hash salt that helps to avoid regressions where consecutive compressions use the same tag space with similar data (running zstd -b5e7 enwik8 -B128K reproduces this regression).

2 years agoAdd init once memory (#3528) (#3529)
Yonatan Komornik [Mon, 13 Mar 2023 20:20:49 +0000 (13:20 -0700)] 
Add init once memory (#3528) (#3529)

- Adds memory type that is guaranteed to have been initialized at least once in the workspace's lifetime.
- Changes tag space in row hash to be based on init once memory.

2 years agoBump github/codeql-action from 2.2.5 to 2.2.6 (#3549)
dependabot[bot] [Mon, 13 Mar 2023 17:07:20 +0000 (10:07 -0700)] 
Bump github/codeql-action from 2.2.5 to 2.2.6 (#3549)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.2.5 to 2.2.6.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/32dc499307d133bb5085bae78498c0ac2cf762d5...16964e90ba004cdf0cd845b866b5df21038b7723)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years ago[Bugfix] row hash tries to match position 0 (#3548)
Yonatan Komornik [Mon, 13 Mar 2023 17:00:03 +0000 (10:00 -0700)] 
[Bugfix] row hash tries to match position 0 (#3548)

#3543 decreases the size of the tagTable by a factor of 2, which requires using the first tag position in each row for head position instead of a tag.
Although position 0 stopped being a valid match, it still persisted in mask calculation resulting in the matches loops possibly terminating before it should have. The fix skips position 0 to solve this problem.

2 years agoadded documentation for the seekable format 3547/head
Yann Collet [Fri, 10 Mar 2023 23:54:31 +0000 (15:54 -0800)] 
added documentation for the seekable format

and notably provide additional context for the
Maximum Frame Size parameter.

requested by @P-E-Meunier
at https://github.com/facebook/zstd/commit/1df9f36c6c6cea08778d45a4adaf60e2433439a3#commitcomment-103856979.

2 years agoReduce RowHash's tag space size by x2 (#3543)
Yonatan Komornik [Fri, 10 Mar 2023 22:15:04 +0000 (14:15 -0800)] 
Reduce RowHash's tag space size by x2 (#3543)

Allocate half the memory for tag space, which means that we get one less slot for an actual tag (needs to be used for next position index).
The results is a slight loss in compression ratio (up to 0.2%) and some regressions/improvements to speed depending on level and sample. In turn, we get to save 16% of the hash table's space (5 bytes per entry instead of 6 bytes per entry).

2 years agoMerge pull request #3544 from facebook/seek_faster
Yann Collet [Fri, 10 Mar 2023 20:33:33 +0000 (12:33 -0800)] 
Merge pull request #3544 from facebook/seek_faster

Improved seekable format ingestion speed for small frame size

2 years agoImproved seekable format ingestion speed for small frame size 3544/head
Yann Collet [Fri, 10 Mar 2023 01:48:35 +0000 (17:48 -0800)] 
Improved seekable format ingestion speed for small frame size

As reported by @P-E-Meunier in https://github.com/facebook/zstd/issues/2662#issuecomment-1443836186,
seekable format ingestion speed can be particularly slow
when selected `FRAME_SIZE` is very small,
especially in combination with the recent row_hash compression mode.
The specific scenario mentioned was `pijul`,
using frame sizes of 256 bytes and level 10.

This is improved in this PR,
by providing approximate parameter adaptation to the compression process.

Tested locally on a M1 laptop,
ingestion of `enwik8` using `pijul` parameters
went from 35sec. (before this PR) to 2.5sec (with this PR).
For the specific corner case of a file full of zeroes,
this is even more pronounced, going from 45sec. to 0.5sec.

These benefits are unrelated to (and come on top of) other improvement efforts currently being made by @yoniko for the row_hash compression method specifically.

The `seekable_compress` test program has been updated to allows setting compression level,
in order to produce these performance results.

2 years agoMerge pull request #3542 from felixhandte/pin-moar-action-deps
Felix Handte [Fri, 10 Mar 2023 00:22:11 +0000 (16:22 -0800)] 
Merge pull request #3542 from felixhandte/pin-moar-action-deps

Pin Moar Action Dependencies

2 years agoAlso Pin Dockerfile Dependency Hashes 3542/head
W. Felix Handte [Thu, 9 Mar 2023 22:01:22 +0000 (17:01 -0500)] 
Also Pin Dockerfile Dependency Hashes

2 years agoMerge pull request #3541 from felixhandte/fix-setvbuf-segfault
Felix Handte [Thu, 9 Mar 2023 21:54:11 +0000 (13:54 -0800)] 
Merge pull request #3541 from felixhandte/fix-setvbuf-segfault

Avoid Segfault Caused by Calling `setvbuf()` on Null File Pointer

2 years agoMerge pull request #3526 from facebook/bench_zstd_api
Yann Collet [Thu, 9 Mar 2023 21:11:11 +0000 (13:11 -0800)] 
Merge pull request #3526 from facebook/bench_zstd_api

Simplify benchmark unit invocation API from CLI

2 years agoMerge pull request #3538 from facebook/doc_huffman
Yann Collet [Thu, 9 Mar 2023 21:09:42 +0000 (13:09 -0800)] 
Merge pull request #3538 from facebook/doc_huffman

added clarifications for sizes of compressed huffman blocks and streams.

2 years agoMerge pull request #3486 from daniellerozenblit/patch-from-low-memory-mode
daniellerozenblit [Thu, 9 Mar 2023 20:30:09 +0000 (15:30 -0500)] 
Merge pull request #3486 from daniellerozenblit/patch-from-low-memory-mode

Mmap large dictionaries in patch-from mode

2 years agoClarify dstCapacity requirements
Nick Terrell [Tue, 7 Mar 2023 23:42:51 +0000 (15:42 -0800)] 
Clarify dstCapacity requirements

Clarify `dstCapacity` requirements for single-pass functions.

Fixes #3524.

2 years agoPin Moar Action Dependencies
W. Felix Handte [Thu, 9 Mar 2023 17:54:07 +0000 (12:54 -0500)] 
Pin Moar Action Dependencies

An offering to the Scorecard gods, may they have mercy on our souls.

2 years agoAdd CLI Test 3541/head
W. Felix Handte [Thu, 9 Mar 2023 17:48:11 +0000 (12:48 -0500)] 
Add CLI Test

2 years agoAvoid Calling `setvbuf()` on Null File Pointer
W. Felix Handte [Thu, 9 Mar 2023 17:47:40 +0000 (12:47 -0500)] 
Avoid Calling `setvbuf()` on Null File Pointer

2 years agoFix Python 3.6 Incompatibility in CLI Tests
W. Felix Handte [Thu, 9 Mar 2023 17:46:37 +0000 (12:46 -0500)] 
Fix Python 3.6 Incompatibility in CLI Tests

2 years agoassert to ensure that dict buffer type is valid 3486/head
Danielle Rozenblit [Thu, 9 Mar 2023 00:54:57 +0000 (16:54 -0800)] 
assert to ensure that dict buffer type is valid

2 years agoadded clarifications for sizes of compressed huffman blocks and streams. 3538/head
Yann Collet [Wed, 8 Mar 2023 23:30:27 +0000 (15:30 -0800)] 
added clarifications for sizes of compressed huffman blocks and streams.

2 years agoAdd ZSTD_set{C,F,}Params() helper functions
Nick Terrell [Tue, 7 Mar 2023 23:15:40 +0000 (15:15 -0800)] 
Add ZSTD_set{C,F,}Params() helper functions

* Add ZSTD_setFParams() and ZSTD_setParams()
* Modify ZSTD_setCParams() to use ZSTD_setParameter() to avoid a second path setting parameters
* Add unit tests
* Update documentation to suggest using them to replace deprecated functions

Fixes #3396.

2 years agoability to disable mmap + struct to manage FIO dictionary
Danielle Rozenblit [Wed, 8 Mar 2023 16:06:10 +0000 (08:06 -0800)] 
ability to disable mmap + struct to manage FIO dictionary

2 years ago[linux-kernel] Fix assert definition
Nick Terrell [Tue, 7 Mar 2023 23:47:36 +0000 (15:47 -0800)] 
[linux-kernel] Fix assert definition

Backport upstream fix of the assert definition. This code is currently unused, and can be enabled for testing, which is why it wasn't caught.

https://lore.kernel.org/lkml/20230129131436.1343228-1-j.neuschaefer@gmx.net/

2 years agoAdds initialization of clevel to static cdict (#3525) (#3527)
Yonatan Komornik [Tue, 7 Mar 2023 02:05:12 +0000 (18:05 -0800)] 
Adds initialization of clevel to static cdict (#3525) (#3527)

- Initializes clevel in `ZSTD_CCtxParams_init`
- Adds CI workflow for msan fuzzers runs without optimization (`-O0`)
- Fixes Makefile to correctly pass on user defined `MOREFLAGS` and `FUZZER_FLAGS` in cases they have been overwritten

2 years agosimplified BMK_benchFilesAdvanced() 3526/head
Yann Collet [Mon, 6 Mar 2023 20:34:13 +0000 (12:34 -0800)] 
simplified BMK_benchFilesAdvanced()

2 years agominor: fixed zlib wrapper internal benchmark
Yann Collet [Mon, 6 Mar 2023 20:20:06 +0000 (12:20 -0800)] 
minor: fixed zlib wrapper internal benchmark

another possibility could be to link it to programs/benchfn .
Not worth the effort.

2 years agosimplify BMK_syntheticTest()
Yann Collet [Mon, 6 Mar 2023 20:15:22 +0000 (12:15 -0800)] 
simplify BMK_syntheticTest()

2 years agoMerge pull request #3516 from dloidolt/fullbench_2_files
Yann Collet [Mon, 6 Mar 2023 19:56:30 +0000 (11:56 -0800)] 
Merge pull request #3516 from dloidolt/fullbench_2_files

fullbench with two files

2 years agoBump github/codeql-action from 2.2.4 to 2.2.5 (#3518)
dependabot[bot] [Thu, 2 Mar 2023 18:44:06 +0000 (10:44 -0800)] 
Bump github/codeql-action from 2.2.4 to 2.2.5 (#3518)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.2.4 to 2.2.5.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/17573ee1cc1b9d061760f3a006fc4aac4f944fd5...32dc499307d133bb5085bae78498c0ac2cf762d5)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years agoMerge pull request #3513 from DimitriPapadopoulos/codespell
Yann Collet [Mon, 27 Feb 2023 19:44:31 +0000 (11:44 -0800)] 
Merge pull request #3513 from DimitriPapadopoulos/codespell

Fix typos found by codespell

2 years agoMerge pull request #3514 from facebook/spec_huffman
Yann Collet [Thu, 23 Feb 2023 23:35:00 +0000 (15:35 -0800)] 
Merge pull request #3514 from facebook/spec_huffman

Clarify zstd specification for Huffman blocks

2 years ago[bug-fix] Fix rare corruption bug affecting the block splitter
Nick Terrell [Wed, 22 Feb 2023 22:49:08 +0000 (14:49 -0800)] 
[bug-fix] Fix rare corruption bug affecting the block splitter

The block splitter confuses sequences with literal length == 65536 that use a
repeat offset code. It interprets this as literal length == 0 when deciding the
meaning of the repeat offset, and corrupts the repeat offset history. This is
benign, merely causing suboptimal compression performance, if the confused
history is flushed before the end of the block, e.g. if there are 3 consecutive
non-repeat code sequences after the mistake. It also is only triggered if the
block splitter decided to split the block.

All that to say: This is a rare bug, and requires quite a few conditions to
trigger. However, the good news is that if you have a way to validate that the
decompressed data is correct, e.g. you've enabled zstd's checksum or have a
checksum elsewhere, the original data is very likely recoverable. So if you were
affected by this bug please reach out.

The fix is to remind the block splitter that the literal length is actually 64K.
The test case is a bit tricky to set up, but I've managed to reproduce the issue.

Thanks to @danlark1 for alerting us to the issue and providing us a reproducer!

2 years agoWhen benchmarking two files with fullbench, the second file will not be benchmarked... 3516/head
Dominik Loidolt [Mon, 20 Feb 2023 15:36:26 +0000 (16:36 +0100)] 
When benchmarking two files with fullbench, the second file will not be benchmarked because the benchNb has not been reset to zero.

2 years agoclarify zstd specification for Huffman blocks 3514/head
Yann Collet [Sun, 19 Feb 2023 02:16:00 +0000 (18:16 -0800)] 
clarify zstd specification for Huffman blocks

Following detailed comments from @dweiller in #3508.

2 years agoFix typos found by codespell 3513/head
Dimitri Papadopoulos [Sat, 18 Feb 2023 09:30:23 +0000 (10:30 +0100)] 
Fix typos found by codespell

2 years agoMerge pull request #3490 from eli-schwartz/meson-tests-noprograms
Yann Collet [Thu, 16 Feb 2023 19:27:27 +0000 (11:27 -0800)] 
Merge pull request #3490 from eli-schwartz/meson-tests-noprograms

meson: always build the zstd binary when tests are enabled

2 years agoDon't require CMake 3.18 or later
Sutou Kouhei [Tue, 14 Feb 2023 21:38:50 +0000 (06:38 +0900)] 
Don't require CMake 3.18 or later

fix #3500

CMake 3.18 or later was required by #3392. Because it uses
`CheckLinkerFlag`. But requiring CMake 3.18 or later is a bit
aggressive. Because Ubuntu 20.04 LTS still uses CMake 3.16.3:
https://packages.ubuntu.com/search?keywords=cmake

This change disables `-z noexecstack` check with old CMake. This will
not break any existing users. Because users who need `-z noexecstack`
must already use CMake 3.18 or later.

2 years agoMerge pull request #3479 from felixhandte/faster-file-ops
Felix Handte [Thu, 16 Feb 2023 18:07:34 +0000 (13:07 -0500)] 
Merge pull request #3479 from felixhandte/faster-file-ops

Use `f`-variants of `chmod()` and `chown()`

2 years agoMerge pull request #3511 from felixhandte/fix-release-artifact-upload-permission
Felix Handte [Wed, 15 Feb 2023 18:35:04 +0000 (13:35 -0500)] 
Merge pull request #3511 from felixhandte/fix-release-artifact-upload-permission

Fix Permissions on Publish Release Artifacts Job

2 years agoMerge pull request #3509 from daniellerozenblit/fix-window-resize-test
daniellerozenblit [Wed, 15 Feb 2023 18:32:07 +0000 (13:32 -0500)] 
Merge pull request #3509 from daniellerozenblit/fix-window-resize-test

Fix cli-tests issues

2 years agoFix Permissions on Publish Release Artifacts Job 3511/head
W. Felix Handte [Wed, 15 Feb 2023 15:48:21 +0000 (10:48 -0500)] 
Fix Permissions on Publish Release Artifacts Job

Publishing release artifacts requires the `contents` permission, as documented
by: https://docs.github.com/en/rest/overview/permissions-required-for-github-apps.

2 years agoadd make test for 32bit 3509/head
Danielle Rozenblit [Wed, 15 Feb 2023 14:03:02 +0000 (06:03 -0800)] 
add make test for 32bit

2 years agofix cli-tests issues
Danielle Rozenblit [Tue, 14 Feb 2023 19:33:26 +0000 (11:33 -0800)] 
fix cli-tests issues

2 years agoadd manual flag to mmap dictionary
Danielle Rozenblit [Tue, 14 Feb 2023 17:42:23 +0000 (09:42 -0800)] 
add manual flag to mmap dictionary

2 years agoCI workflow to test external compressors dependencies
Yonatan Komornik [Tue, 14 Feb 2023 02:00:13 +0000 (18:00 -0800)] 
CI workflow to test external compressors dependencies

Implemented CI workflow for testing compilation with external compressors and without them. This serves as a sanity check to avoid any code dependencies on libraries that may not always be present. (Reference: #3497 for a bug fix related to this issue.)

2 years agoMake Github workflows permissions read-only by default (#3488)
Yonatan Komornik [Tue, 14 Feb 2023 00:57:05 +0000 (16:57 -0800)] 
Make Github workflows permissions read-only by default (#3488)

* Make Github workflows permissions read-only by default

* Pins `skx/github-action-publish-binaries` action to specific hash

2 years agoUse correct types in LZMA comp/decomp (#3497)
Alex Xu [Tue, 14 Feb 2023 00:30:56 +0000 (00:30 +0000)] 
Use correct types in LZMA comp/decomp (#3497)

Bytef and uInt are zlib types, not available when zlib is disabled

Fixes: 1598e6c634ac ("Async write for decompression")
Fixes: cc0657f27d81 ("AsyncIO compression part 2 - added async read and asyncio to compression code (#3022)")
2 years agorefactor dictionary file stat
Danielle Rozenblit [Mon, 13 Feb 2023 23:23:06 +0000 (15:23 -0800)] 
refactor dictionary file stat

2 years agoMerge pull request #3491 from facebook/win_artifacts
Yann Collet [Mon, 13 Feb 2023 19:30:47 +0000 (11:30 -0800)] 
Merge pull request #3491 from facebook/win_artifacts

Github Action to generate Win64 artifacts

2 years agommap dicitonaries for large dictionaries in patch-from
Danielle Rozenblit [Mon, 13 Feb 2023 15:26:22 +0000 (07:26 -0800)] 
mmap dicitonaries for large dictionaries in patch-from

2 years agoBump github/codeql-action from 2.2.1 to 2.2.4 (#3503)
dependabot[bot] [Mon, 13 Feb 2023 11:35:31 +0000 (06:35 -0500)] 
Bump github/codeql-action from 2.2.1 to 2.2.4 (#3503)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.2.1 to 2.2.4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/3ebbd71c74ef574dbc558c82f70e52732c8b44fe...17573ee1cc1b9d061760f3a006fc4aac4f944fd5)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years agoFix zstd-dll build missing dependencies (#3496)
Yonatan Komornik [Sun, 12 Feb 2023 20:32:31 +0000 (12:32 -0800)] 
Fix zstd-dll build missing dependencies (#3496)

* Fixes zstd-dll build (https://github.com/facebook/zstd/issues/3492):
- Adds pool.o and threading.o dependency to the zstd-dll target
- Moves custom allocation functions into header to avoid needing to add dependency on common.o
- Adds test target for zstd-dll
- Adds github workflow that buildis zstd-dll

2 years agoFix all MSVC warnings (#3495)
Elliot Gorokhovsky [Sat, 11 Feb 2023 15:56:59 +0000 (10:56 -0500)] 
Fix all MSVC warnings (#3495)

* fix and test MSVC AVX2 build

* treat msbuild warnings as errors

* fix incorrect MSVC 2019 compiler warning

* fix MSVC error D9035: option 'Gm' has been deprecated and will be removed in a future release

2 years agotry a different compiler 3491/head
Yann Collet [Sat, 11 Feb 2023 04:49:21 +0000 (20:49 -0800)] 
try a different compiler

2 years agosimplify win64 artifact generation
Yann Collet [Sat, 11 Feb 2023 00:58:54 +0000 (16:58 -0800)] 
simplify win64 artifact generation

2 years agomove shell to mingw
Yann Collet [Fri, 10 Feb 2023 22:27:47 +0000 (14:27 -0800)] 
move shell to mingw

2 years agoGithub Action to generate Win64 artifacts
Yann Collet [Fri, 10 Feb 2023 06:48:30 +0000 (22:48 -0800)] 
Github Action to generate Win64 artifacts

2 years agomeson: always build the zstd binary when tests are enabled 3490/head
Eli Schwartz [Fri, 10 Feb 2023 04:55:09 +0000 (23:55 -0500)] 
meson: always build the zstd binary when tests are enabled

We need to run it for the tests, even if programs are disabled. So if
they are disabled, create a build rule for the program, but don't
install it. Just make it available for the test itself.

2 years agomeson: correctly specify the dependency relationship for playtests
Eli Schwartz [Fri, 10 Feb 2023 05:28:47 +0000 (00:28 -0500)] 
meson: correctly specify the dependency relationship for playtests

It depends on the zstd program being built, and passes it as an env
variable. Just like datagen. But for datagen, we explicitly depend on
it, while for zstd, we assume it's built as part of "all".

This can be wrong in two cases:
- when running individual tests, meson can (re)build just what is needed
  for that one test
- a later patch will handle building zstd but not by default

2 years agominor nit updates to README.md 3487/head
Yann Collet [Thu, 9 Feb 2023 23:51:18 +0000 (15:51 -0800)] 
minor nit updates to README.md

2 years agoupdated man pages
Yann Collet [Thu, 9 Feb 2023 22:40:39 +0000 (14:40 -0800)] 
updated man pages

2 years agoRename "External Matchfinder" to "Block-Level Sequence Producer" (#3484)
Elliot Gorokhovsky [Thu, 9 Feb 2023 22:01:17 +0000 (17:01 -0500)] 
Rename "External Matchfinder" to "Block-Level Sequence Producer" (#3484)

* change "external matchfinder" to "external sequence producer"

* migrate contrib/ to new naming convention

* fix contrib build

* fix error message

* update debug strings

* fix def of invalid sequences in zstd.h

* nit

* update CHANGELOG

* fix .gitignore

2 years agoinitial commit
Danielle Rozenblit [Thu, 9 Feb 2023 15:47:21 +0000 (07:47 -0800)] 
initial commit

2 years agoinitial commit
Danielle Rozenblit [Thu, 9 Feb 2023 15:40:25 +0000 (07:40 -0800)] 
initial commit

2 years agoinitial commit
Danielle Rozenblit [Thu, 9 Feb 2023 15:37:37 +0000 (07:37 -0800)] 
initial commit

2 years agoupdated CHANGELOG in preparation for v1.5.4 release
Yann Collet [Thu, 9 Feb 2023 00:35:55 +0000 (16:35 -0800)] 
updated CHANGELOG in preparation for v1.5.4 release

2 years agoMerge branch 'dev' of github.com:facebook/zstd into dev
Yann Collet [Wed, 8 Feb 2023 23:57:12 +0000 (15:57 -0800)] 
Merge branch 'dev' of github.com:facebook/zstd into dev

2 years agominor: fix missing newline character in help page
Yann Collet [Wed, 8 Feb 2023 23:56:49 +0000 (15:56 -0800)] 
minor: fix missing newline character in help page

2 years agoFix empty-block.zst golden decompression file
Nick Terrell [Wed, 8 Feb 2023 19:42:46 +0000 (11:42 -0800)] 
Fix empty-block.zst golden decompression file

This frame is invalid because the `Window_Size = 0`, and the
`Block_Maximum_Size = min(128 KB, Window_Size) = 0`. But the empty
compressed block has a `Block_Content` size of 2, which is invalid.

The fix is to switch to using a `Window_Descriptor` instead of the
`Single_Segment_Flag`. This sets the `Window_Size = 1024`.

Hexdump before this PR: `28b5 2ffd 2000 1500 0000 00`

Hexdump after this PR: `28b5 2ffd 0000 1500 0000 00`

For issue #3482.

2 years agoMerge pull request #3476 from facebook/fix55714
Yann Collet [Wed, 8 Feb 2023 02:06:22 +0000 (18:06 -0800)] 
Merge pull request #3476 from facebook/fix55714

fix oss-fuzz case 55714