Repository navigation
Conversation
|
Hi @Mattbusel! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
parseAdaptParameters() only checked min <= max. A minimum below ZSTD_minCLevel() reached FIO_setAdaptMin(), whose assert aborts the default build with SIGABRT; with NDEBUG the value went through unchecked. Clamp both bounds to [MINCLEVEL, MAXCLEVEL], the way -# and --fast=# already clamp levels, so previously accepted values such as --adapt=max=99 keep working. Fixes meta#4980 Assisted-by: Claude:claude-opus-5-5
c91fccd to
f839634
Compare
What and why
Fixes #4980.
parseAdaptParameters()only checkedmin <= max. A minimum belowZSTD_minCLevel()then reachedFIO_setAdaptMin(), whoseassertaborts a defaultmakebuild:With
-DNDEBUGthe value went through unchecked.This PR clamps both bounds to
[MINCLEVEL, MAXCLEVEL]after the existing coherence check, the same way-#and--fast=#already clamp levels. I chose clamping over rejecting so that values the CLI accepts today, such as--adapt=max=99, keep working. To make that possible, theMINCLEVEL/MAXCLEVELdefines moved up aboveparseAdaptParameters(). They are unchanged, including theZSTD_NOCOMPRESSfallback.This does not overlap with #4873, which handles values above
INT_MAX.Checklist
Test
New cases in
tests/cli-tests/compression/adapt.sh:--adapt=min=-200000,min=-200000,max=-200000,min=1,max=200000andmin=200000,max=200000. All four must compress and round-trip throughzstd -t.Built on
dev(cfd06da) with the default Makefile flags, gcc on Debian x86_64:adapt.shfails ("Exit code mismatch! Expected 0 but got 1", from the SIGABRT).run.pypassescompression/adapt.sh,compression/levels.shandcompression/basic.sh.--adapt=min=10,max=9still exits 1 with "Incorrect parameter".make -C programs zstd-decompress(ZSTD_NOCOMPRESS) still builds.Tools used
Claude (Anthropic) helped write the change and the test. I reproduced the abort and ran the tests above myself. The commit has an
Assisted-bytrailer.