A packed option flag can be misread as its two-letter variant - #98
Merged
Conversation
The engine reads a packed -... token one character at a time, so a %r, %m or %Z followed by the wrong letter turns into the two-letter form that eats the next argv token. With WARC on and CheckType empty the packed string spelled %rs, the engine took it for --warc-max-size, and the first crawl URL went with it. SimpleOption, SimpleOption0, SimpleOptionFlag and the four merge handlers now push one token each; LongOptionFlag, which sidestepped this for --sitemap/--single-file/--changes, is dropped. The shared buffer stays for the flags with no two-letter variant. The digit check and int parse move into a pure OptionValues, which stops MaxSizeHandler and BuildHandler from pulling in OptionsMapper's Android-dependent static init and makes them testable. Closes #78 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Xavier Roche <roche@httrack.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The engine reads a packed
-...token one character at a time, so a%r,%mor%Zfollowed by the wrong letter turns into the two-letter form that eats the next argv token. With WARC on and CheckType empty the packed string spelled%rs, the engine took it for--warc-max-size, and the first crawl URL went with it. Each-token is parsed on its own, so the threeSimpleOption*classes and the four merge handlers now emit one token each, andLongOptionFlag(added in #77 to sidestep this for--sitemap,--single-fileand--changes) is gone. The shared buffer stays forLogHandler,PrimaryScanHandlerandMultipleChoicesOption, whose flags have no two-letter variant.The digit check and int parse move into a pure
OptionValues, which stopsMaxSizeHandlerandBuildHandlerfrom pulling inOptionsMapper's Android-dependent static init and makes them testable (#81). Mutate the fix back to packing and the new test fails withtoken -X0%rs2%s spells %rs.Closes #78