Closed Bug 635417 Opened 15 years ago Closed 15 years ago

Regular expression bug (breaks splinter patch review)

Categories

(Core :: JavaScript Engine, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
blocking2.0 --- final+

People

(Reporter: otaylor, Assigned: dmandelin)

References

Details

(Keywords: regression, Whiteboard: [hardblocker][has patch][fixed-in-tracemonkey])

Attachments

(3 files, 1 obsolete file)

Tested with Feb 18 nightly build firefox-4.0b12pre.en-US.linux-x86_64 - the bug is at least a few week old, but don't know exactly when it started. The regular expression: /^@(A*)x(B)*/ does not match the string: "@xB" I'll attach an obvious HTML/JS test case. The above is pretty much minimal - if you remove either of the parentheses the problem goes away. If you change the @ to a letter like C the problem goes away (?!?!) - though $ also reproduces the problem.
cdleary LOVES HIM SOME REGEXP. boy howdy.
blocking2.0: --- → ?
Attached file Test case —
I got this regression window while waiting for a build: http://hg.mozilla.org/mozilla-central/pushloghtml?startdate=2011-01-31&enddate=2011-02-01 It's probably bug 627609.
Blocks: 627609
blocking2.0: ? → final+
Whiteboard: hardblocker
The cause here is pretty simple: in our modified PCRE, we (try to) look at the op just before a bracket to see if it is OP_BRAZERO ("make the next bracket optional") and then "do stuff" based on that. It turns out that OP_BRAZERO == 64 == '@'--in this case, the position just before the first bracket is the character of the single-char match, not an actual opcode. We need to use a more robust way of tracking which brackets are supposed to be optional. I think we can put it in the BracketChainNode or something like that. Taking, but cdleary should feel free to steal.
Assignee: general → dmandelin
PCRE die die die! :-|. /be
Attached patch WIP (obsolete) — — Splinter Review
This doesn't work yet. It correctly passes the minSatisfied value from OP_BRAZERO to the bracket op. But it doesn't get to the KET that matches that bracket. ISTR that this seemed tricky and motivated the original incorrect solution.
Whiteboard: hardblocker → [hardblocker][needs patch]
This is proving fairly hard. I'm in the process of completely rewriting the empty-groups-handling logic. (That should sound somewhat scary but not too--probably less than 100 LOC.) ETA (median estimate) for patch ready for review is Thursday afternoon.
Attached patch Patch — — Splinter Review
Attachment #513678 - Attachment is obsolete: true
Attachment #514674 - Flags: review?(dvander)
Whiteboard: [hardblocker][needs patch] → [hardblocker][has patch]
I'm seeing some failures on xpcshell and mochitest-(browser-)chrome, so probably not quite done yet.
Whiteboard: [hardblocker][has patch] → [hardblocker]
Attached patch Smaller patch — — Splinter Review
This patch fixes the problem in this bug without fully overhauling the min-sat propagation logic. This is probably a better bet than the previous patch: the previous patch may fix some bugs we don't know about yet, but they are probably pretty subtle, and that patch has higher risk.
Attachment #514947 - Flags: review?(dvander)
Attachment #514947 - Flags: review?(dvander) → review+
Whiteboard: [hardblocker] → [hardblocker][has patch]
Attachment #514674 - Flags: review?(dvander)
Whiteboard: [hardblocker][has patch] → [hardblocker][has patch][fixed-in-tracemonkey]
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: