String#% incorrectly handles null bytes right after '%' in the pattern
----------------------------------------------------------------------

                 Key: JRUBY-1758
                 URL: http://jira.codehaus.org/browse/JRUBY-1758
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.x
         Environment: JRuby 1.1b1 from the trunk
            Reporter: Vladimir Sizikov
         Attachments: string-modulo-null-bytes.patch

Consider the following examples:

{noformat}
p "%\0" % []
p "%\0x he%x\05llo" % [1]
{noformat}

MRI, Rubinius print:
{noformat}
"%"
"%x he1\005llo"
{noformat}

JRuby fails twice with:
malformed format string (ArgumentError)

Also, this leads to one Rubinius spec failure:
12)
String#% ignores percent signs at end of string / before newlines, null bytes 
FAILED
malformed format string:
/opt/work/rubinius/./spec/core/string/modulo_spec.rb:57
/opt/work/rubinius/./spec/core/string/modulo_spec.rb:57:in `instance_eval'
./mspec/runner/runner.rb:121:in `describe'
./mspec/runner/object.rb:11:in `each'
./mspec/runner/runner.rb:115:in `describe'
./mspec/runner/object.rb:11:in `describe'
/opt/work/rubinius/./spec/core/string/modulo_spec.rb:4:in `describe'
/opt/work/rubinius/./spec/core/string/modulo_spec.rb:4:in `load'
tmp/last_mspec.rb:15:in `load'
tmp/last_mspec.rb:1:in `each'
tmp/last_mspec.rb:9:in `each'

The proposed patch (with regression tests) fixes the problem and the spec 
failures.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to