Repository navigation
Conversation
FIO_analyzeFrames() used dictID 0 both for "no frame seen yet" and for "frames disagree". After a mismatch reset it to 0, the next frame's ID was accepted again, so frames A,B,C reported C and A,B,A reported A, right after warning "Showing dictID 0 instead". A no-dictionary frame followed by a dictionary frame was not detected as a mismatch at all. Take the first frame's ID from numActualFrames == 0 and record the mismatch in a separate flag, so DictID stays 0 regardless of frame order and the warning is printed once. Also terminate the warning with a newline. Fixes meta#4985 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Hi @aldo01! 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! |
What and why
Fixes #4985.
FIO_analyzeFrames()useddictID == 0both for "no frame seen yet" and for "frames disagree". After a mismatch reset it to0, the next frame's ID was accepted again, sozstd -lvprinted the wrong value right after warning "Showing dictID 0 instead":DictID: CDictID: 0DictID: ADictID: 0DictID: ADictID: 0DictID: 0DictID: 0DictID: ADictID: AThe fix takes the first frame's ID when
numActualFrames == 0and records a mismatch in a separatemultipleDictIDsflag. As a result,DictIDstays0whatever the frame order, and the warning is printed once. The warning also gets the missing trailing newline; without it, the warning ran into the next line of output.Only
--listoutput changes. Compression and decompression are unaffected.Checklist
Test
New
tests/cli-tests/dictionaries/list-dictid.shuses the suite's two trained dictionaries plus a frame without a dictionary. It checks the reportedDictIDfor the ordersa b,a b a,none a,a noneanda a none, which must all give0, and fora a, which must give A's ID. It also checks that the warning appears exactly once and on its own line.On macOS arm64, default
makeflags:list-dictid.shfails.tests/cli-tests/run.pysuite passes (51 tests).zstd -l -vreports the wrong DictID for multi-frame files with different dictionaries #4985 now reportsDictID: 0for all mixed files andDictID: 111for a single-dictionary file.Tools used
GitHub Copilot (AI) helped find the problem while auditing
zstd --liston concatenated multi-frame files, and helped write the fix and the test. The reproducer and the test results above were checked on a local build. The commit carries aCo-authored-by: Copilottrailer.