Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: JRuby 1.7.3
    • Fix Version/s: None
    • Component/s: Application Error
    • Labels:
      None
    • Environment:
      Mac OS X 10.8.2, JRuby 1.7.3, pry (0.9.12 java)
    • Number of attachments :
      0

      Description

      Could be a pry bug but it looks like its coming from jruby:

      before_session hook failed: Errno::ENOENT: No such file or directory - /Users/tbrock
      org/jruby/RubyFile.java:333:in `initialize'
      (see _pry_.hooks.errors to debug)
      

        Issue Links

          Activity

          Hide
          Hiro Asari added a comment -

          There are a couple of issues at play.

          First, on JRuby, pry ends up calling Pry::Method::WeirdMethodLocator#lines_for_file on the current working directory. This does not happen on MRI, so there is no error.

          Second, lines_for_file (https://github.com/pry/pry/blob/v0.9.12/lib/pry/method/weird_method_locator.rb#L170-L177) calls File.readlines indiscriminately on a directory. This results in the error reported:

          $ jruby -v; jruby -e 'File.readlines("/Users/asari")'
          jruby 1.7.4.dev (1.9.3p385) 2013-03-01 e51d094 on Java HotSpot(TM) 64-Bit Server VM 1.7.0_13-b20 [darwin-x86_64]
          Errno::EACCES: Permission denied - /Users/asari
            initialize at org/jruby/RubyFile.java:334
                  open at org/jruby/RubyIO.java:1134
             readlines at org/jruby/RubyIO.java:3717
                (root) at -e:1
          

          This should actually raise Errno::EISDIR instead, but that's for another ticket.

          The logic behind the first issue is not clear to me, since I'm not familiar with the pry codebase. It may very well be that it is due to JRuby doing extra work, for example, for Java integration, and it is inevitable. If this is the case, then, pry needs to understand that it might end up calling File.readlines on a directory, and handle the error.

          Show
          Hiro Asari added a comment - There are a couple of issues at play. First, on JRuby, pry ends up calling Pry::Method::WeirdMethodLocator#lines_for_file on the current working directory. This does not happen on MRI, so there is no error. Second, lines_for_file ( https://github.com/pry/pry/blob/v0.9.12/lib/pry/method/weird_method_locator.rb#L170-L177 ) calls File.readlines indiscriminately on a directory. This results in the error reported: $ jruby -v; jruby -e 'File.readlines("/Users/asari")' jruby 1.7.4.dev (1.9.3p385) 2013-03-01 e51d094 on Java HotSpot(TM) 64-Bit Server VM 1.7.0_13-b20 [darwin-x86_64] Errno::EACCES: Permission denied - /Users/asari initialize at org/jruby/RubyFile.java:334 open at org/jruby/RubyIO.java:1134 readlines at org/jruby/RubyIO.java:3717 (root) at -e:1 This should actually raise Errno::EISDIR instead, but that's for another ticket. The logic behind the first issue is not clear to me, since I'm not familiar with the pry codebase. It may very well be that it is due to JRuby doing extra work, for example, for Java integration, and it is inevitable. If this is the case, then, pry needs to understand that it might end up calling File.readlines on a directory, and handle the error.
          Hide
          Patrick Ritchie added a comment -

          Might be useful to have the full backtrace on the error:

          org/jruby/RubyFile.java:333:in `initialize'
          org/jruby/RubyIO.java:1179:in `open'
          org/jruby/RubyIO.java:3762:in `readlines'
          /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/method/weird_method_locator.rb:175:in `lines_for_file'
          /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/method/weird_method_locator.rb:153:in `renamed_method_source_location'
          /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/method/weird_method_locator.rb:127:in `find_renamed_method'
          org/jruby/RubyEnumerable.java:561:in `find'
          /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/method/weird_method_locator.rb:126:in `find_renamed_method'
          /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/method/weird_method_locator.rb:52:in `get_method'
          /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/method.rb:89:in `from_binding'
          /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/commands/whereami.rb:37:in `setup'
          /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/command.rb:570:in `call'
          /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/command.rb:453:in `call_with_hooks'
          /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/command.rb:426:in `call_safely'
          /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/command.rb:368:in `process_line'
          /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/command_set.rb:350:in `process_line'
          /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/pry_instance.rb:477:in `run_command'
          /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry.rb:13:in `Pry'
          org/jruby/RubyProc.java:249:in `call'
          /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/hooks.rb:154:in `exec_hook'
          org/jruby/RubyArray.java:2361:in `map'
          /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/hooks.rb:152:in `exec_hook'
          /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/helpers/base_helpers.rb:12:in `silence_warnings'
          /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/hooks.rb:151:in `exec_hook'
          /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/pry_instance.rb:496:in `exec_hook'
          /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/pry_instance.rb:199:in `repl_prologue'
          /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/pry_instance.rb:227:in `repl'
          /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/pry_class.rb:170:in `start'
          /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/guard-1.6.2/lib/guard/interactor.rb:241:in `start'
          
          Show
          Patrick Ritchie added a comment - Might be useful to have the full backtrace on the error: org/jruby/RubyFile.java:333:in `initialize' org/jruby/RubyIO.java:1179:in `open' org/jruby/RubyIO.java:3762:in `readlines' /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/method/weird_method_locator.rb:175:in `lines_for_file' /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/method/weird_method_locator.rb:153:in `renamed_method_source_location' /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/method/weird_method_locator.rb:127:in `find_renamed_method' org/jruby/RubyEnumerable.java:561:in `find' /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/method/weird_method_locator.rb:126:in `find_renamed_method' /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/method/weird_method_locator.rb:52:in `get_method' /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/method.rb:89:in `from_binding' /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/commands/whereami.rb:37:in `setup' /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/command.rb:570:in `call' /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/command.rb:453:in `call_with_hooks' /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/command.rb:426:in `call_safely' /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/command.rb:368:in `process_line' /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/command_set.rb:350:in `process_line' /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/pry_instance.rb:477:in `run_command' /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry.rb:13:in `Pry' org/jruby/RubyProc.java:249:in `call' /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/hooks.rb:154:in `exec_hook' org/jruby/RubyArray.java:2361:in `map' /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/hooks.rb:152:in `exec_hook' /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/helpers/base_helpers.rb:12:in `silence_warnings' /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/hooks.rb:151:in `exec_hook' /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/pry_instance.rb:496:in `exec_hook' /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/pry_instance.rb:199:in `repl_prologue' /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/pry_instance.rb:227:in `repl' /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/pry-0.9.12-java/lib/pry/pry_class.rb:170:in `start' /Users/pritchie/.rvm/gems/jruby-1.7.3@lt/gems/guard-1.6.2/lib/guard/interactor.rb:241:in `start'
          Hide
          Patrick Ritchie added a comment -

          Opened: https://github.com/pry/pry/pull/873 to check if the the file is a directory.

          Show
          Patrick Ritchie added a comment - Opened: https://github.com/pry/pry/pull/873 to check if the the file is a directory.

            People

            • Assignee:
              Thomas E Enebo
              Reporter:
              Tyler Brock
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: