Summary

utf8 regexp bug with underscores

Metadata

Attachments

Description

Only in utf8 mode, regexp seems to have a bug with negated charsets containing underscores in either POSIX REs or SREs. I'm not sure but I think any charset with one underscore and one or more other chars is affected.

Irregex has the same problem but only when called with option 'utf8.

I'm using chicken-experimental 4.5.8 without irregex 0.8, so perhaps this bug is fixed in irregex 0.8? I haven't checked. I know this occurs back to Chicken 4.5.0 at least.

 #;> (use utf8)
 #;> (regexp "[^_]")
 #<regexp>
 #;> (regexp "[^a_b]")
 Error: (cddr) bad argument type: ()
 #;> (regexp "[^a_]")
 Error: (cddr) bad argument type: ()
 #;> (regexp "[^_a]")
 Error: (cddr) bad argument type: ()
 #;> (regexp '(~ #\_ #\a))
 Error: (cddr) bad argument type: ()
 
 #;> (irregex '(~ #\_ #\a))
 #(*irregex-tag* ...)
 #;> (irregex '(~ #\_ #\a) 'utf8)
 Error: (cddr) bad argument type: ()

Changes and comments

[2010-08-22 11:27:40 UTC] felix changed status from new to assigned

[2010-08-22 11:27:40 UTC] felix set owner to sjamaan

[2010-08-24 12:09:25 UTC] felix changed milestone from 4.6.0 to 4.7.0

[2010-09-01 20:44:29 UTC] sjamaan wrote:

It does not crap out in the new version of irregex because the cset API has changed in such a way that it will never include bare characters in charsets, which means this bug should not get triggered (the assumption is still there, but it is now correct).

Here's a quick hack that fixes it for Chicken 4.6.0, if it should still get in.

[2010-09-01 20:44:53 UTC] sjamaan attached irregex-utf8-nonranges.patch (description=#f)

[2010-09-02 09:18:08 UTC] felix wrote:

Replying to sjamaan: > It does not crap out in the new version of irregex because the cset API has changed in such a way that it will never include bare characters in charsets, which means this bug should not get triggered (the assumption is still there, but it is now correct). > > Here's a quick hack that fixes it for Chicken 4.6.0, if it should still get in.

Thanks for the patch, but I don't think this will make it into the 4.6.0 release.

[2010-09-02 20:47:02 UTC] sjamaan wrote:

Then I'll close it wontfix, since 4.7.0 should include the new irregex. Please reopen if you disagree.

[2010-09-02 20:47:02 UTC] sjamaan changed status from assigned to closed

[2010-09-02 20:47:02 UTC] sjamaan set resolution to wontfix

[2011-06-01 09:00:41 UTC] felix changed milestone from 4.7.0 to 4.8.0

[2011-06-01 09:00:41 UTC] felix wrote:

Milestone 4.7.0 deleted

[2012-09-24 21:47:48 UTC] felix changed milestone from 4.8.0 to 4.9.0

[2012-09-24 21:47:48 UTC] felix wrote:

Milestone 4.8.0 deleted