JRuby (please use github issues at http://bugs.jruby.org)
  1. JRuby (please use github issues at http://bugs.jruby.org)
  2. JRUBY-5841

Call to ScriptingContainer#setCurrentDirectory is ignored after a call to ScriptingContainer#put

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.5.6, JRuby 1.6.2
    • Fix Version/s: JRuby 1.6.3
    • Component/s: Embedding
    • Labels:
      None
    • Environment:
      OS X, JDK 1.6.0_24
    • Number of attachments :
      0

      Description

      Hi!

      In setting up Ruboto using JRuby, I came across this situation:

      import org.jruby.embed.ScriptingContainer;
      
      class JRUBY_XXXX {
          private static ScriptingContainer ruby;
      
          public static final void main(String[] args) {
              ruby = new ScriptingContainer();
      
              // This line changes the result
              // ruby.put("a_variable", "some value");
      
              ruby.setCurrentDirectory("/Users/uwe");
              ruby.runScriptlet("p Dir.getwd");
          }
      
      }
      

      When running the example above you get

      "/Users/uwe"
      

      If you uncomment line 10, you get your initial working directory. The call to "setCurrentDirectory" is ignored after the call to "put".

      Am I missing something?

      This is currently stalling a release of Ruboto, so I put a "Blocker" on this issue until we at least find a workaround.

      Please tell me if this is wrong usage of the Blocker level, or if I should consider the priority of issues I report at all.

        Activity

        Hide
        Yoko Harada added a comment -

        Thanks for reporting this. This is regression caused by recent change on singleton model. I fixed this bug in rev. aa1efed on master and rev. 9bf14fa on jruby-1_6 branch.

        As far as I tested using a given code, the bug was fixed.

        Show
        Yoko Harada added a comment - Thanks for reporting this. This is regression caused by recent change on singleton model. I fixed this bug in rev. aa1efed on master and rev. 9bf14fa on jruby-1_6 branch. As far as I tested using a given code, the bug was fixed.
        Hide
        Uwe Kubosch added a comment -

        Can you see when the regression was introduced?

        How can I ask JRuby what version it is so I can apply the workaround for affected versions only.

        Show
        Uwe Kubosch added a comment - Can you see when the regression was introduced? How can I ask JRuby what version it is so I can apply the workaround for affected versions only.
        Hide
        Uwe Kubosch added a comment -

        We now use org.jruby.runtime.Constants.VERSION to check JRuby version.

        Am I right when I think the regressen goes back to at least JRuby 1.5.6?

        Show
        Uwe Kubosch added a comment - We now use org.jruby.runtime.Constants.VERSION to check JRuby version. Am I right when I think the regressen goes back to at least JRuby 1.5.6?
        Hide
        Yoko Harada added a comment -

        The change caused regression is 5659b1fc01047e029a0ffc879e5b5b9d5320467e, which was pushed on May 1, 2011. So, 1.6.1 doesn't have this problem because 1.6.1 was released on Apr 12, 2011.

        JRuby 1.5.6 didn't work as the latest version. On 1.5.6, setCurrentDirectory method could change the directory only before the runtime was instantiated. Upon a request, I changed this so that users can change current directory anytime. This change was done by rev. d037ee80f1cb65c2325bc89896a64acdbaeb1281, which was pushed on Feb 1, 2011. So, 1.6.0 and later can change the current directory anytime.

        Show
        Yoko Harada added a comment - The change caused regression is 5659b1fc01047e029a0ffc879e5b5b9d5320467e, which was pushed on May 1, 2011. So, 1.6.1 doesn't have this problem because 1.6.1 was released on Apr 12, 2011. JRuby 1.5.6 didn't work as the latest version. On 1.5.6, setCurrentDirectory method could change the directory only before the runtime was instantiated. Upon a request, I changed this so that users can change current directory anytime. This change was done by rev. d037ee80f1cb65c2325bc89896a64acdbaeb1281, which was pushed on Feb 1, 2011. So, 1.6.0 and later can change the current directory anytime.
        Hide
        Charles Oliver Nutter added a comment -

        So is there something to fix here, or is the new behavior the way it will be forever?

        Show
        Charles Oliver Nutter added a comment - So is there something to fix here, or is the new behavior the way it will be forever?
        Hide
        Yoko Harada added a comment -

        No further fix on this issue.

        Just for clarity, setCurrentDirectory changes the current directory both before and after Ruby runtime is created.

        Show
        Yoko Harada added a comment - No further fix on this issue. Just for clarity, setCurrentDirectory changes the current directory both before and after Ruby runtime is created.
        Hide
        Uwe Kubosch added a comment -

        All is good by us.

        Show
        Uwe Kubosch added a comment - All is good by us.
        Hide
        Yoko Harada added a comment -

        Resolved

        Show
        Yoko Harada added a comment - Resolved

          People

          • Assignee:
            Yoko Harada
            Reporter:
            Uwe Kubosch
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: