]> git.ipfire.org Git - thirdparty/zstd.git/log
thirdparty/zstd.git
2 years agoBump github/codeql-action from 2.1.38 to 2.1.39 3446/head
dependabot[bot] [Mon, 23 Jan 2023 05:10:26 +0000 (05:10 +0000)] 
Bump github/codeql-action from 2.1.38 to 2.1.39

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.38 to 2.1.39.
- [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/515828d97454b8354517688ddc5b48402b723750...a34ca99b4610d924e04c68db79e503e1f79f9f02)

---
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 agofixed minor c89 warning
Yann Collet [Sat, 21 Jan 2023 02:04:20 +0000 (18:04 -0800)] 
fixed minor c89 warning

introduced due to parallel merges

2 years agoMerge pull request #3432 from felixhandte/fix-perms
Felix Handte [Sat, 21 Jan 2023 00:19:05 +0000 (19:19 -0500)] 
Merge pull request #3432 from felixhandte/fix-perms

Fix CLI Handling of Permissions and Ownership (Again)

2 years agoMerge pull request #3442 from felixhandte/pgo-tests
Felix Handte [Sat, 21 Jan 2023 00:18:51 +0000 (19:18 -0500)] 
Merge pull request #3442 from felixhandte/pgo-tests

Test PGO Builds

2 years agoFix bufferless API with attached dictionary
Nick Terrell [Fri, 20 Jan 2023 22:14:14 +0000 (14:14 -0800)] 
Fix bufferless API with attached dictionary

Fixes #3102.

2 years agoAdd PGO Build Jobs to CI 3442/head
W. Felix Handte [Fri, 20 Jan 2023 22:36:24 +0000 (17:36 -0500)] 
Add PGO Build Jobs to CI

2 years agoAdd Additional Flags to PGO Build
W. Felix Handte [Fri, 20 Jan 2023 22:32:49 +0000 (17:32 -0500)] 
Add Additional Flags to PGO Build

In GCC, we can add a couple more flags to give us confidence that the profile
data is actually being found and used.

Also, my system for example doesn't have a binary installed under the name
`llvm-profdata`, but it does have, e.g., `llvm-profdata-13`, etc. So this
commit adds a variable that can be overridden.

2 years agoReplace Huffman boolean args with flags bit set
Nick Terrell [Thu, 19 Jan 2023 00:30:10 +0000 (16:30 -0800)] 
Replace Huffman boolean args with flags bit set

2 years agoDelete unused Huffman functions
Nick Terrell [Wed, 18 Jan 2023 23:30:30 +0000 (15:30 -0800)] 
Delete unused Huffman functions

Remove all Huffman functions that aren't used by zstd.

2 years agoMerge pull request #3431 from facebook/cygwin
Yann Collet [Fri, 20 Jan 2023 22:07:25 +0000 (14:07 -0800)] 
Merge pull request #3431 from facebook/cygwin

added cygwin tests to Github Actions

2 years agoMerge pull request #3435 from facebook/c89build
Yann Collet [Fri, 20 Jan 2023 22:07:12 +0000 (14:07 -0800)] 
Merge pull request #3435 from facebook/c89build

added c89 build test to CI

2 years ago[versions-test] Work around bug in dictionary builder for older versions
Nick Terrell [Thu, 19 Jan 2023 20:21:31 +0000 (12:21 -0800)] 
[versions-test] Work around bug in dictionary builder for older versions

Older versions of zstandard have a bug in the dictionary builder, that
can cause dictionary building to fail. The process still exits 0, but
the dictionary is not created.

For reference, the bug is that it creates a dictionary that starts with
the zstd dictionary magic, in the process of writing the dictionary header,
but the header isn't fully written yet, and zstd fails compressions in
this case, because the dictionary is malformated. We fixed this later on
by trying to load the dictionary as a zstd dictionary, but if that fails
we fallback to content only (by default).

The fix is to:
1. Make the dictionary determinsitic by sorting the input files.
   Previously the bug would only sometimes occur, when the input files
   were in a particular order.
2. If dictionary creation fails, fallback to the `head` dictionary.

2 years agoCap hashLog & chainLog to ensure that we only use 32 bits of hash
Nick Terrell [Fri, 20 Jan 2023 00:27:24 +0000 (16:27 -0800)] 
Cap hashLog & chainLog to ensure that we only use 32 bits of hash

* Cap shortCache chainLog to 24
* Cap row match finder hashLog so that rowLog <= 24
* Add unit tests to expose all cases. The row match finder unit tests
  are only run in 64-bit mode, because they allocate ~1GB.

Fixes #3336

2 years agoMerge pull request #3415 from facebook/dependabot/github_actions/actions/upload-artif...
Yann Collet [Fri, 20 Jan 2023 22:00:28 +0000 (14:00 -0800)] 
Merge pull request #3415 from facebook/dependabot/github_actions/actions/upload-artifact-3.1.2

Bump actions/upload-artifact from 3.1.1 to 3.1.2

2 years agoMerge pull request #3437 from embg/fuzz_emf
Elliot Gorokhovsky [Fri, 20 Jan 2023 16:42:59 +0000 (11:42 -0500)] 
Merge pull request #3437 from embg/fuzz_emf

Fuzz the External Matchfinder API

2 years agoEnable if == 1 rather than if == 0 3437/head
Elliot Gorokhovsky [Fri, 20 Jan 2023 16:41:53 +0000 (11:41 -0500)] 
Enable if == 1 rather than if == 0

Co-authored-by: Nick Terrell <nickrterrell@gmail.com>
2 years agoadded cygwin tests to github actions 3431/head
Yann Collet [Wed, 18 Jan 2023 22:12:27 +0000 (14:12 -0800)] 
added cygwin tests to github actions

2 years agoadded c89 build test to CI 3435/head
Yann Collet [Wed, 18 Jan 2023 23:38:36 +0000 (15:38 -0800)] 
added c89 build test to CI

2 years agoFuzz the external matchfinder API
Elliot Gorokhovsky [Thu, 19 Jan 2023 21:18:01 +0000 (13:18 -0800)] 
Fuzz the external matchfinder API

2 years agoBugfixes for the External Matchfinder API (#3433)
Elliot Gorokhovsky [Thu, 19 Jan 2023 15:41:24 +0000 (10:41 -0500)] 
Bugfixes for the External Matchfinder API (#3433)

* external matchfinder bugfixes + tests

* small doc fix

2 years agoMerge pull request #3418 from daniellerozenblit/fuzz-max-block-size
daniellerozenblit [Thu, 19 Jan 2023 13:18:04 +0000 (08:18 -0500)] 
Merge pull request #3418 from daniellerozenblit/fuzz-max-block-size

Fuzz on maxBlockSize

2 years agoMerge pull request #3423 from facebook/ptime
Yann Collet [Wed, 18 Jan 2023 21:27:42 +0000 (13:27 -0800)] 
Merge pull request #3423 from facebook/ptime

Refactor timefn, restore support for clock_gettime()

2 years agoEasy: Print Mode as Octal in `chmod()` Trace 3432/head
W. Felix Handte [Wed, 18 Jan 2023 19:15:53 +0000 (11:15 -0800)] 
Easy: Print Mode as Octal in `chmod()` Trace

2 years agoMimic gzip chown(gid), chmod(), chown(uid) Behavior
W. Felix Handte [Wed, 18 Jan 2023 00:37:30 +0000 (16:37 -0800)] 
Mimic gzip chown(gid), chmod(), chown(uid) Behavior

Avoids a race condition in which we unintentionally open up permissions to
the wrong group.

2 years agoCopy Permissions from Source File
W. Felix Handte [Tue, 17 Jan 2023 23:08:15 +0000 (15:08 -0800)] 
Copy Permissions from Source File

2 years agoRe-Use `stat_t` in `FIO_compressFilename_srcFile()`
W. Felix Handte [Tue, 17 Jan 2023 22:50:31 +0000 (14:50 -0800)] 
Re-Use `stat_t` in `FIO_compressFilename_srcFile()`

2 years ago[tests] Fix version test determinism
Nick Terrell [Wed, 21 Dec 2022 00:25:24 +0000 (16:25 -0800)] 
[tests] Fix version test determinism

The dictionary source files were taken from the `dev` branch before this
commit, which could introduce non-determinism on PR jobs. Instead take
the sources from the PR checkout.

This PR also adds stderr logging, and verbose output for the jobs that
are failing, to help catch the failure if it occurs again.

2 years agoUse Existing Src File Stat in `*_dstFile()` Funcs
W. Felix Handte [Tue, 17 Jan 2023 22:08:22 +0000 (14:08 -0800)] 
Use Existing Src File Stat in `*_dstFile()` Funcs

One fewer `stat()` call to make per operation!

2 years agoPass `stat_t` into `*_dstFile()` Functions
W. Felix Handte [Tue, 17 Jan 2023 22:05:15 +0000 (14:05 -0800)] 
Pass `stat_t` into `*_dstFile()` Functions

2 years ago`FIO_openSrcFile()` Returns File Stat
W. Felix Handte [Tue, 17 Jan 2023 22:01:06 +0000 (14:01 -0800)] 
`FIO_openSrcFile()` Returns File Stat

2 years agofix maxBlockSize resolution + add test cases 3418/head
Danielle Rozenblit [Tue, 17 Jan 2023 20:24:18 +0000 (12:24 -0800)] 
fix maxBlockSize resolution + add test cases

2 years agoMerge pull request #3424 from felixhandte/disable-asan-msan-poison-mingw
Felix Handte [Tue, 17 Jan 2023 17:41:41 +0000 (12:41 -0500)] 
Merge pull request #3424 from felixhandte/disable-asan-msan-poison-mingw

Disable Custom ASAN/MSAN Poisoning on MinGW Builds

2 years agofix msys2 symlink breakage in CI (#3429)
Elliot Gorokhovsky [Tue, 17 Jan 2023 17:10:15 +0000 (12:10 -0500)] 
fix msys2 symlink breakage in CI (#3429)

2 years agoBump github/codeql-action from 2.1.37 to 2.1.38 (#3428)
dependabot[bot] [Mon, 16 Jan 2023 22:22:19 +0000 (17:22 -0500)] 
Bump github/codeql-action from 2.1.37 to 2.1.38 (#3428)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.37 to 2.1.38.
- [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/959cbb7472c4d4ad70cdfe6f4976053fe48ab394...515828d97454b8354517688ddc5b48402b723750)

---
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>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years agoDeprecate advanced streaming functions (#3408)
Elliot Gorokhovsky [Fri, 13 Jan 2023 19:51:47 +0000 (14:51 -0500)] 
Deprecate advanced streaming functions (#3408)

* deprecate advanced streaming functions

* remove internal usage of the deprecated functions

* nit

* suppress warnings in tests/zstreamtest.c

* purge ZSTD_initDStream_usingDict

* nits

* c90 compat

* zstreamtest.c already disables deprecation warnings!

* fix initDStream() return value

* fix typo

* wasn't able to import private symbol properly, this commit works around that

* new strategy for zbuff

* undo zbuff deprecation warning changes

* move ZSTD_DISABLE_DEPRECATE_WARNINGS from .h to .c

2 years agomissing #include for Windows 3423/head
Yann Collet [Fri, 13 Jan 2023 19:38:27 +0000 (11:38 -0800)] 
missing #include for Windows

2 years agoDon't Even Declare Poisoning Functions if Poisoning is Disabled 3424/head
W. Felix Handte [Fri, 13 Jan 2023 16:56:48 +0000 (11:56 -0500)] 
Don't Even Declare Poisoning Functions if Poisoning is Disabled

This guarantees that we won't accidentally forget to check the macro somewhere
where we use these functions.

2 years agoDisable Custom ASAN/MSAN Poisoning on MinGW Builds
W. Felix Handte [Fri, 13 Jan 2023 16:51:59 +0000 (11:51 -0500)] 
Disable Custom ASAN/MSAN Poisoning on MinGW Builds

Addresses #3240.

2 years agomove ZSTD_BLOCKSIZE_MAX_MIN to static linking only section
Danielle Rozenblit [Fri, 13 Jan 2023 15:00:50 +0000 (07:00 -0800)] 
move ZSTD_BLOCKSIZE_MAX_MIN to static linking only section

2 years agoMerge pull request #3419 from facebook/fix3416
Yann Collet [Fri, 13 Jan 2023 08:21:08 +0000 (00:21 -0800)] 
Merge pull request #3419 from facebook/fix3416

fix root cause of #3416

2 years agorestore support of clock_gettime() for POSIX systems
Yann Collet [Fri, 13 Jan 2023 04:45:11 +0000 (20:45 -0800)] 
restore support of clock_gettime() for POSIX systems

This should notably allow posix systems with timespec_get()
to have access to a high resolution timer,
instead of falling back to C90's clock_t.

2 years agorefactor timefn
Yann Collet [Fri, 13 Jan 2023 03:00:27 +0000 (19:00 -0800)] 
refactor timefn

The timer storage type is no longer dependent on OS.
This will make it possible to re-enable posix precise timers
since the timer storage type will no longer be sensible to #include order.
See #3168 for details of pbs of previous interface.

Suggestion by @terrelln

2 years agoAdd support for in-place decompression
Nick Terrell [Thu, 12 Jan 2023 02:14:40 +0000 (18:14 -0800)] 
Add support for in-place decompression

* Add a function and macro ZSTD_decompressionMargin() that computes the
  decompression margin for in-place decompression. The function computes
  a tight margin that works in all cases, and the macro computes an upper
  bound that will only work if flush isn't used.
* When doing in-place decompression, make sure that our output buffer
  doesn't overlap with the input buffer. This ensures that we don't
  decide to use the portion of the output buffer that overlaps the input
  buffer for temporary memory, like for literals.
* Add a simple unit test.
* Add in-place decompression to the simple_round_trip and
  stream_round_trip fuzzers. This should help verify that our margin stays
  correct.

2 years agoadd explanation about new test 3419/head
Yann Collet [Thu, 12 Jan 2023 23:49:01 +0000 (15:49 -0800)] 
add explanation about new test

as requested by @terrelln

2 years agofix root cause of #3416
Yann Collet [Wed, 11 Jan 2023 23:11:51 +0000 (15:11 -0800)] 
fix root cause of #3416

A minor change in 5434de0 changed a `<=` into a `<`,
and as an indirect consequence allowed compression attempt of literals when there are only 6 literals to compress
(previous limit was effectively 7 literals).

This is not in itself a problem, as the threshold is merely an heuristic,
but it emerged a bug that has always been there, and was just never triggered so far due to the previous limit.
This bug would make the literal compressor believes that all literals are the same symbol,
but for the exact case where nbLiterals==6, plus a pretty wild combination of other limit conditions,
this outcome could be false, resulting in data corruption.

Replaced the blind heuristic by an actual test for all limit cases,
so that even if the threshold is changed again in the future,
the detection of RLE mode will remain reliable.

2 years agoMerge pull request #3413 from facebook/timefn
Yann Collet [Thu, 12 Jan 2023 23:34:00 +0000 (15:34 -0800)] 
Merge pull request #3413 from facebook/timefn

minor refactoring for timefn

2 years agoadditional tests and documentation updates + allow maxBlockSize to be set to 0 (goes...
Danielle Rozenblit [Thu, 12 Jan 2023 21:41:50 +0000 (13:41 -0800)] 
additional tests and documentation updates + allow maxBlockSize to be set to 0 (goes to default)

2 years agoMerge pull request #3402 from facebook/dependabot/github_actions/ossf/scorecard-actio...
Felix Handte [Thu, 12 Jan 2023 18:28:04 +0000 (13:28 -0500)] 
Merge pull request #3402 from facebook/dependabot/github_actions/ossf/scorecard-action-2.1.2

Bump ossf/scorecard-action from 2.1.0 to 2.1.2

2 years agoadd simple test for maxBlockSize expected functionality
Danielle Rozenblit [Thu, 12 Jan 2023 16:55:39 +0000 (08:55 -0800)] 
add simple test for maxBlockSize expected functionality

2 years agoCompletely overhaul Windows CI (#3410)
Elliot Gorokhovsky [Wed, 11 Jan 2023 21:29:23 +0000 (16:29 -0500)] 
Completely overhaul Windows CI (#3410)

* Overhaul windows CI

* upgrade setup-msbuild from v1.1.3 to v1.3

* remove cmake 2019 test

* fix 32-bit gcc mingw test

* merge conflict

2 years agoupdate minimum threshold for max block size
Danielle Rozenblit [Wed, 11 Jan 2023 19:09:57 +0000 (11:09 -0800)] 
update minimum threshold for max block size

2 years agoMake the producer use the same amount of entropy
Daniel Kutenin [Tue, 10 Jan 2023 20:30:03 +0000 (20:30 +0000)] 
Make the producer use the same amount of entropy

2 years agoFix fuzzing with ZSTD_MULTITHREAD
Daniel Kutenin [Tue, 10 Jan 2023 15:33:50 +0000 (15:33 +0000)] 
Fix fuzzing with ZSTD_MULTITHREAD

At Google we fuzz zstd without ZSTD_MULTITHREAD but we want inputs to be as much as reproducible. It allows us to test new fuzzing methods for our fuzz team internally and have more horsepower to find bugs

2 years agoMerge pull request #3414 from facebook/dependabot/github_actions/actions/checkout...
Yann Collet [Mon, 9 Jan 2023 19:33:29 +0000 (11:33 -0800)] 
Merge pull request #3414 from facebook/dependabot/github_actions/actions/checkout-3.3.0

Bump actions/checkout from 3.2.0 to 3.3.0

2 years agoresolve max block value in cctx and use when calculating the max block size
Danielle Rozenblit [Mon, 9 Jan 2023 15:53:53 +0000 (07:53 -0800)] 
resolve max block value in cctx and use when calculating the max block size

2 years agoBump actions/upload-artifact from 3.1.1 to 3.1.2 3415/head
dependabot[bot] [Mon, 9 Jan 2023 05:10:50 +0000 (05:10 +0000)] 
Bump actions/upload-artifact from 3.1.1 to 3.1.2

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3.1.1 to 3.1.2.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/83fd05a356d7e2593de66fc9913b3002723633cb...0b7f8abb1508181956e8e162db84b466c27e18ce)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  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.2.0 to 3.3.0 3414/head
dependabot[bot] [Mon, 9 Jan 2023 05:10:46 +0000 (05:10 +0000)] 
Bump actions/checkout from 3.2.0 to 3.3.0

Bumps [actions/checkout](https://github.com/actions/checkout) from 3.2.0 to 3.3.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/755da8c3cf115ac066823e79a1e1788f8940201b...ac593985615ec2ede58e132d2e21d2b1cbd6127c)

---
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 simplification refactoring for timefn 3413/head
Yann Collet [Fri, 6 Jan 2023 23:25:36 +0000 (15:25 -0800)] 
minor simplification refactoring for timefn

`UTIL_getSpanTimeMicro()` can be factored in a generic way,
reducing OS-dependent code.

2 years agominor: fix conversion warnings
Yann Collet [Thu, 5 Jan 2023 04:00:04 +0000 (20:00 -0800)] 
minor: fix conversion warnings

2 years agoMerge branch 'dev' into fuzz-max-block-size
daniellerozenblit [Wed, 4 Jan 2023 21:34:07 +0000 (16:34 -0500)] 
Merge branch 'dev' into fuzz-max-block-size

2 years agoinitial commit
Danielle Rozenblit [Wed, 4 Jan 2023 21:01:54 +0000 (13:01 -0800)] 
initial commit

2 years agoMerge pull request #3391 from facebook/fix3228
Yann Collet [Wed, 4 Jan 2023 00:01:52 +0000 (16:01 -0800)] 
Merge pull request #3391 from facebook/fix3228

improve compression ratio of small alphabets

2 years agoupdate levels.sh test 3391/head
Yann Collet [Thu, 22 Dec 2022 00:21:29 +0000 (16:21 -0800)] 
update levels.sh test

comparing level 19 to level 22 and expecting a stricter better result from level 22
is not that guaranteed,
because level 19 and 22 are very close to each other,
especially for small files,
so any noise in the final compression result
result in failing this test.

Level 22 could be compared to something much lower, like level 15,
But level 19 is required anyway, because there is a clamping test which depends on it.

Removed level 22, kept level 19

2 years agoupdate regression results
Yann Collet [Tue, 3 Jan 2023 22:04:23 +0000 (14:04 -0800)] 
update regression results

2 years agoimprove compression ratio of small alphabets
Yann Collet [Wed, 21 Dec 2022 22:58:53 +0000 (14:58 -0800)] 
improve compression ratio of small alphabets

fix #3328

In situations where the alphabet size is very small,
the evaluation of literal costs from the Optimal Parser is initially incorrect.
It takes some time to converge, during which compression is less efficient.
This is especially important for small files,
because there will not be enough data to converge,
so most of the parsing is selected based on incorrect metrics.

After this patch, the scenario ##3328 gets fixed,
delivering the expected 29 bytes compressed size (smallest known compressed size).

2 years agoMerge pull request #3302 from daniellerozenblit/optimal-huff-depth-speed
daniellerozenblit [Tue, 3 Jan 2023 17:51:51 +0000 (12:51 -0500)] 
Merge pull request #3302 from daniellerozenblit/optimal-huff-depth-speed

Optimal huff depth speed improvements

2 years agoupdate regression results.csv 3302/head
Danielle Rozenblit [Tue, 3 Jan 2023 16:41:40 +0000 (08:41 -0800)] 
update regression results.csv

2 years agoimplement suggestions
Danielle Rozenblit [Tue, 3 Jan 2023 15:20:21 +0000 (07:20 -0800)] 
implement suggestions

2 years agoMerge pull request #3248 from facebook/opt_comments1
Yann Collet [Thu, 29 Dec 2022 02:03:57 +0000 (18:03 -0800)] 
Merge pull request #3248 from facebook/opt_comments1

[easy] add a few comments to the optimal parser code base for improved clarity

2 years agofixed incorrect assert 3248/head
Yann Collet [Thu, 29 Dec 2022 01:23:40 +0000 (17:23 -0800)] 
fixed incorrect assert

commented Fweight instead

2 years agojust add some comments to zstd_opt for improved clarity
Yann Collet [Fri, 19 Aug 2022 23:04:28 +0000 (16:04 -0700)] 
just add some comments to zstd_opt for improved clarity

2 years agoMerge pull request #3400 from danlark1/dev
Yann Collet [Wed, 28 Dec 2022 23:50:26 +0000 (15:50 -0800)] 
Merge pull request #3400 from danlark1/dev

Move deprecated annotation before static to allow C++ compilation for clang

2 years agoMerge pull request #3395 from terrelln/2022-12-21-deprecated-test
Yann Collet [Wed, 28 Dec 2022 23:49:50 +0000 (15:49 -0800)] 
Merge pull request #3395 from terrelln/2022-12-21-deprecated-test

[tests] Remove deprecated function from longmatch.c test

2 years agoupdate ZSTD_CCts_setCParams() inline documentation
Yann Collet [Wed, 28 Dec 2022 23:08:18 +0000 (15:08 -0800)] 
update ZSTD_CCts_setCParams() inline documentation

specify behavior when changing compression parameters during MT compression,
reported by @embg

2 years agoMerge pull request #3403 from facebook/setCParams
Yann Collet [Wed, 28 Dec 2022 22:07:13 +0000 (14:07 -0800)] 
Merge pull request #3403 from facebook/setCParams

ZSTD_CCtx_setCParams

2 years agoExternal matchfinder API (#3333)
Elliot Gorokhovsky [Wed, 28 Dec 2022 21:45:14 +0000 (16:45 -0500)] 
External matchfinder API (#3333)

* First building commit with sample matchfinder

* Set up ZSTD_externalMatchCtx struct

* move seqBuffer to ZSTD_Sequence*

* support non-contiguous dictionary

* clean up parens

* add clearExternalMatchfinder, handle allocation errors

* Add useExternalMatchfinder cParam

* validate useExternalMatchfinder cParam

* Disable LDM + external matchfinder

* Check for static CCtx

* Validate mState and mStateDestructor

* Improve LDM check to cover both branches

* Error API with optional fallback

* handle RLE properly for external matchfinder

* nit

* Move to a CDict-like model for resource ownership

* Add hidden useExternalMatchfinder bool to CCtx_params_s

* Eliminate malloc, move to cwksp allocation

* Handle CCtx reset properly

* Ensure seqStore has enough space for external sequences

* fix capitalization

* Add DEBUGLOG statements

* Add compressionLevel param to matchfinder API

* fix c99 issues and add a param combination error code

* nits

* Test external matchfinder API

* C90 compat for simpleExternalMatchFinder

* Fix some @nocommits and an ASAN bug

* nit

* nit

* nits

* forward declare copySequencesToSeqStore functions in zstd_compress_internal.h

* nit

* nit

* nits

* Update copyright headers

* Fix CMake zstreamtest build

* Fix copyright headers (again)

* typo

* Add externalMatchfinder demo program to make contrib

* Reduce memory consumption for small blockSize

* ZSTD_postProcessExternalMatchFinderResult nits

* test sum(matchlen) + sum(litlen) == srcSize in debug builds

* refExternalMatchFinder -> registerExternalMatchFinder

* C90 nit

* zstreamtest nits

* contrib nits

* contrib nits

* allow block splitter + external matchfinder, refactor

* add windowSize param

* add contrib/externalMatchfinder/README.md

* docs

* go back to old RLE heuristic because of the first block issue

* fix initializer element is not a constant expression

* ref contrib from zstd.h

* extremely pedantic compiler warning fix, meson fix, typo fix

* Additional docs on API limitations

* minor nits

* Refactor maxNbSeq calculation into a helper function

* Fix copyright

2 years agoSignal parameter change during MT compression 3403/head
Yann Collet [Wed, 28 Dec 2022 21:14:58 +0000 (13:14 -0800)] 
Signal parameter change during MT compression

2 years agoNew xp library symbol : ZSTD_CCtx_setCParams()
Yann Collet [Wed, 28 Dec 2022 07:40:34 +0000 (23:40 -0800)] 
New xp library symbol : ZSTD_CCtx_setCParams()

Inspired by #3395,
offer a new capability to set all parameters defined in a ZSTD_compressionParameters structure
with a single symbol invocation
to improve user code brevity.

2 years agoMerge pull request #3394 from terrelln/issue-3010
Yann Collet [Wed, 28 Dec 2022 00:20:05 +0000 (16:20 -0800)] 
Merge pull request #3394 from terrelln/issue-3010

[cli-tests] Test file stat read/write

2 years agoBump ossf/scorecard-action from 2.1.0 to 2.1.2 3402/head
dependabot[bot] [Mon, 26 Dec 2022 05:08:53 +0000 (05:08 +0000)] 
Bump ossf/scorecard-action from 2.1.0 to 2.1.2

Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.1.0 to 2.1.2.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](https://github.com/ossf/scorecard-action/compare/937ffa90d79c7d720498178154ad4c7ba1e4ad8c...e38b1902ae4f44df626f11ba0734b14fb91f8f86)

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

Signed-off-by: dependabot[bot] <support@github.com>
2 years agocmake build: fix nit
Yann Collet [Fri, 23 Dec 2022 22:18:11 +0000 (14:18 -0800)] 
cmake build: fix nit

reported by @jaimeMF in https://github.com/facebook/zstd/pull/3392#discussion_r1056643794

2 years agoMove deprecated annotation before static to allow C++ compilation for clang 3400/head
Daniel Kutenin [Fri, 23 Dec 2022 12:07:31 +0000 (12:07 +0000)] 
Move deprecated annotation before static to allow C++ compilation for clang

This fixes last 2 instances of https://github.com/facebook/zstd/issues/3250

2 years agoMerge pull request #3398 from facebook/fix3316
Yann Collet [Fri, 23 Dec 2022 00:57:05 +0000 (16:57 -0800)] 
Merge pull request #3398 from facebook/fix3316

spec update : require minimum nb of literals for 4-streams mode

2 years agospec update : require minimum nb of literals for 4-streams mode 3398/head
Yann Collet [Thu, 22 Dec 2022 19:30:15 +0000 (11:30 -0800)] 
spec update : require minimum nb of literals for 4-streams mode

Reported by @shulib :
the specification for 4-streams mode
doesn't work when the amount of literals to compress is 5 bytes.
Extending it, it also doesn't work for sizes 1 or 2.

This patch updates the specification and the implementation
to require a minimum of 6 literals to trigger or accept the 4-streams mode.

The impact is expected to be a no-op :
the 4-streams mode is never triggered for such small quantity of literals anyway,
since it would be wasteful (it costs ~7.3 bytes more than single-stream mode).
An informal lower limit is set at ~256 bytes,
so the technical minimum is very far from this limit.

This is just meant for completeness of the specification.

2 years agoMerge pull request #3399 from facebook/fix2577
Yann Collet [Thu, 22 Dec 2022 22:05:36 +0000 (14:05 -0800)] 
Merge pull request #3399 from facebook/fix2577

Support decompression of compressed blocks of size ZSTD_BLOCKSIZE_MAX

2 years agoSupport decompression of compressed blocks of size ZSTD_BLOCKSIZE_MAX exactly 3399/head
Yann Collet [Thu, 22 Dec 2022 20:40:27 +0000 (12:40 -0800)] 
Support decompression of compressed blocks of size ZSTD_BLOCKSIZE_MAX exactly

2 years agoMerge pull request #3397 from felixhandte/man-page-tweaks
Felix Handte [Thu, 22 Dec 2022 19:49:59 +0000 (14:49 -0500)] 
Merge pull request #3397 from felixhandte/man-page-tweaks

Man Page Tweaks, Edits, Formatting Fixes

2 years ago`make man` 3397/head
W. Felix Handte [Thu, 22 Dec 2022 19:13:24 +0000 (14:13 -0500)] 
`make man`

2 years agoMan Page Tweaks, Edits, Formatting Fixes
W. Felix Handte [Thu, 22 Dec 2022 19:04:36 +0000 (14:04 -0500)] 
Man Page Tweaks, Edits, Formatting Fixes

This started as an application of the edits suggested in #3201 and expanded
from there.

2 years ago[cli-tests] Add tests that use --trace-file-stat 3394/head
Nick Terrell [Thu, 22 Dec 2022 01:36:27 +0000 (17:36 -0800)] 
[cli-tests] Add tests that use --trace-file-stat

Basic tests for (de)compressing in the following modes:
* file to file
* file to stdout
* stdin to file
* stdin to stdout

These are basic tests, and aren't testing more advanced scenarios, but
it adds the groundwork for more complex tests as needed.

Fixes #3010.

2 years ago[tests] Remove deprecated function from longmatch.c test 3395/head
Nick Terrell [Thu, 22 Dec 2022 01:48:24 +0000 (17:48 -0800)] 
[tests] Remove deprecated function from longmatch.c test

Thanks to @eli-schwartz for pointing it out!

We should maybe consider adding a helper function for applying
`ZSTD_parameters` and `ZSTD_compressionParameters` to a context.
That would aid the transition to the new API in situations like this.

2 years agoFix `make clangbuild` & add CI
Nick Terrell [Thu, 22 Dec 2022 00:09:25 +0000 (16:09 -0800)] 
Fix `make clangbuild` & add CI

Fix the errors for:
* `-Wdocumentation`
* `-Wconversion` except `-Wsign-conversion`

2 years ago[cmake] Add noexecstack to compiler/linker flags
Nick Terrell [Wed, 21 Dec 2022 23:02:27 +0000 (15:02 -0800)] 
[cmake] Add noexecstack to compiler/linker flags

2 years ago[cli-tests] Add --set-exact-output to update the expected output
Nick Terrell [Thu, 22 Dec 2022 01:21:09 +0000 (17:21 -0800)] 
[cli-tests] Add --set-exact-output to update the expected output

`./run.py --set-exact-output` will update `stdout.expect` and
`stderr.expect` to match the expected output. This doesn't apply to
outputs which use `.glob` or `.ignore`.

2 years ago[util] Add traces enabled by --trace-file-stat
Nick Terrell [Thu, 22 Dec 2022 01:00:44 +0000 (17:00 -0800)] 
[util] Add traces enabled by --trace-file-stat

Print traces to stderr when --trace-file-stat is passed.
We trace all functions that read and write file metadata.

2 years agoMerge pull request #3385 from jonpalmisc/improve_help
Yann Collet [Wed, 21 Dec 2022 18:56:09 +0000 (10:56 -0800)] 
Merge pull request #3385 from jonpalmisc/improve_help

Improve help/usage (`-h`, `-H`) formatting

2 years agoMerge pull request #3386 from felixhandte/pin-other-action-commit-hashes
Felix Handte [Wed, 21 Dec 2022 16:24:23 +0000 (11:24 -0500)] 
Merge pull request #3386 from felixhandte/pin-other-action-commit-hashes

Pin Remaining Action Dependencies (Except OSS-Fuzz)

2 years agoUpdate tests to expect new CLI help output 3385/head
Jon Palmisciano [Wed, 21 Dec 2022 01:11:37 +0000 (20:11 -0500)] 
Update tests to expect new CLI help output

2 years agoClean up welcome message
Jon Palmisciano [Wed, 21 Dec 2022 01:11:23 +0000 (20:11 -0500)] 
Clean up welcome message

2 years agoRewrite help output to improve readability
Jon Palmisciano [Tue, 20 Dec 2022 20:34:02 +0000 (15:34 -0500)] 
Rewrite help output to improve readability