Closed Bug 818621 Opened 12 years ago Closed 12 years ago

Perl 5.16 complains with "Variable length lookbehind not implemented in regex" when the Example extension is enabled

Categories

(Bugzilla :: Extensions, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 4.2

People

(Reporter: selsky, Assigned: LpSolit)

References

Details

(Keywords: regression)

Attachments

(1 file)

Bug 745197 added a variable length lookbehind regex in the Example extension.

This causes a test failure.

t/001compile.t ....... 29/230 Variable length lookbehind not implemented in regex m/(?<=<td id="error_msg" class="throw_error">).*(?=</td>)/ at ./extensions/Example/Extension.pm line 412.
Compilation failed in require at Bugzilla/Extension.pm line 70.
I don't think you're right. I cannot figure out where the variable-length regex is.
$ /usr/local/bin/perl -e 's/(?<=<td id="error_msg" class="throw_error">).*(?=<\/td>)/$new_error_msg/si'
Variable length lookbehind not implemented in regex m/(?<=<td id="error_msg" class="throw_error">).*(?=</td>)/ at -e line 1.

Restricting the character set to ASCII seems to help.

$ /usr/local/bin/perl -e 's/(?<=<td id="error_msg" class="throw_error">).*(?=<\/td>)/$new_error_msg/siaa'

I'm running perl 5.16.1

It looks like behavior changed in perl 5.14 when additional Unicode support was added.
(In reply to Matt Selsky [:selsky] from comment #2)
> It looks like behavior changed in perl 5.14 when additional Unicode support
> was added.

It didn't change in 5.14, or at least 5.14 doesn't complain. AFAIK, only 5.16 is affected. Now you are no longer allowed to write "ss" in the regexp above ("ss" appears in the word "class"), else it's also seen as the german ß character. This is a completely stupid behavior from 5.16! We cannot use /aa either because it's only understood by Bugzilla 5.14 and newer. We could use \K instead, but it has been implemented in 5.10 only.

The workaround is trivial though. Patch coming.
Attached patch patch, v1Splinter Review
Assignee: extensions → LpSolit
Status: NEW → ASSIGNED
Attachment #689007 - Flags: review?(dkl)
Summary: Variable length lookbehind → Perl 5.16 complains with "Variable length lookbehind not implemented in regex" when the Example extension is enabled
Comment on attachment 689007 [details] [diff] [review]
patch, v1

Review of attachment 689007 [details] [diff] [review]:
-----------------------------------------------------------------

Otherwise looks good and works as expected. r=dkl

::: extensions/Example/Extension.pm
@@ +409,5 @@
>      $new_error_msg = html_quote($new_error_msg);
>      # There are better tools to parse an HTML page, but it's just an example.
> +    # Since Perl 5.16, we can no longer write "class" inside look-behind
> +    # assertions, because "ss" is also seen as the german ß character, which
> +    # makes Perl 5.16 to complain. The right fix is to use the /aa modifier,

nit: s/to complain/complain/
Attachment #689007 - Flags: review?(dkl) → review+
Flags: approval?
Flags: approval?
Flags: approval4.4+
Flags: approval4.2+
Flags: approval+
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/
modified extensions/Example/Extension.pm
Committed revision 8521.

Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/4.4/
modified extensions/Example/Extension.pm
Committed revision 8486.

Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/4.2/
modified extensions/Example/Extension.pm
Committed revision 8180.
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: