]> git.ipfire.org Git - thirdparty/zstd.git/log
thirdparty/zstd.git
2 years agoUse File Descriptor in Setting Stat on Output File 3479/head
W. Felix Handte [Mon, 6 Feb 2023 16:05:47 +0000 (08:05 -0800)] 
Use File Descriptor in Setting Stat on Output File

Note that the `fd` is only valid while the file is still open. So we need to
move the setting calls to before we close the file. However! We cannot do so
with the `utime()` call (even though `futimens()` exists) because the follow-
ing `close()` call to the `fd` will reset the atime of the file. So it seems
the `utime()` call has to happen after the file is closed.

2 years agoIntroduce Variants of Some Functions that Take Optional File Descriptors
W. Felix Handte [Fri, 3 Feb 2023 21:48:34 +0000 (13:48 -0800)] 
Introduce Variants of Some Functions that Take Optional File Descriptors

Somewhat surprisingly, calling `fchmod()` is non-trivially faster than calling
`chmod()`, and so on.

This commit introduces alternate variants to some common file util functions
that take an optional fd. If present, they call the `f`-variant of the
underlying function. Otherwise, they fall back to the regular filename-taking
version of the function.

2 years agoAsyncIO performance regression for small files fix (#3474)
Yonatan Komornik [Thu, 2 Feb 2023 23:19:22 +0000 (15:19 -0800)] 
AsyncIO performance regression for small files fix (#3474)

- Do not use threaded AsyncIO when handling small files.
- Some typo / doc fixes

2 years agoFix ZSTD_getOffsetInfo() when nbSeq == 0
Nick Terrell [Thu, 2 Feb 2023 18:53:08 +0000 (10:53 -0800)] 
Fix ZSTD_getOffsetInfo() when nbSeq == 0

In 32-bit mode, ZSTD_getOffsetInfo() can be called when nbSeq == 0, and
in this case the offset table is uninitialized. The function should just
return 0 for both values, because there are no sequences.

Credit to OSS-Fuzz

2 years agoMerge pull request #3471 from embg/fast_seq_parse
Elliot Gorokhovsky [Thu, 2 Feb 2023 02:30:36 +0000 (21:30 -0500)] 
Merge pull request #3471 from embg/fast_seq_parse

Reduce external matchfinder API overhead by 25%

2 years agoassert externalRepSearch != ZSTD_ps_auto 3471/head
Elliot Gorokhovsky [Thu, 2 Feb 2023 02:24:46 +0000 (18:24 -0800)] 
assert externalRepSearch != ZSTD_ps_auto

2 years agoMerge pull request #3472 from terrelln/2023-02-01-fix-32-bit-decoding
Yann Collet [Thu, 2 Feb 2023 01:52:03 +0000 (17:52 -0800)] 
Merge pull request #3472 from terrelln/2023-02-01-fix-32-bit-decoding

Fix 32-bit decoding with large dictionary

2 years agoFix 32-bit decoding with large dictionary 3472/head
Nick Terrell [Thu, 2 Feb 2023 00:38:36 +0000 (16:38 -0800)] 
Fix 32-bit decoding with large dictionary

The 32-bit decoder could corrupt the regenerated data by using regular
offset mode when there were actually long offsets. This is because we
were only considering the window size in the calculation, not the
dictionary size. So a large dictionary could allow longer offsets.

Fix this in two ways:
1. Instead of looking at the window size, look at the total referencable
   bytes in the history buffer. Use this in the comparison instead of
   the window size. Additionally, we were comparing against the wrong
   value, it was too low. Fix that by computing exactly the maximum
   offset for regular sequence decoding.
2. If it is possible that we have long offsets due to (1), then check
   the offset code decoding table, and if the decoding table's maximum
   number of additional bits is no more than STREAM_ACCUMULATOR_MIN,
   then we can't have long offsets.

This gates us to be using the long offsets decoder only when we are very
likely to actually have long offsets.

Note that this bug only affects the decoding of the data, and the
original compressed data, if re-read with a patched decoder, will
correctly regenerate the orginal data. Except that the encoder also had
the same issue previously.

This fixes both the open OSS-Fuzz issues.

Credit to OSS-Fuzz

2 years agoadd ZSTD_c_fastExternalSequenceParsing cctxParam
Elliot Gorokhovsky [Tue, 31 Jan 2023 21:51:32 +0000 (13:51 -0800)] 
add ZSTD_c_fastExternalSequenceParsing cctxParam

2 years agoMerge pull request #3470 from facebook/bench_zstd_only
Yann Collet [Wed, 1 Feb 2023 00:22:20 +0000 (16:22 -0800)] 
Merge pull request #3470 from facebook/bench_zstd_only

ensure that benchmark mode can only be invoked with zstd format

2 years agoGuard against invalid sequences from external matchfinders (#3465)
Elliot Gorokhovsky [Tue, 31 Jan 2023 18:55:48 +0000 (13:55 -0500)] 
Guard against invalid sequences from external matchfinders (#3465)

2 years agoensure that benchmark mode can only be invoked with zstd format 3470/head
Yann Collet [Tue, 31 Jan 2023 16:59:27 +0000 (08:59 -0800)] 
ensure that benchmark mode can only be invoked with zstd format

fix #3463

2 years agoMerge pull request #3469 from facebook/updateVersion
Yann Collet [Tue, 31 Jan 2023 03:58:22 +0000 (19:58 -0800)] 
Merge pull request #3469 from facebook/updateVersion

bump version number to v1.5.4

2 years agoMerge pull request #3464 from facebook/dependabot/github_actions/github/codeql-action...
Yann Collet [Tue, 31 Jan 2023 03:07:33 +0000 (19:07 -0800)] 
Merge pull request #3464 from facebook/dependabot/github_actions/github/codeql-action-2.2.1

Bump github/codeql-action from 2.1.39 to 2.2.1

2 years agobump version number to v1.5.4 3469/head
Yann Collet [Tue, 31 Jan 2023 03:06:39 +0000 (19:06 -0800)] 
bump version number to v1.5.4

start preparation for release

2 years agoSimplify 32-bit long offsets decoding logic
Nick Terrell [Mon, 30 Jan 2023 19:15:15 +0000 (11:15 -0800)] 
Simplify 32-bit long offsets decoding logic

The previous code had an issue when `bitsConsumed == 32` it would read 0
bits for the `ofBits` read, which violates the precondition of
`BIT_readBitsFast()`. This can happen when the stream is corrupted.

Fix thie issue by always reading the maximum possible number of extra
bits. I've measured neutral decoding performance, likely because this
branch is unlikely, but this should be faster anyways. And if not, it is
only 32-bit decoding, so performance isn't as critical.

Credit to OSS-Fuzz

2 years agoMerge pull request #3460 from daniellerozenblit/fix-long-offsets-resolution-pointer
daniellerozenblit [Mon, 30 Jan 2023 19:02:51 +0000 (14:02 -0500)] 
Merge pull request #3460 from daniellerozenblit/fix-long-offsets-resolution-pointer

fix long offset resolution

2 years agoMerge branch 'fix-long-offsets-resolution-pointer' of github.com:daniellerozenblit... 3460/head
Danielle Rozenblit [Mon, 30 Jan 2023 14:26:21 +0000 (06:26 -0800)] 
Merge branch 'fix-long-offsets-resolution-pointer' of github.com:daniellerozenblit/zstd into fix-long-offsets-resolution-pointer

2 years agoremove big test around large offset with small window size
Danielle Rozenblit [Mon, 30 Jan 2023 14:26:03 +0000 (06:26 -0800)] 
remove big test around large offset with small window size

2 years agoBump github/codeql-action from 2.1.39 to 2.2.1 3464/head
dependabot[bot] [Mon, 30 Jan 2023 05:11:42 +0000 (05:11 +0000)] 
Bump github/codeql-action from 2.1.39 to 2.2.1

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

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

Signed-off-by: dependabot[bot] <support@github.com>
2 years agoUpdate .github/workflows/dev-long-tests.yml
daniellerozenblit [Sat, 28 Jan 2023 17:14:48 +0000 (12:14 -0500)] 
Update .github/workflows/dev-long-tests.yml

Co-authored-by: Nick Terrell <nickrterrell@gmail.com>
2 years agoFix invalid assert in 32-bit decoding
Nick Terrell [Fri, 27 Jan 2023 19:14:56 +0000 (11:14 -0800)] 
Fix invalid assert in 32-bit decoding

The assert is only correct for valid sequences, so disable it for
everything execpt round trip fuzzers.

2 years agoMerge branch 'fix-long-offsets-resolution-pointer' of github.com:daniellerozenblit...
Danielle Rozenblit [Fri, 27 Jan 2023 22:18:44 +0000 (14:18 -0800)] 
Merge branch 'fix-long-offsets-resolution-pointer' of github.com:daniellerozenblit/zstd into fix-long-offsets-resolution-pointer

2 years agoupdate CI
Danielle Rozenblit [Fri, 27 Jan 2023 22:18:29 +0000 (14:18 -0800)] 
update CI

2 years agoUpdate lib/compress/zstd_compress.c
daniellerozenblit [Fri, 27 Jan 2023 21:58:53 +0000 (16:58 -0500)] 
Update lib/compress/zstd_compress.c

Co-authored-by: Nick Terrell <nickrterrell@gmail.com>
2 years ago[fse] Delete unused functions
Nick Terrell [Fri, 27 Jan 2023 19:59:26 +0000 (11:59 -0800)] 
[fse] Delete unused functions

Delete all unused FSE functions, now that we are no longer syncing
to/from upstream.

This avoids confusion about Zstd's stack usage like in Issue #3453.
It also removes dead code, which is always a plus.

2 years agorecord long offsets in ZSTD_symbolEncodingTypeStats_t + add test case
Danielle Rozenblit [Fri, 27 Jan 2023 20:04:29 +0000 (12:04 -0800)] 
record long offsets in ZSTD_symbolEncodingTypeStats_t + add test case

2 years agoinitialize long offsets in decodecorpus
Danielle Rozenblit [Fri, 27 Jan 2023 17:52:00 +0000 (09:52 -0800)] 
initialize long offsets in decodecorpus

2 years agofix long offset resolution
Danielle Rozenblit [Fri, 27 Jan 2023 16:21:47 +0000 (08:21 -0800)] 
fix long offset resolution

2 years agoMerge pull request #3458 from facebook/stderr_finalStatus
Yann Collet [Fri, 27 Jan 2023 01:22:38 +0000 (17:22 -0800)] 
Merge pull request #3458 from facebook/stderr_finalStatus

Update logic when `stderr` is not the console

2 years ago[huf] Fix bug in fast C decoders
Nick Terrell [Thu, 26 Jan 2023 20:11:25 +0000 (12:11 -0800)] 
[huf] Fix bug in fast C decoders

The input bounds checks were buggy because they were only breaking from
the inner loop, not the outer loop. The fuzzers found this immediately.
The fix is to use `goto _out` instead of `break`.

This condition can happen on corrupted inputs.

I've benchmarked before and after on x86-64 and there were small changes
in performance, some positive, and some negative, and they end up about
balacing out.

Credit to  OSS-Fuzz

2 years agochange logic when stderr is not console : don't update progress status 3458/head
Yann Collet [Thu, 26 Jan 2023 19:43:27 +0000 (11:43 -0800)] 
change logic when stderr is not console : don't update progress status

but keep warnings and final operation statement.

updated tests/cli-tests/ accordingly

2 years agomodify cli-test logic : ignore stderr message by default
Yann Collet [Thu, 26 Jan 2023 00:29:34 +0000 (16:29 -0800)] 
modify cli-test logic : ignore stderr message by default

Previously, cli-test would, by default, check that a stderr output is strictly identical to a saved outcome.
When there was no instructions on how to interpret stderr, it would default to requiring it to be empty.

There are many tests cases though where stderr content doesn't matter, and we are mainly interested in the return code of the cli.
For these cases, it was possible to set a .ignore document, which would instruct to ignore stderr content.

This PR update the logic, to make .ignore the default.
When willing to check that stderr content is empty, one must now add an empty .strict file.

This will allow status message to evolve without triggering many cli-tests errors.
This is especially important when some of these status include compression results, which may change as a result of compression optimizations.
It also makes it easier to add new tests which only care about the CLI's return code.

2 years agoMerge pull request #3457 from yoniko/fix-rowhash-cli
Yonatan Komornik [Thu, 26 Jan 2023 06:40:25 +0000 (22:40 -0800)] 
Merge pull request #3457 from yoniko/fix-rowhash-cli

[Bugfix] CLI row hash flags set the wrong values

`--[no-]row-match-finder` do the opposite of what they are supposed to.
In effect the no option would activate row hash while the other option will disable it.
This commit fixes the issue and changes the code to use the more readable enum values.

2 years agoBugfix: `--[no-]row-match-finder` do the opposite of what they are supposed to 3457/head
Yonatan Komornik [Thu, 26 Jan 2023 01:59:35 +0000 (17:59 -0800)] 
Bugfix: `--[no-]row-match-finder` do the opposite of what they are supposed to

2 years agoMerge pull request #3450 from facebook/no_rm_on_o
Yann Collet [Thu, 26 Jan 2023 01:51:53 +0000 (17:51 -0800)] 
Merge pull request #3450 from facebook/no_rm_on_o

disable --rm on -o command

2 years agoenforce a hard fail when input files are set to be erased 3450/head
Yann Collet [Thu, 26 Jan 2023 00:18:20 +0000 (16:18 -0800)] 
enforce a hard fail when input files are set to be erased

in scenarios where it's supposed to not be possible.

suggested by @terrelln

2 years agodisable --rm on -o command
Yann Collet [Tue, 24 Jan 2023 02:55:51 +0000 (18:55 -0800)] 
disable --rm on -o command

make it more similar to -c (aka `stdout`) convention.

2 years agoMerge pull request #3455 from facebook/fix3454
Yann Collet [Wed, 25 Jan 2023 23:22:51 +0000 (15:22 -0800)] 
Merge pull request #3455 from facebook/fix3454

Provide more accurate error codes for busy-loop scenarios

2 years ago[version-test] Work around bugs in v0.7.3 dict builder
Nick Terrell [Tue, 24 Jan 2023 04:23:43 +0000 (20:23 -0800)] 
[version-test] Work around bugs in v0.7.3 dict builder

Before calling a dictionary good, make sure that it can compress an
input. If v0.7.3 rejects v0.7.3's dictionary, fall back to the v1.0
dictionary. This is not the job of the verison test to test it, because
we cannot fix this code.

2 years ago[huf] Add generic C versions of the fast decoding loops
Nick Terrell [Sat, 14 Jan 2023 00:34:52 +0000 (16:34 -0800)] 
[huf] Add generic C versions of the fast decoding loops

Add generic C versions of the fast decoding loops to serve architectures
that don't have an assembly implementation. Also allow selecting the C
decoding loop over the assembly decoding loop through a zstd
decompression parameter `ZSTD_d_disableHuffmanAssembly`.

I benchmarked on my Intel i9-9900K and my Macbook Air with an M1 processor.
The benchmark command forces zstd to compress without any matches, using
only literals compression, and measures only Huffman decompression speed:

```
zstd -b1e1 --compress-literals --zstd=tlen=131072 silesia.tar
```

The new fast decoding loops outperform the previous implementation uniformly,
but don't beat the x86-64 assembly. Additionally, the fast C decoding loops suffer
from the same stability problems that we've seen in the past, where the assembly
version doesn't. So even though clang gets close to assembly on x86-64, it still
has stability issues.

| Arch    | Function       | Compiler     | Default (MB/s) | Assembly (MB/s) | Fast (MB/s) |
|---------|----------------|--------------|----------------|-----------------|-------------|
| x86-64  | decompress 4X1 | gcc-12.2.0   |         1029.6 |          1308.1 |      1208.1 |
| x86-64  | decompress 4X1 | clang-14.0.6 |         1019.3 |          1305.6 |      1276.3 |
| x86-64  | decompress 4X2 | gcc-12.2.0   |         1348.5 |          1657.0 |      1374.1 |
| x86-64  | decompress 4X2 | clang-14.0.6 |         1027.6 |          1659.9 |      1468.1 |
| aarch64 | decompress 4X1 | clang-12.0.5 |         1081.0 |             N/A |      1234.9 |
| aarch64 | decompress 4X2 | clang-12.0.5 |         1270.0 |             N/A |      1516.6 |

2 years agoProvide more accurate error codes for busy-loop scenarios 3455/head
Yann Collet [Wed, 25 Jan 2023 21:07:53 +0000 (13:07 -0800)] 
Provide more accurate error codes for busy-loop scenarios

fixes #3454

2 years agoMerge pull request #3447 from daniellerozenblit/fuzz-sequence-compression
daniellerozenblit [Wed, 25 Jan 2023 14:27:34 +0000 (09:27 -0500)] 
Merge pull request #3447 from daniellerozenblit/fuzz-sequence-compression

Fuzz large offsets through sequence compression api

2 years agoMerge pull request #3452 from daniellerozenblit/fix-seekable-32bit
daniellerozenblit [Wed, 25 Jan 2023 14:23:34 +0000 (09:23 -0500)] 
Merge pull request #3452 from daniellerozenblit/fix-seekable-32bit

Fix 32-bit build errors in zstd seekable format

2 years agofix 32bit build errors in zstd seekable 3452/head
Danielle Rozenblit [Tue, 24 Jan 2023 23:53:59 +0000 (15:53 -0800)] 
fix 32bit build errors in zstd seekable

2 years agoMerge pull request #3451 from yoniko/red-zones-bugfix
Yonatan Komornik [Tue, 24 Jan 2023 22:32:56 +0000 (14:32 -0800)] 
Merge pull request #3451 from yoniko/red-zones-bugfix

Bugfix redzone unpoisoning

2 years agoBug fix redzones by unpoisoning only the intended buffer and not the followup redzone. 3451/head
Yonatan Komornik [Tue, 24 Jan 2023 20:54:43 +0000 (12:54 -0800)] 
Bug fix redzones by unpoisoning only the intended buffer and not the followup redzone.

2 years agofix bound check for ZSTD_copySequencesToSeqStoreNoBlockDelim() 3447/head
Danielle Rozenblit [Tue, 24 Jan 2023 14:40:40 +0000 (06:40 -0800)] 
fix bound check for ZSTD_copySequencesToSeqStoreNoBlockDelim()

2 years agoMerge pull request #3448 from facebook/embg-doc-fix
Elliot Gorokhovsky [Mon, 23 Jan 2023 20:04:53 +0000 (15:04 -0500)] 
Merge pull request #3448 from facebook/embg-doc-fix

Fix ZSTD_estimate* and ZSTD_initCStream() docs

2 years agoMerge branch 'dev' into fuzz-sequence-compression
Danielle Rozenblit [Mon, 23 Jan 2023 19:11:33 +0000 (11:11 -0800)] 
Merge branch 'dev' into fuzz-sequence-compression
for testing

2 years agoMerge pull request #3439 from daniellerozenblit/sequence-validation-bug-fix
daniellerozenblit [Mon, 23 Jan 2023 18:50:37 +0000 (13:50 -0500)] 
Merge pull request #3439 from daniellerozenblit/sequence-validation-bug-fix

Fix sequence validation and seqStore bounds check

2 years agocalloc dictionary in sequence compression fuzzer rather than generating a random...
Danielle Rozenblit [Mon, 23 Jan 2023 18:42:09 +0000 (10:42 -0800)] 
calloc dictionary in sequence compression fuzzer rather than generating a random buffer

2 years agoFix ZSTD_estimate* and ZSTD_initCStream() docs 3448/head
Elliot Gorokhovsky [Mon, 23 Jan 2023 18:28:36 +0000 (13:28 -0500)] 
Fix ZSTD_estimate* and ZSTD_initCStream() docs

Fix the following documentation bugs:
* Note that `ZSTD_estimate*` functions are not compatible with the external matchfinder API
* Note that `ZSTD_estimateCStreamSize_usingCCtxParams()` is not compatible with `nbWorkers >= 1`
* Remove incorrect warning that the legacy streaming API is incompatible with advanced parameters and/or dictionary compression
* Note that `ZSTD_initCStream()` is incompatible with dictionary compression
* Warn that

2 years agoMerge pull request #3443 from facebook/no_rm_w_stdout
Yann Collet [Mon, 23 Jan 2023 18:22:11 +0000 (10:22 -0800)] 
Merge pull request #3443 from facebook/no_rm_w_stdout

refactor : --rm ignored with stdout

2 years agoFix -Wstringop-overflow warning
Nick Terrell [Fri, 20 Jan 2023 19:29:52 +0000 (11:29 -0800)] 
Fix -Wstringop-overflow warning

Backported from kernel patch [0].

I wasn't able to reproduce the warning locally, but could repro it in
the kernel.

[0] https://lore.kernel.org/lkml/20220330193352.GA119296@embeddedor/

2 years agoupdate external sequence error to fit error naming scheme 3439/head
Danielle Rozenblit [Mon, 23 Jan 2023 17:58:34 +0000 (09:58 -0800)] 
update external sequence error to fit error naming scheme

2 years agoMerge pull request #3446 from facebook/dependabot/github_actions/github/codeql-action...
Elliot Gorokhovsky [Mon, 23 Jan 2023 16:55:13 +0000 (11:55 -0500)] 
Merge pull request #3446 from facebook/dependabot/github_actions/github/codeql-action-2.1.39

Bump github/codeql-action from 2.1.38 to 2.1.39

2 years agomerge dev
Danielle Rozenblit [Mon, 23 Jan 2023 16:12:19 +0000 (08:12 -0800)] 
merge dev

2 years agofix nits and add new error code for invalid external sequences
Danielle Rozenblit [Mon, 23 Jan 2023 15:59:02 +0000 (07:59 -0800)] 
fix nits and add new error code for invalid external sequences

2 years agomodify sequence compression api fuzzer
Danielle Rozenblit [Mon, 23 Jan 2023 15:55:11 +0000 (07:55 -0800)] 
modify sequence compression api fuzzer

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 agoupdate man 3443/head
Yann Collet [Sat, 21 Jan 2023 02:07:55 +0000 (18:07 -0800)] 
update man

2 years agorefactor : --rm is ignored with stdout
Yann Collet [Sat, 21 Jan 2023 01:53:05 +0000 (17:53 -0800)] 
refactor : --rm is ignored with stdout

`zstd` CLI has progressively moved to the policy of
ignoring `--rm` command when the output is `stdout`.
The primary drive is to feature a behavior more consistent with `gzip`,
when `--rm` is the default, but is also ignored when output is `stdout`.
Other policies are certainly possible, but would break from this `gzip` convention.

The new policy was inconsistenly enforced, depending on the exact list of commands.
For example, it was possible to circumvent it by using `-c --rm` in this order,
which would re-establish source removal.

- Update the CLI so that it necessarily catch these situations and ensure that `--rm` is always disabled when output is `stdout`.
- Added a warning message in this case (for verbosity 3 `-v`).
- Added an `assert()`, which controls that `--rm` is no longer active with `stdout`
- Added tests, which control the behavior, even when `--rm` is added after `-c`
- Removed some legacy code which where trying to apply a specific policy for the `stdout` + `--rm` case, which is no longer possible

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 agofix sequence validation and bounds check in ZSTD_copySequencesToSeqStore()
Danielle Rozenblit [Fri, 20 Jan 2023 18:32:35 +0000 (10:32 -0800)] 
fix sequence validation and bounds check in ZSTD_copySequencesToSeqStore()

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.