Skip to content
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

(PUP-11515) Negative Lookbehind Regex Causes Duplicate Node #9420

Merged
merged 1 commit into from
Aug 1, 2024

Conversation

imaqsood
Copy link
Contributor

@imaqsood imaqsood commented Jul 22, 2024

Before this commit, two nodes could collide due to the lookaround Regex pattern. This issue arose because the regex was converted to a regular string by ignoring characters other than a-z, 0-9, _, and -.

For example, /(?<!a)sync/ was converted to "__node_regexp__async," and /async/ was also converted to "__node_regexp__async," causing an error that the node was already defined.

To prevent such duplication, this commit normalize the lookarround pattern from the regex, ensuring a unique string in case of lookarround pattern conflict.

For example, /(?<!a)sync/ will converted to "__node_regexp__LPQULTEXaRPsync" replacing (?<!a) to "LPQULTEXaRP" while converting to the string.

@imaqsood imaqsood force-pushed the PUP-11515 branch 2 times, most recently from 3e72ec0 to cf28a07 Compare July 24, 2024 06:20
Before this commit, two nodes could collide due to the lookaround
Regex pattern. This issue arose because the regex was converted to
a regular string by ignoring characters other than a-z, 0-9, _, and -.

For example, /(?<!a)sync/ was converted to "__node_regexp__async,"
and /async/ was also converted to "__node_regexp__async," causing
an error that the node was already defined.

To prevent such duplication, this commit normalize the lookarround
pattern from the regex, ensuring a unique string in case
of lookarround pattern conflict.

For example, /(?<!a)sync/ will converted to "__node_regexp__LPQULTEXaRPsync"
replacing (?<!a) to "LPQULTEXaRP" while converting to the string.
@imaqsood imaqsood merged commit 47a8df6 into puppetlabs:main Aug 1, 2024
9 checks passed
@joshcooper joshcooper added the bug Something isn't working label Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants