From 18e1f38949786308747c302d00b0569c00420e99 Mon Sep 17 00:00:00 2001 From: liuzhilin Date: Mon, 10 Nov 2025 14:08:24 +0800 Subject: [PATCH] backport upstream patch --- ...ined-names-in-automated_benchmarking.patch | 41 +++++++++++++++++++ ...mingw-warnings-calloc-argument-order.patch | 40 ++++++++++++++++++ zstd.spec | 8 +++- 3 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 Fix-undefined-names-in-automated_benchmarking.patch create mode 100644 fix-mingw-warnings-calloc-argument-order.patch diff --git a/Fix-undefined-names-in-automated_benchmarking.patch b/Fix-undefined-names-in-automated_benchmarking.patch new file mode 100644 index 0000000..1062aa2 --- /dev/null +++ b/Fix-undefined-names-in-automated_benchmarking.patch @@ -0,0 +1,41 @@ +From c72eea13bff1e3c1c68e9428a69b0399ff10e91d Mon Sep 17 00:00:00 2001 +From: Christian Clauss +Date: Thu, 23 Oct 2025 06:08:36 +0200 +Subject: [PATCH] Fix undefined names in automated_benchmarking.py + +Fix variable name typos in automated_benchmarking.py + +% `ruff check` +``` +Error: tests/automated_benchmarking.py:237:21: F821 Undefined name `baseline_label` +Error: tests/automated_benchmarking.py:250:21: F821 Undefined name `baseline_label` +Error: tests/automated_benchmarking.py:318:55: F821 Undefined name `frequenc` +Error: Process completed with exit code 1. +``` +% [`ruff rule F821`](https://docs.astral.sh/ruff/rules/undefined-name) +--- + tests/automated_benchmarking.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/automated_benchmarking.py b/tests/automated_benchmarking.py +index 153e7db4c84..0935d1db4e1 100644 +--- a/tests/automated_benchmarking.py ++++ b/tests/automated_benchmarking.py +@@ -225,7 +225,7 @@ def get_regressions_dictionary(baseline_build, test_build, filenames_directory, + for j, level in enumerate(levels): + old_cspeed, old_dspeed = old[j] + new_cspeed, new_dspeed = new[j] +- cspeed_reg, dspeed_reg, baesline_label, test_label = parse_regressions_and_labels( ++ cspeed_reg, dspeed_reg, baseline_label, test_label = parse_regressions_and_labels( + old_cspeed, new_cspeed, old_dspeed, new_dspeed, baseline_build, test_build + ) + if cspeed_reg > CSPEED_REGRESSION_TOLERANCE: +@@ -315,7 +315,7 @@ def main(filenames, levels, iterations, builds=None, emails=None, continuous=Fal + quit() + + if mode == "onetime": +- main(filenames, levels, iterations, frequency=frequenc, dictionary_filename=dictionary_filename) ++ main(filenames, levels, iterations, frequency=frequency, dictionary_filename=dictionary_filename) + elif mode == "current": + builds = [{"user": None, "branch": "None", "hash": None}] + main(filenames, levels, iterations, builds, frequency=frequency, dictionary_filename=dictionary_filename) diff --git a/fix-mingw-warnings-calloc-argument-order.patch b/fix-mingw-warnings-calloc-argument-order.patch new file mode 100644 index 0000000..da1a50b --- /dev/null +++ b/fix-mingw-warnings-calloc-argument-order.patch @@ -0,0 +1,40 @@ +From 5539fcfb6afb6ac1acf223bcef7de71449572896 Mon Sep 17 00:00:00 2001 +From: Yann Collet +Date: Thu, 23 Oct 2025 07:01:01 -0700 +Subject: [PATCH] minor: fix mingw warnings: calloc argument order + +--- + tests/paramgrill.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/tests/paramgrill.c b/tests/paramgrill.c +index 869e966e05c..718196c9bbe 100644 +--- a/tests/paramgrill.c ++++ b/tests/paramgrill.c +@@ -1242,7 +1242,7 @@ static int createBuffers(buffers_t* buff, const char* const * const fileNamesTab + size_t n; + size_t totalSizeToLoad = (size_t)UTIL_getTotalFileSize(fileNamesTable, (U32)nbFiles); + size_t benchedSize = MIN(BMK_findMaxMem(totalSizeToLoad * 3) / 3, totalSizeToLoad); +- size_t* fileSizes = calloc(sizeof(size_t), nbFiles); ++ size_t* fileSizes = calloc(nbFiles, sizeof(size_t)); + void* srcBuffer = NULL; + int ret = 0; + +@@ -1457,7 +1457,7 @@ createMemoTableArray(const paramValues_t p, + const size_t varyLen, + const U32 memoTableLog) + { +- memoTable_t* const mtAll = (memoTable_t*)calloc(sizeof(memoTable_t),(ZSTD_STRATEGY_MAX + 1)); ++ memoTable_t* const mtAll = (memoTable_t*)calloc((ZSTD_STRATEGY_MAX + 1), sizeof(memoTable_t)); + ZSTD_strategy i, stratMin = ZSTD_STRATEGY_MIN, stratMax = ZSTD_STRATEGY_MAX; + + if(mtAll == NULL) { +@@ -1494,7 +1494,7 @@ createMemoTableArray(const paramValues_t p, + mtl = ((size_t)1 << memoTableLog); + } + +- mtAll[i].table = (BYTE*)calloc(sizeof(BYTE), mtl); ++ mtAll[i].table = (BYTE*)calloc(mtl, sizeof(BYTE)); + mtAll[i].tableLen = mtl; + + if(mtAll[i].table == NULL) { diff --git a/zstd.spec b/zstd.spec index 3ae6ab1..ac4fcd6 100644 --- a/zstd.spec +++ b/zstd.spec @@ -2,13 +2,15 @@ Name: zstd Version: 1.5.7 -Release: 5 +Release: 6 Summary: A fast lossless compression algorithm License: BSD-3-Clause AND GPL-2.0-only URL: https://github.com/facebook/zstd Source0: https://github.com/facebook/zstd/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz Patch9000: update-rm-command-description.patch +Patch9001: fix-mingw-warnings-calloc-argument-order.patch +Patch9002: Fix-undefined-names-in-automated_benchmarking.patch BuildRequires: gcc gcc-c++ BuildRequires: cmake >= 3.10 @@ -96,6 +98,10 @@ install -D -m644 programs/%{name}.1 %{buildroot}%{_mandir}/man1/p%{name}.1 %doc %{_datadir}/doc/zstd/zstd_manual.html %changelog +* Mon Nov 10 2025 liuzhilin - 1.5.7-6 +- Fix undefined names in automated_benchmarking.py +- fix mingw warnings calloc argument order + * Sun Nov 09 2025 Funda Wang - 1.5.7-5 - force support of zlib, lzma and lz4 -- Gitee