Closed
Bug 898823
Opened 11 years ago
Closed 9 years ago
JavaScript `'cdefg'.match(/.?e.?/)` returns "cdefg"
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: joe.farro, Unassigned)
References
Details
(Keywords: regression)
Attachments
(1 file)
4.50 KB,
text/plain
|
Details |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:23.0) Gecko/20100101 Firefox/23.0 (Beta/Release)
Build ID: 20130725195523
Steps to reproduce:
Execute the following JavaScript in the Scratchpad:
var result = 'cdefg'.match(/.e.?/);
Object.keys(result).forEach(function(key) {
console.log(key + ':', result[key]);
});
Actual results:
result is:
--
[03:34:47.861] "0:" "cdefg"
[03:34:47.861] "index:" 0
[03:34:47.861] "input:" "cdefg"
Expected results:
result is:
--
[03:35:14.657] "0:" "def"
[03:35:14.657] "index:" 1
[03:35:14.657] "input:" "cdefg"
Comment 2•11 years ago
|
||
Is it the following typos? A quantifier "?" is missing?
var result = 'cdefg'.match(/.e.?/);
Flags: needinfo?(joe.farro)
Comment 3•11 years ago
|
||
STR
var result = 'cdefg'.match(/.?e.?/);
Object.keys(result).forEach(function(key) {
console.log(key + ':', result[key]);
});
Regression window(m-i)
Good:
http://hg.mozilla.org/integration/mozilla-inbound/rev/9b495a47e51d
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/19.0 Firefox/19.0 ID:20121101213244
Bad:
http://hg.mozilla.org/integration/mozilla-inbound/rev/8bf2f8cb5e73
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/19.0 Firefox/19.0 ID:20121101213645
Pushlog:
http://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=9b495a47e51d&tochange=8bf2f8cb5e73
Regressed by:
bf2f8cb5e73 David Anderson — Update Yarr to WebKit rev 130234 (bug 740015, r=dmandelin).
Blocks: 740015
Status: UNCONFIRMED → NEW
status-firefox22:
--- → affected
status-firefox-esr17:
--- → unaffected
tracking-firefox23:
--- → ?
tracking-firefox24:
--- → ?
tracking-firefox25:
--- → ?
Ever confirmed: true
Keywords: regression
OS: Mac OS X → All
Version: 23 Branch → 19 Branch
Comment 4•11 years ago
|
||
This is, indeed, an issue in Yarr itself: the result reproduces in Safari 6.0.5's jsc.
Interestingly, the regexp from comment 0's STR results in 'def', so the '.?' at the expression's end is interpreted correctly. Looks like an error in interpreting the first '.?' throws Yarr off.
I'll look if Yarr has a bug open for this and will file one, if not.
Flags: needinfo?(joe.farro)
A "?" quantifier is missing after initial "." in the regexp.
JavaScript code to reproduce should read:
var result = 'cdefg'.match(/.?e.?/);
Object.keys(result).forEach(function(key) {
console.log(key + ':', result[key]);
});
(In reply to joe.farro from comment #0)
> Execute the following JavaScript in the Scratchpad:
>
> var result = 'cdefg'.match(/.e.?/);
Seems to be a combination of both '.?' without a capturing group that causes the issue. The following are fine:
/.e./
/.?e./
/.e.?/
/(.?e.?)/
/(.?)e.?/
/.?e(.?)/
/.?(e).?/
http://jsfiddle.net/bJnHK/
(In reply to Till Schneidereit [:till] from comment #4)
> ... Looks like an error in
> interpreting the first '.?' throws Yarr off.
>
> I'll look if Yarr has a bug open for this and will file one, if not.
Comment 7•11 years ago
|
||
(In reply to joe.farro from comment #6)
> Seems to be a combination of both '.?' without a capturing group that causes
> the issue. The following are fine:
Yeah, and so is this one:
'cdefgh'.match('.?e.?g')
but not this one:
'cdefgh'.match('.?e.?g.?')
Looks like '.?' at the beginning and the end of a regexp breaks. That somewhat restricted set of conditions explains why we didn't stumble upon this much earlier.
Thanks for reporting, btw!
No problem!
It's from a question on stackoverflow:
http://stackoverflow.com/questions/17905625/e-matches-entire-string-rather-than-expected-substring
Comment 9•11 years ago
|
||
I filed https://bugs.webkit.org/show_bug.cgi?id=119191 for the Yarr issue.
Hardware: x86 → All
See Also: → https://bugs.webkit.org/show_bug.cgi?id=119191
Version: 19 Branch → Trunk
Comment 10•11 years ago
|
||
This is a regression from FF19 and that combined with the webkit aspect make this very much not a candidate for blocking release (unless I'm missing some user impact here that is newly aggravated). If a low risk fix is found, please nominate for uplift.
Assignee | ||
Updated•10 years ago
|
Assignee: general → nobody
Comment 11•9 years ago
|
||
No longer reproducible, 'cdefg'.match(/.?e.?/) returns ["def"]. Probably fixed when Yarr was replaced with irregexp. Resolving as WFM.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•