Skip to content

fix header parser single quote bug #22996

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 15, 2025

Conversation

demerphq
Copy link
Collaborator

HeaderParser.pm - parse single quoted backslash properly

@khwilliamson gave me a test script which was breaking because we did not handle single quoted escapes like '\' and '\n' and the like. This fixes the tokenizer pattern to handle these without dieing, although we do not validate that the escape sequence itself is legal, we no longer choke on having backslash something in the single quote.

This patch sequence also includes a commit which teaches t/porting/header_parser.t how to update its own Data::Dumper based test. Updating this test manually was annoying, so I made the script do it for us when needed.

  • This set of changes does not require a perldelta entry.

@demerphq demerphq force-pushed the yves/fix_HeaderParser_single_quote_bug branch 2 times, most recently from 107cc35 to 963ec8c Compare February 14, 2025 04:17
We were not handling things like '\\' '\x01' nor 'ABCD' (multichar
constants), nor were we handling spaces in expressions like "defined
(foo)", also we weren't testing that we were warning free.

This patch also includes support for auto-updating the two larger tests
in t/porting/header_parser.t, now if you set the env var
PERL_DEV_UPDATE_TESTFILE to a true value and run the script it will
autoupdate the script with the latest output that is generated.
@demerphq demerphq force-pushed the yves/fix_HeaderParser_single_quote_bug branch from 963ec8c to 0d349a6 Compare February 14, 2025 06:22
There are constructor options to control this, but we default
to on.
@demerphq demerphq force-pushed the yves/fix_HeaderParser_single_quote_bug branch from 92eac9c to 6b26526 Compare February 14, 2025 13:08
@demerphq demerphq merged commit 511f0ef into blead Feb 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants