]> git.ipfire.org Git - thirdparty/zstd.git/log
thirdparty/zstd.git
2 years agomeson: mark a known test failure on Windows 3120/head
Eli Schwartz [Wed, 20 Apr 2022 01:08:02 +0000 (21:08 -0400)] 
meson: mark a known test failure on Windows

2 years agomeson: add Windows CI
Eli Schwartz [Thu, 15 Dec 2022 02:57:59 +0000 (21:57 -0500)] 
meson: add Windows CI

There are a couple of oddities here. We don't attempt to build e.g.
contrib, because that doesn't seem to work at the moment. Also notice
that each command is its own step. This happens because github actions
runs in powershell, which doesn't seem to let you abort on the first
failure.

2 years agomeson: add Linux CI
Eli Schwartz [Thu, 15 Dec 2022 02:46:09 +0000 (21:46 -0500)] 
meson: add Linux CI

Travis is no longer run, but this wasn't ported to something else.

2 years agomeson: add support for running both fast and slow version of tests
Eli Schwartz [Thu, 15 Dec 2022 02:10:41 +0000 (21:10 -0500)] 
meson: add support for running both fast and slow version of tests

playTests.sh has an option to run really slow tests. This is enabled by
default in Meson, but what we really want is to do like the Makefile,
and run the fast ones by default, but with an option to run the slow
ones instead.

2 years agomeson: don't require valgrind tests
Eli Schwartz [Wed, 20 Apr 2022 00:58:33 +0000 (20:58 -0400)] 
meson: don't require valgrind tests

It's entirely possible some people don't have valgrind installed, but
still want to run the tests. If they don't have it installed, then they
probably don't intend to run those precise test targets anyway.

Also, this solves an error when running the tests in an automated
environment. The valgrind tests have a hard dependency on behavior such
as `./zstd` erroring out with the message "stdin is a console, aborting"
which does not work if the automated environment doesn't have a console.
As a rough heuristic, automated environments lacking a console will
*probably* also not have valgrind, so avoiding that test definition
neatly sidesteps the issue.

Also, valgrind is not easily installable on macOS, at least homebrew
says it isn't available there. This makes it needlessly hard to
enable the testsuite on macOS.

2 years ago[circleci] Try to re-enable aarch64build
Nick Terrell [Fri, 16 Dec 2022 00:55:31 +0000 (16:55 -0800)] 
[circleci] Try to re-enable aarch64build

Update CircleCI to focal and try to re-enable aarch64build.

Fixes #2785 if it works.

2 years agoMerge pull request #3368 from eli-schwartz/meson-execinfo-bool
Yonatan Komornik [Fri, 16 Dec 2022 17:14:53 +0000 (09:14 -0800)] 
Merge pull request #3368 from eli-schwartz/meson-execinfo-bool

meson: fix broken commit that broke the build

2 years agoAdd missing parens around macro definition
Nick Terrell [Fri, 16 Dec 2022 00:22:26 +0000 (16:22 -0800)] 
Add missing parens around macro definition

Fixes #3301.

2 years agomeson: fix warning for using too-new features 3368/head
Eli Schwartz [Fri, 16 Dec 2022 00:34:25 +0000 (19:34 -0500)] 
meson: fix warning for using too-new features

In commit 031de3c69ccbf3282ed02fb49369b476730aeca8 a feature of Meson
0.50.0 was added, but the minimum specified version of Meson is 0.48.0.
Meson therefore emitted a warning:

WARNING: Project targets '>=0.48.0' but uses feature introduced in '0.50.0': required arg in compiler.has_header.

And if anyone actually used Meson 0.48.0 to build with, it would error
out with mysterious claims that the build file itself is invalid, rather
than telling the user to install a newer version of Meson.

Solve this by bumping the minimum version to align with reality. This
e.g. drops support for Debian oldstable (buster)'s packaged version of
Meson, but still works if backports are enabled, or if the user can
`pip install` a newer version.

2 years agomeson: fix broken commit that broke the build
Eli Schwartz [Fri, 16 Dec 2022 00:48:22 +0000 (19:48 -0500)] 
meson: fix broken commit that broke the build

In commit 031de3c69ccbf3282ed02fb49369b476730aeca8 some code was added
that returned a boolean, but was treated as if it returned a dependency
object. This wasn't tested and could not work. Moreover, zstd no longer
built at all unless the entire programs directory was disabled and not
even evaluated.

Fix the return type checking.

2 years agoMerge branch 'dev' of github.com:facebook/zstd into dev
Yann Collet [Thu, 15 Dec 2022 23:58:42 +0000 (15:58 -0800)] 
Merge branch 'dev' of github.com:facebook/zstd into dev

2 years agoUpdate documentation link to html format
Yann Collet [Thu, 15 Dec 2022 23:56:11 +0000 (15:56 -0800)] 
Update documentation link to html format

fix #3319

2 years agomeson: partial fix for building pzstd on MSVC
Eli Schwartz [Wed, 14 Dec 2022 22:23:24 +0000 (17:23 -0500)] 
meson: partial fix for building pzstd on MSVC

It uses non-portable compiler options unconditionally. Elsewhere, we
check the compiler ID and only add the right ones, globally. Do the same
here.

NDEBUG can actually be handled by a core option, so while we are moving
things around, do so.

Unfortunately, this doesn't fix things entirely. The remaining issue is
not Meson's issue though -- MSVC simply does not like this source code
and somehow chokes on innocent code with the inscrutable "syntax error"
and "illegal token".

2 years agoFix corruption that rarely occurs in 32-bit mode with wlog=25
Nick Terrell [Thu, 15 Dec 2022 21:43:27 +0000 (13:43 -0800)] 
Fix corruption that rarely occurs in 32-bit mode with wlog=25

Fix an off-by-one error in the compressor that emits corrupt blocks if:

* Zstd is compiled in 32-bit mode
* The windowLog == 25 exactly
* An offset of 2^25-3, 2^25-2, 2^25-1, or 2^25 is emitted
* The bitstream had 7 bits leftover before writing the offset

This bug has been present since before v1.0, but wasn't able to easily
be triggered, since until somewhat recently zstd wasn't able to find
matches that were within 128KB of the window size.

Add a test case, and fix 2 bugs in `ZSTD_compressSequences()`:
* The `ZSTD_isRLE()` check was incorrect. It wouldn't produce
  corruption, but it could waste CPU and not emit RLE even if the block
  was RLE
* One windowSize was `1 << windowLog`, not `1u << windowLog`

Thanks to @tansy for finding the issue, and giving us a reproducer!

Fixes Issue #3350.

2 years agoadded mention of compilation flags
Yann Collet [Thu, 15 Dec 2022 18:46:47 +0000 (10:46 -0800)] 
added mention of compilation flags

2 years agoMerge pull request #3352 from daniellerozenblit/http-to-https
daniellerozenblit [Thu, 15 Dec 2022 16:25:55 +0000 (11:25 -0500)] 
Merge pull request #3352 from daniellerozenblit/http-to-https

Convert references to https from http

2 years agoMerge branch 'dev' into http-to-https 3352/head
daniellerozenblit [Thu, 15 Dec 2022 15:46:13 +0000 (10:46 -0500)] 
Merge branch 'dev' into http-to-https

2 years ago[legacy] Remove FORCE_MEMORY_ACCESS and only use memcpy
Nick Terrell [Thu, 15 Dec 2022 00:07:22 +0000 (16:07 -0800)] 
[legacy] Remove FORCE_MEMORY_ACCESS and only use memcpy

Delete unaligned memory access code from the legacy codebase by removing all the
non-memcpy functions. We don't care about speed at all for this codebase, only
simplicity.

2 years ago[decompress] Fix nullptr addition & improve fuzzer
Nick Terrell [Thu, 15 Dec 2022 01:00:54 +0000 (17:00 -0800)] 
[decompress] Fix nullptr addition & improve fuzzer

Fix an instance of `NULL + 0` in `ZSTD_decompressStream()`. Also, improve our
`stream_decompress` fuzzer to pass `NULL` in/out buffers to
`ZSTD_decompressStream()`, and fix 2 issues that were immediately surfaced.

Fixes #3351

2 years ago[fileio] Separate parameter adaption from display update rate
Nick Terrell [Wed, 14 Dec 2022 23:17:05 +0000 (15:17 -0800)] 
[fileio] Separate parameter adaption from display update rate

Split the logic for parameter adaption from the logic to update the display rate.
This decouples the two updates, so changes to display updates don't affect
parameter adaption.

Also add a test case that checks that parameter adaption actually happens.

This fixes Issue #3353, where --adapt is broken when --no-progress is passed.

2 years agoUse proper unaligned access attributes
Alex Xu (Hello71) [Mon, 29 Nov 2021 02:54:24 +0000 (21:54 -0500)] 
Use proper unaligned access attributes

Instead of using packed attribute hack, just use aligned attribute. It
improves code generation on armv6 and armv7, and slightly improves code
generation on aarch64. GCC generates identical code to regular aligned
access on ARMv6 for all versions between 4.5 and trunk, except GCC 5
which is buggy and generates the same (bad) code as packed access:
https://gcc.godbolt.org/z/hq37rz7sb

2 years agoRefactor progress bar & summary line logic
Nick Terrell [Fri, 7 Jan 2022 23:07:28 +0000 (15:07 -0800)] 
Refactor progress bar & summary line logic

* Centralize the logic about whether to print the progress bar or not in
  the `*_PROGRESS()` macros.
* Centralize the logc about whether to print the summary line or not in
  `FIO_shouldDisplayFileSummary()` and
  `FIO_shouldDisplayMultipleFileSummary()`.
* Make `--progress` work for non-zstd (de)compressors.
* Clean up several edge cases in compression and decompression progress
  printing along the way. E.g. wrong log level, or missing summary line.

One thing I don't like about stdout mode, which sets the display level
to 1, is that warnings aren't displayed. After this PR, we could change
stdout mode from lowering the display level, to defaulting to implied
`--no-progress`. But, I think that deserves a separate PR.

2 years agoAllow tests to fake stdin/stdout/stderr is a console
Nick Terrell [Fri, 14 Jan 2022 20:37:32 +0000 (12:37 -0800)] 
Allow tests to fake stdin/stdout/stderr is a console

We've been unable to effectively test cases where stdin/stdout/stderr
are consoles, because in our test cases they generally aren't. Allow the
command line flags `--fake-std{in,out,err}-is-console` to tell the CLI
to pretend that std{in,out,err} is a console.

2 years agomeson: make backtrace dependency on execinfo
Rosen Penev [Wed, 28 Sep 2022 23:17:53 +0000 (16:17 -0700)] 
meson: make backtrace dependency on execinfo

musl libc for example has no such header.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2 years agoMerge pull request #3346 from daniellerozenblit/seekable-format-empty-string
daniellerozenblit [Wed, 14 Dec 2022 19:28:32 +0000 (14:28 -0500)] 
Merge pull request #3346 from daniellerozenblit/seekable-format-empty-string

Seekable format empty string

2 years agoMerge pull request #3349 from embg/frame_header_fields
Elliot Gorokhovsky [Wed, 14 Dec 2022 15:58:35 +0000 (10:58 -0500)] 
Merge pull request #3349 from embg/frame_header_fields

Reserve two fields in ZSTD_frameHeader

2 years agoConvert references to https from http
Danielle Rozenblit [Wed, 14 Dec 2022 14:58:35 +0000 (06:58 -0800)] 
Convert references to https from http

2 years agoFix C90 compat 3349/head
Elliot Gorokhovsky [Wed, 14 Dec 2022 02:01:32 +0000 (18:01 -0800)] 
Fix C90 compat

2 years agoReserve two fields in ZSTD_frameHeader
Elliot Gorokhovsky [Wed, 14 Dec 2022 01:45:05 +0000 (17:45 -0800)] 
Reserve two fields in ZSTD_frameHeader

2 years ago[contrib][linux-kernel] Fix stack detection for newer gcc
Nick Terrell [Tue, 13 Dec 2022 23:03:23 +0000 (15:03 -0800)] 
[contrib][linux-kernel] Fix stack detection for newer gcc

Newer gcc versions were getting smart and omitting the `memset()`.
Get around this issue by outlining the `memset()` into a different
function. This test is still hacky, but it works...

2 years agoMerge pull request #3345 from daniellerozenblit/fix-1GiB-file-bug
daniellerozenblit [Tue, 13 Dec 2022 22:56:38 +0000 (17:56 -0500)] 
Merge pull request #3345 from daniellerozenblit/fix-1GiB-file-bug

Fix Window Resizing Edge Case

2 years agoMerge pull request #3347 from facebook/fix_m68k_ci
Yann Collet [Tue, 13 Dec 2022 22:05:37 +0000 (14:05 -0800)] 
Merge pull request #3347 from facebook/fix_m68k_ci

Fix m68k CI tests on Github Actions

2 years agouse .ignore for stderr output in window-resize test case 3345/head
Danielle Rozenblit [Tue, 13 Dec 2022 21:52:54 +0000 (13:52 -0800)] 
use .ignore for stderr output in window-resize test case

2 years agoadded test to cli-tests
Danielle Rozenblit [Tue, 13 Dec 2022 20:45:41 +0000 (12:45 -0800)] 
added test to cli-tests

2 years agoFix m68k CI tests on Github Actions 3347/head
Yann Collet [Tue, 13 Dec 2022 20:26:34 +0000 (12:26 -0800)] 
Fix m68k CI tests on Github Actions

seems there is a bug in the qemu version shipped with Ubuntu 22.04

2 years agofix window resizing edge case
Danielle Rozenblit [Tue, 13 Dec 2022 16:35:20 +0000 (08:35 -0800)] 
fix window resizing edge case

2 years agofree memory in test case 3346/head
Danielle Rozenblit [Tue, 13 Dec 2022 16:15:16 +0000 (08:15 -0800)] 
free memory in test case

2 years agoMerge pull request #10 from yhoogstrate/seekable_header_skip
daniellerozenblit [Mon, 12 Dec 2022 22:58:58 +0000 (17:58 -0500)] 
Merge pull request #10 from yhoogstrate/seekable_header_skip

seekable_format no header when compressing empty string to stream

2 years agoPrint checksum value for single frame files in cli with -v -l options
FRex [Thu, 20 Oct 2022 19:46:50 +0000 (21:46 +0200)] 
Print checksum value for single frame files in cli with -v -l options

2 years agoMerge pull request #3337 from facebook/dependabot/github_actions/microsoft/setup...
Yann Collet [Mon, 12 Dec 2022 07:59:25 +0000 (23:59 -0800)] 
Merge pull request #3337 from facebook/dependabot/github_actions/microsoft/setup-msbuild-1.1.3

Bump microsoft/setup-msbuild from 1.0.2 to 1.1.3

2 years agoMerge pull request #3339 from facebook/dependabot/github_actions/skx/github-action...
Yann Collet [Mon, 12 Dec 2022 07:59:07 +0000 (23:59 -0800)] 
Merge pull request #3339 from facebook/dependabot/github_actions/skx/github-action-publish-binaries-release-2.0

Bump skx/github-action-publish-binaries from release-1.3 to 2.0

2 years agoBump skx/github-action-publish-binaries from release-1.3 to 2.0 3339/head
dependabot[bot] [Thu, 8 Dec 2022 18:39:55 +0000 (18:39 +0000)] 
Bump skx/github-action-publish-binaries from release-1.3 to 2.0

Bumps [skx/github-action-publish-binaries](https://github.com/skx/github-action-publish-binaries) from release-1.3 to 2.0. This release includes the previously tagged commit.
- [Release notes](https://github.com/skx/github-action-publish-binaries/releases)
- [Commits](https://github.com/skx/github-action-publish-binaries/compare/release-1.3...release-2.0)

---
updated-dependencies:
- dependency-name: skx/github-action-publish-binaries
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years agoBump microsoft/setup-msbuild from 1.0.2 to 1.1.3 3337/head
dependabot[bot] [Thu, 8 Dec 2022 18:39:49 +0000 (18:39 +0000)] 
Bump microsoft/setup-msbuild from 1.0.2 to 1.1.3

Bumps [microsoft/setup-msbuild](https://github.com/microsoft/setup-msbuild) from 1.0.2 to 1.1.3.
- [Release notes](https://github.com/microsoft/setup-msbuild/releases)
- [Changelog](https://github.com/microsoft/setup-msbuild/blob/master/building-release.md)
- [Commits](https://github.com/microsoft/setup-msbuild/compare/v1.0.2...v1.1.3)

---
updated-dependencies:
- dependency-name: microsoft/setup-msbuild
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years agoMerge pull request #3284 from DimitriPapadopoulos/actions
Yann Collet [Thu, 8 Dec 2022 18:39:21 +0000 (10:39 -0800)] 
Merge pull request #3284 from DimitriPapadopoulos/actions

Automatically update GitHub Actions in the future

2 years agoMerge pull request #3320 from cwoffenden/msvc-arm64-size_t
Yann Collet [Mon, 5 Dec 2022 02:55:30 +0000 (18:55 -0800)] 
Merge pull request #3320 from cwoffenden/msvc-arm64-size_t

Fix for MSVC C4267 warning on ARM64 (which becomes error C2220 with /WX)

2 years agoMerge pull request #3331 from embg/issue3330
Elliot Gorokhovsky [Fri, 2 Dec 2022 23:34:37 +0000 (18:34 -0500)] 
Merge pull request #3331 from embg/issue3330

Fix gcc-7 and gcc-8 CI breakages

2 years agoFix gcc-7 and gcc-8 CI breakages 3331/head
Elliot Gorokhovsky [Fri, 2 Dec 2022 17:39:06 +0000 (12:39 -0500)] 
Fix gcc-7 and gcc-8 CI breakages

2 years agoMerge pull request #3327 from eli-schwartz/meson-version-simplify
Yann Collet [Thu, 1 Dec 2022 14:46:23 +0000 (06:46 -0800)] 
Merge pull request #3327 from eli-schwartz/meson-version-simplify

meson: get version up front

2 years agomeson: get version up front 3327/head
Eli Schwartz [Sun, 6 Nov 2022 01:52:51 +0000 (21:52 -0400)] 
meson: get version up front

Run the scraper command to establish the project version immediately,
rather than wait for the build to be configured. This simplifies the
code and ensures that project introspection works correctly.

2 years agominor : reorder --help
Yann Collet [Tue, 22 Nov 2022 15:23:45 +0000 (07:23 -0800)] 
minor : reorder --help

more logical context grouping

2 years agominor: proper pledgedSrcSize trace
Yann Collet [Tue, 22 Nov 2022 14:00:45 +0000 (06:00 -0800)] 
minor: proper pledgedSrcSize trace

2 years agoMerge pull request #3321 from embg/ldmCparamFix
Elliot Gorokhovsky [Mon, 21 Nov 2022 22:37:59 +0000 (17:37 -0500)] 
Merge pull request #3321 from embg/ldmCparamFix

Complete migration of ZSTD_c_enableLongDistanceMatching to ZSTD_paramSwitch_e framework

2 years agoMigrate other test usages of boolean LDM flag to paramSwitch enum 3321/head
Elliot Gorokhovsky [Mon, 21 Nov 2022 21:20:38 +0000 (16:20 -0500)] 
Migrate other test usages of boolean LDM flag to paramSwitch enum

2 years agoFix fuzzer failure
Elliot Gorokhovsky [Mon, 21 Nov 2022 21:09:04 +0000 (16:09 -0500)] 
Fix fuzzer failure

2 years agoImprove LDM cparam validation logic
Elliot Gorokhovsky [Mon, 21 Nov 2022 20:39:18 +0000 (15:39 -0500)] 
Improve LDM cparam validation logic

2 years agoRandom edit to re-run the CI 3320/head
Carl Woffenden [Sat, 19 Nov 2022 18:04:08 +0000 (19:04 +0100)] 
Random edit to re-run the CI

I don't believe the (x64) Mac failure is related to error since it would take the SSE path.

2 years agoFix for MSVC C4267 error
Carl Woffenden [Fri, 18 Nov 2022 10:31:17 +0000 (11:31 +0100)] 
Fix for MSVC C4267 error

2 years agoMerge pull request #3300 from yiyuaner/dev
Elliot Gorokhovsky [Wed, 2 Nov 2022 19:28:02 +0000 (15:28 -0400)] 
Merge pull request #3300 from yiyuaner/dev

Fix the wrong check for buffer overrun in UTIL_mergeFileNamesTable

2 years agoMerge pull request #3309 from joycebrum/dev
Felix Handte [Tue, 1 Nov 2022 21:53:37 +0000 (17:53 -0400)] 
Merge pull request #3309 from joycebrum/dev

Fix action error by upgrading Scorecard GHA to 2.0.6

2 years agofix: upgrade scorecard action to 2.0.6 3309/head
Joyce Brum [Tue, 1 Nov 2022 17:55:31 +0000 (14:55 -0300)] 
fix: upgrade scorecard action to 2.0.6

Signed-off-by: Joyce Brum <joycebrum@google.com>
2 years agoMerge pull request #3304 from GermanAizek/dev
Elliot Gorokhovsky [Tue, 1 Nov 2022 16:45:42 +0000 (12:45 -0400)] 
Merge pull request #3304 from GermanAizek/dev

Rewrite check *bufStart condition

2 years agoRewrite checking condition bufStart pointer NULL 3304/head
appleman4321 [Mon, 31 Oct 2022 23:31:09 +0000 (02:31 +0300)] 
Rewrite checking condition bufStart pointer NULL

2 years agoFix the wrong check for buffer overrun in UTIL_mergeFileNamesTable 3300/head
yiyuaner [Mon, 24 Oct 2022 12:37:15 +0000 (20:37 +0800)] 
Fix the wrong check for buffer overrun in UTIL_mergeFileNamesTable

2 years ago[contrib][linux] Disable ASM in the kernel
Nick Terrell [Tue, 18 Oct 2022 01:40:06 +0000 (18:40 -0700)] 
[contrib][linux] Disable ASM in the kernel

Disable ASM in the kernel for now. It requires a few changes & setup to
get working. Instead of doing it in a zstd version update, I'd prefer to
package that change as a single patch, and propose it separately from
the version update. This makes the version update easier, and reduces
some risk.

2 years ago[contrib][linux] Add zstd_common module
Nick Terrell [Mon, 17 Oct 2022 20:07:41 +0000 (13:07 -0700)] 
[contrib][linux] Add zstd_common module

The zstd_common module was added upstream in commit
https://github.com/torvalds/linux/commit/637a642f5ca5e850186bb64ac75ebb0f124b458d.

But the kernel specific code was inlined into the library. This commit
switches it to use the out of line method that we use for the other
modules.

2 years ago[lazy] Use switch instead of indirect function calls. (#3295)
Nick Terrell [Sat, 22 Oct 2022 00:14:02 +0000 (17:14 -0700)] 
[lazy] Use switch instead of indirect function calls. (#3295)

Use a switch statement to select the search function instead of an
indirect function call. This results in a sizable performance win.

This PR is a modification of the approach taken in PR #2828.
When I measured performance for that commit, it was neutral.
However, I now see a performance regression on gcc, but still
neutral on clang. I'm measuring on the same platform, but with
newer compilers. The new approach beats both the current dev
branch and the baseline before PR #2828 was merged.

This PR is necessary for Issue #3275, to update zstd in the kernel.
Without this PR there is a large regression in greedy - btlazy2
compression speed. With this PR it is about neutral.

gcc version: 12.2.0
clang version: 14.0.6
dataset: silesia.tar

| Compiler | Level | Dev Speed (MB/s) | PR Speed (MB/s) | Delta  |
|----------|-------|------------------|-----------------|--------|
| gcc      |     5 |            102.6 |           113.7 | +10.8% |
| gcc      |     7 |             66.6 |            74.8 | +12.3% |
| gcc      |     9 |             51.5 |            58.9 | +14.3% |
| gcc      |    13 |             14.3 |            14.3 |  +0.0% |
| clang    |     5 |            108.1 |           114.8 |  +6.2% |
| clang    |     7 |             68.5 |            72.3 |  +5.5% |
| clang    |     9 |             53.2 |            56.2 |  +5.6% |
| clang    |    13 |             14.3 |            14.7 |  +2.8% |

The binary size stays just about the same for clang and gcc, measured
using the `size` command:

| Compiler | Branch | Text    | Data | BSS | Total   |
|----------|--------|---------|------|-----|---------|
| gcc      | dev    | 1127950 | 3312 | 280 | 1131542 |
| gcc      | PR     | 1123422 | 2512 | 280 | 1126214 |
| clang    | dev    | 1046254 | 3256 | 216 | 1049726 |
| clang    | PR     | 1048198 | 2296 | 216 | 1050710 |

2 years ago[contrib][linux-kernel] Generate SPDX license identifiers (#3294)
Miguel Ojeda [Tue, 18 Oct 2022 23:35:44 +0000 (01:35 +0200)] 
[contrib][linux-kernel] Generate SPDX license identifiers (#3294)

Add a `--spdx` option to the freestanding script to prefix
files with a line like (for `.c` files):

    // SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause

or (for `.h` and `.S` files):

    /* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */

Given the style of the line to be used depends on the extension,
a simple `sed` insert command would not work.

It also skips the file if an existing SPDX line is there,
as well as raising an error if an unexpected SPDX line appears
anywhere else in the file, as well as for unexpected
file extensions.

I double-checked that all currently generated files appear
to be license as expected with:

    grep -LRF 'This source code is licensed under both the BSD-style license (found in the'  linux/lib/zstd
    grep -LRF 'LICENSE file in the root directory of this source tree) and the GPLv2 (found' linux/lib/zstd

but somebody knowledgable on the licensing of the project should
double-check this is the intended case.

Fixes: https://github.com/facebook/zstd/issues/3293
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2 years agoMerge pull request #3290 from felixhandte/ddict-dict-id-from-ddict
Felix Handte [Tue, 18 Oct 2022 17:33:32 +0000 (13:33 -0400)] 
Merge pull request #3290 from felixhandte/ddict-dict-id-from-ddict

Make ZSTD_getDictID_fromDDict() Read DictID from DDict

2 years agoMerge pull request #3285 from daniellerozenblit/optimal-huff-depth
daniellerozenblit [Tue, 18 Oct 2022 14:31:44 +0000 (10:31 -0400)] 
Merge pull request #3285 from daniellerozenblit/optimal-huff-depth

Optimal huf depth

2 years agoMake fuzzing work without ZSTD_MULTITHREAD (#3291)
Daniel Kutenin [Mon, 17 Oct 2022 21:31:47 +0000 (22:31 +0100)] 
Make fuzzing work without ZSTD_MULTITHREAD (#3291)

2 years agoNo longer pass srcSize to minTableLog 3285/head
Danielle Rozenblit [Mon, 17 Oct 2022 15:03:44 +0000 (08:03 -0700)] 
No longer pass srcSize to minTableLog

2 years agoMinor simplication: no longer need to check src size if using cardinality for minTableLog
Danielle Rozenblit [Mon, 17 Oct 2022 14:55:07 +0000 (07:55 -0700)] 
Minor simplication: no longer need to check src size if using cardinality for minTableLog

2 years agoMerge pull request #3288 from facebook/cleanThreadPool
Yann Collet [Sat, 15 Oct 2022 06:59:03 +0000 (23:59 -0700)] 
Merge pull request #3288 from facebook/cleanThreadPool

Cleaner threadPool initialization

2 years agoMake ZSTD_getDictID_fromDDict() Read DictID from DDict 3290/head
W. Felix Handte [Sat, 15 Oct 2022 02:53:03 +0000 (22:53 -0400)] 
Make ZSTD_getDictID_fromDDict() Read DictID from DDict

Currently this function actually reads the dict ID from the dictionary's
header, via `ZSTD_getDictID_fromDict()`. But during decompression the decomp-
ressor actually compares the dict ID in the frame header with the dict ID in
the DDict. Now of course the dict ID in the dictionary contents and the dict
ID in the DDict struct *should* be the same. But in cases of memory corrupt-
ion, where they can drift out of sync, it's misleading for this function to
read it again from the dict buffer rather then return the dict ID that will
actually be used.

Also doing it this way avoids rechecking the magic and so on and so it is a
tiny bit more efficient.

2 years agoUpdate regression results and better variable naming for HUF_cardinality
Danielle Rozenblit [Fri, 14 Oct 2022 20:37:19 +0000 (13:37 -0700)] 
Update regression results and better variable naming for HUF_cardinality

2 years agoUpdate threshold to use optimal depth
Danielle Rozenblit [Fri, 14 Oct 2022 18:29:32 +0000 (11:29 -0700)] 
Update threshold to use optimal depth

2 years agoAdditional ratio optimizations
Danielle Rozenblit [Fri, 14 Oct 2022 17:37:35 +0000 (10:37 -0700)] 
Additional ratio optimizations

2 years agofix issue #3119 3288/head
Yann Collet [Thu, 28 Apr 2022 03:51:56 +0000 (20:51 -0700)] 
fix issue #3119

fix segfault error when running zstreamtest with MALLOC_PERTURB_

2 years agoUpdate regression results
Danielle Rozenblit [Wed, 12 Oct 2022 20:49:44 +0000 (13:49 -0700)] 
Update regression results

2 years agoreplaced Zstandard by zstd in man page
Yann Collet [Wed, 12 Oct 2022 06:32:18 +0000 (23:32 -0700)] 
replaced Zstandard by zstd in man page

identified by @paulmenzel in #3286

2 years agoMerge branch 'optimal-huff-depth' of github.com:daniellerozenblit/zstd into optimal...
Danielle Rozenblit [Tue, 11 Oct 2022 21:45:50 +0000 (14:45 -0700)] 
Merge branch 'optimal-huff-depth' of github.com:daniellerozenblit/zstd into optimal-huff-depth

2 years agoSet threshold to use optimal table log
Danielle Rozenblit [Tue, 11 Oct 2022 21:33:25 +0000 (14:33 -0700)] 
Set threshold to use optimal table log

2 years agoMerge branch 'facebook:dev' into optimal-huff-depth
daniellerozenblit [Tue, 11 Oct 2022 20:15:23 +0000 (16:15 -0400)] 
Merge branch 'facebook:dev' into optimal-huff-depth

2 years agoCI failure fixes
Danielle Rozenblit [Tue, 11 Oct 2022 20:12:19 +0000 (13:12 -0700)] 
CI failure fixes

2 years agoAutomatically update GitHub Actions in the future 3284/head
Dimitri Papadopoulos [Mon, 10 Oct 2022 11:44:57 +0000 (13:44 +0200)] 
Automatically update GitHub Actions in the future

2 years agoMerge pull request #3281 from ilyakurdyukov/patch-1
Yann Collet [Sat, 8 Oct 2022 05:56:45 +0000 (22:56 -0700)] 
Merge pull request #3281 from ilyakurdyukov/patch-1

fixed zstd-pgo target for GCC

2 years agozstd-pgo: also clean zstd binary from objects 3281/head
Ilya Kurdyukov [Wed, 5 Oct 2022 17:38:23 +0000 (00:38 +0700)] 
zstd-pgo: also clean zstd binary from objects

Just a precaution, because it works anyway.

2 years agofixed zstd-pgo target for GCC
Ilya Kurdyukov [Wed, 5 Oct 2022 10:32:16 +0000 (17:32 +0700)] 
fixed zstd-pgo target for GCC

Since your Makefile uses obj/$(HASH_DIR) for object files, this code does not work correctly for GCC. Because profiles are saved in one directory, and are expected in another when reading.

`$(RM) zstd *.o` - this line doesn't delete object files.

Clang stores profiles in the current directory, so the problem doesn't appear when compiling with Clang.

Also this code will work if BUILD_DIR is set.

2 years agoMerge pull request #3277 from felixhandte/ossf-scorecard
Felix Handte [Mon, 3 Oct 2022 18:33:21 +0000 (14:33 -0400)] 
Merge pull request #3277 from felixhandte/ossf-scorecard

Enable OpenSSF Scorecard Action

2 years agoRestrict from Running on Forks 3277/head
W. Felix Handte [Mon, 3 Oct 2022 15:23:29 +0000 (11:23 -0400)] 
Restrict from Running on Forks

2 years agoCreate scorecards.yml
Felix Handte [Tue, 27 Sep 2022 20:54:39 +0000 (16:54 -0400)] 
Create scorecards.yml

Addresses #3269.

2 years agoMerge pull request #3273 from MaskRay/deprecated
Yann Collet [Wed, 28 Sep 2022 17:30:22 +0000 (10:30 -0700)] 
Merge pull request #3273 from MaskRay/deprecated

Move ZSTD_DEPRECATED before ZSTDLIB_API/ZSTDLIB_STATIC_API

2 years agoMove ZSTD_DEPRECATED before ZSTDLIB_API/ZSTDLIB_STATIC_API 3273/head
Fangrui Song [Thu, 22 Sep 2022 19:30:21 +0000 (12:30 -0700)] 
Move ZSTD_DEPRECATED before ZSTDLIB_API/ZSTDLIB_STATIC_API

Clang doesn't allow [[deprecated(...)]] attribute after __attribute__.
Move [[deprecated(...)]] before __attribute__ to fix C++14/C++17 uses
with Clang.

Fix #3250

2 years agoMerge pull request #3267 from Tachi107/pkg-config-ci
Yann Collet [Thu, 22 Sep 2022 19:00:06 +0000 (12:00 -0700)] 
Merge pull request #3267 from Tachi107/pkg-config-ci

ci: test pkg-config file

2 years agoMerge pull request #3274 from facebook/copycctx
Yann Collet [Thu, 22 Sep 2022 18:50:53 +0000 (11:50 -0700)] 
Merge pull request #3274 from facebook/copycctx

[minor] refactor publication of ZSTD_copyCCtx()

2 years agominor: refactor publication of ZSTD_copyCCtx() 3274/head
Yann Collet [Thu, 22 Sep 2022 18:14:21 +0000 (11:14 -0700)] 
minor: refactor publication of ZSTD_copyCCtx()

for improved clarity

2 years agoRemoved unused variable (#3272)
Yonatan Komornik [Thu, 22 Sep 2022 15:20:46 +0000 (08:20 -0700)] 
Removed unused variable (#3272)

2 years agoFix for `zstd` CLI accepts bogus values for numeric parameters (#3268)
ctkhanhly [Wed, 21 Sep 2022 20:20:01 +0000 (13:20 -0700)] 
Fix for `zstd` CLI accepts bogus values for numeric parameters (#3268)

* add checks to mal-formed numeric values for memory and memlimit parameters

Signed-off-by: Ly Cao <lycao@fb.com>
* changed errorMsg to a literal string instead of static string in main

* moved bogus numeric error to NEXT_UINT32 + add macro NEXT_TSIZE

Signed-off-by: Ly Cao <lycao@fb.com>
Signed-off-by: Ly Cao <lycao@fb.com>
Co-authored-by: Ly Cao <lycao@fb.com>
2 years agoci: test pkg-config file 3267/head
Andrea Pappacoda [Tue, 20 Sep 2022 20:13:23 +0000 (22:13 +0200)] 
ci: test pkg-config file

As mentioned in
https://github.com/facebook/zstd/pull/3252#issuecomment-1251733791 ,
this patch adds a CI job that builds and installs libzstd on the job
runner, and then compiles a sample binary linking against the installed
library; the needed build flags are passed by invoking pkg-config.

2 years agoMerge pull request #3252 from Tachi107/build-cmake-pkg-config-always
Yann Collet [Tue, 20 Sep 2022 18:31:15 +0000 (11:31 -0700)] 
Merge pull request #3252 from Tachi107/build-cmake-pkg-config-always

build(cmake): improve pkg-config generation