Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: JRuby 1.6.8
    • Component/s: None
    • Labels:
      None
    • Environment:
      jruby 1.6.7 (ruby-1.9.2-p312) (2012-02-22 3e82bc8) (Java HotSpot(TM) 64-Bit Server VM 1.7.0_02) [Windows 7-amd64-java]
      jruby 1.6.7 (ruby-1.8.7-p357) (snip)
    • Number of attachments :
      1

      Description

      Hi.

      I encountered the following problem when use gem 'Launchy' version 2.0.5 on JRuby 1.6.7 (1.9 mode).

      ----------
      launchy http://www.jruby.org/
      Failure in opening http://www.jruby.org/ with options {}: can't convert Launchy::Detect::HostOs into String
      ----------

      I investigate the cause of this problem, as a result, guessed that the problem is a bug of JRuby 1.9 mode.

      I have attached script for reproduce this problem.

      when this script run on jruby 1.9 mode, script was failed.

      Script result of JRuby 1.9 mode
      https://gist.github.com/1908767

      but, when run on JRuby 1.8 and C Ruby 1.9.2, script was finished successfully.

      Script result of JRuby 1.8 mode
      https://gist.github.com/1908775

      Script result of C Ruby 1.9.2
      https://gist.github.com/1908781

      Thanks.

        Activity

        Hide
        Charles Oliver Nutter added a comment -

        Thank you for the report. I have checked JRuby master, and it does not exhibit the problem. I confirmed your result on JRuby 1.6.7.

        Very, very strange.

        system ~/projects/jruby $ rvm jruby-1.6.7 do ruby --1.9 -e "[:foo, :bar].join(', ')"
        system ~/projects/jruby $ rvm jruby-1.6.7 do ruby --1.9 -e "def x(*args); args.join(', '); end; x(:foo, :bar)"
        system ~/projects/jruby $ rvm jruby-1.6.7 do ruby --1.9 -e "def x(y, *args); args.join(', '); end; x('blah', :foo, :bar)"
        TypeError: can't convert Symbol into String
            join at org/jruby/RubyArray.java:1871
               x at -e:1
          (root) at -e:1
        
        Show
        Charles Oliver Nutter added a comment - Thank you for the report. I have checked JRuby master, and it does not exhibit the problem. I confirmed your result on JRuby 1.6.7. Very, very strange. system ~/projects/jruby $ rvm jruby-1.6.7 do ruby --1.9 -e "[:foo, :bar].join(', ')" system ~/projects/jruby $ rvm jruby-1.6.7 do ruby --1.9 -e "def x(*args); args.join(', '); end; x(:foo, :bar)" system ~/projects/jruby $ rvm jruby-1.6.7 do ruby --1.9 -e "def x(y, *args); args.join(', '); end; x('blah', :foo, :bar)" TypeError: can't convert Symbol into String join at org/jruby/RubyArray.java:1871 x at -e:1 (root) at -e:1
        Hide
        Charles Oliver Nutter added a comment -

        And I spoke too soon...the same problem does exist on master.

        Show
        Charles Oliver Nutter added a comment - And I spoke too soon...the same problem does exist on master.
        Hide
        Satoru Chinen added a comment -

        Yes, very strange.

        Show
        Satoru Chinen added a comment - Yes, very strange.
        Hide
        Charles Oliver Nutter added a comment -

        It was a problem with how we ported ary_join_0 from MRI; their version has a zero-based 'max' and gets encoding without string coercion, and ours is begin-based and was trying to coerce.

        Fixed on master@b48cfe5 and jruby-1_6@86cb0ba.

        commit b48cfe5a523250dc90dcf8f4beb82086b42395a0
        Author: Charles Oliver Nutter <headius@headius.com>
        Date:   Sat Feb 25 10:23:54 2012 -0600
        
            Fix JRUBY-6497
            
            Unable to convert varargs into String on JRuby 1.9 mode
            
            * In ary_join_0, max is zero-based, where in JRuby it is begin-based,
            so we need to subtract begin when testing for > 0.
            * If the element is not a string, we should just leave encoding
            alone. This may not be 100% right if non-encoded objects have a
            default encoding.
        
        Show
        Charles Oliver Nutter added a comment - It was a problem with how we ported ary_join_0 from MRI; their version has a zero-based 'max' and gets encoding without string coercion, and ours is begin-based and was trying to coerce. Fixed on master@b48cfe5 and jruby-1_6@86cb0ba. commit b48cfe5a523250dc90dcf8f4beb82086b42395a0 Author: Charles Oliver Nutter <headius@headius.com> Date: Sat Feb 25 10:23:54 2012 -0600 Fix JRUBY-6497 Unable to convert varargs into String on JRuby 1.9 mode * In ary_join_0, max is zero-based, where in JRuby it is begin-based, so we need to subtract begin when testing for > 0. * If the element is not a string, we should just leave encoding alone. This may not be 100% right if non-encoded objects have a default encoding.
        Hide
        Satoru Chinen added a comment - - edited

        Thank you for fix quickly.

        I tried github master. It is seems to be fixed.
        # However, the warning about character encoding occurred.
        https://gist.github.com/1909493

        Cheers.

        Show
        Satoru Chinen added a comment - - edited Thank you for fix quickly. I tried github master. It is seems to be fixed. # However, the warning about character encoding occurred. https://gist.github.com/1909493 Cheers.
        Hide
        Charles Oliver Nutter added a comment -

        Thank you for confirming. The KCODE warning on master is a known issue, but I'm not sure a bug has been filed. Could you file one please?

        Show
        Charles Oliver Nutter added a comment - Thank you for confirming. The KCODE warning on master is a known issue, but I'm not sure a bug has been filed. Could you file one please?
        Hide
        Satoru Chinen added a comment -

        I filed as issue https://jira.codehaus.org/browse/JRUBY-6501 .
        # It seems that the comments already received.

        Show
        Satoru Chinen added a comment - I filed as issue https://jira.codehaus.org/browse/JRUBY-6501 . # It seems that the comments already received.

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Satoru Chinen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: