Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.6
    • Fix Version/s: JRuby 1.6.4, JRuby 1.7.0.pre1
    • Component/s: None
    • Labels:
      None
    • Environment:
      osx snow leopard
    • Testcase included:
      yes
    • Number of attachments :
      0

      Description

      String interpolation into regexes appears to break unicode property names.
      This script works under MRI 1.9.2.

      {{# encoding: UTF-8

      1. The following two scenarios work
        puts /[\p {L}]/u
        puts /[#{"
        p{L}

        "}]/u

      1. this one raises an exception
      2. RegexpError: (RegexpError) invalid character property name {L}: /\p{L}

        /
        b = "
        p

        {L}

        "
        puts /[#

        {b}

        ]/u}}

      This is currently preventing datamapper from running on jruby 1.9, because it uses this technique in dm-validations to validate email addresses.

        Activity

        Hide
        Xavier Shay added a comment -

        I fail at formatting .... here is a gist with the test case:

        https://gist.github.com/5dd56997b3e5a8b9eee6

        Show
        Xavier Shay added a comment - I fail at formatting .... here is a gist with the test case: https://gist.github.com/5dd56997b3e5a8b9eee6
        Hide
        Lucas Hills added a comment -

        Random 1 in a million.. I'm supposed to be at the ruby meeting in melb where you are right now Xavier. But instead I'm working and had just logged into here to report the same bug you already have..

        My stack trace is a little different but pretty sure it's the same bug as this one:

        http://stackoverflow.com/questions/5492960/regex-errorjavajavalangarrayindexoutofboundsexception-4-on-3-character-non/5493461#5493461

        Show
        Lucas Hills added a comment - Random 1 in a million.. I'm supposed to be at the ruby meeting in melb where you are right now Xavier. But instead I'm working and had just logged into here to report the same bug you already have.. My stack trace is a little different but pretty sure it's the same bug as this one: http://stackoverflow.com/questions/5492960/regex-errorjavajavalangarrayindexoutofboundsexception-4-on-3-character-non/5493461#5493461
        Hide
        Xavier Shay added a comment -

        Just an update that this bug is still present in 1.6.3, and it's just been introduced into ruby 1.9.3-preview1 as well

        http://redmine.ruby-lang.org/issues/5126

        Hopefully it ends up being a similar fix for both.

        For context, this technique is used in DataMapper to build up a regex to validate email addresses:
        https://github.com/datamapper/dm-validations/blob/master/lib/dm-validations/formats/email.rb

        Show
        Xavier Shay added a comment - Just an update that this bug is still present in 1.6.3, and it's just been introduced into ruby 1.9.3-preview1 as well http://redmine.ruby-lang.org/issues/5126 Hopefully it ends up being a similar fix for both. For context, this technique is used in DataMapper to build up a regex to validate email addresses: https://github.com/datamapper/dm-validations/blob/master/lib/dm-validations/formats/email.rb
        Hide
        Nick Sieger added a comment -

        Fixed in 70b3b99 on master and fcb28016 on jruby-1_6.

        Show
        Nick Sieger added a comment - Fixed in 70b3b99 on master and fcb28016 on jruby-1_6.
        Nick Sieger made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Thomas E Enebo [ enebo ] Nick Sieger [ nsieger ]
        Fix Version/s JRuby 1.6.4 [ 17472 ]
        Fix Version/s JRuby 1.7 [ 17049 ]
        Resolution Fixed [ 1 ]
        Charles Oliver Nutter made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Nick Sieger
            Reporter:
            Xavier Shay
          • Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: