Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

absolute paths without drive letter don't work in windows #2387

Closed
rdp opened this issue Dec 30, 2014 · 3 comments
Closed

absolute paths without drive letter don't work in windows #2387

rdp opened this issue Dec 30, 2014 · 3 comments

Comments

@rdp
Copy link
Contributor

rdp commented Dec 30, 2014

As originally reported

https://jira.codehaus.org/browse/JRUBY-5750

assuming you have an empty file in c:\dev\yo

Dir.chdir("c:\tmp") # works
File.read('/dev/yo')
Errno::ENOENT: No such file or directory - C:/dev/dev/yo
...
File.exist?('/dev/yo')
=> false # should be true

@enebo enebo added this to the JRuby 1.7.19 milestone Dec 31, 2014
@enebo
Copy link
Member

enebo commented Dec 31, 2014

#2335 I also opened but I should have noticed we had an issue on JIRA.

@johanwasserman
Copy link

If I may add my contribution to this issue (also in "Error in File.stat #2424"):

The issue is preventing me from installing gems on Jruby 1.7.18 (also tested 1.6.8 with same results), as discussed in the forum (https://www.ruby-forum.com/topic/200421 and https://www.ruby-forum.com/topic/6805165#new).

jruby -S jgem install bundler
ERROR: While executing gem ... (Errno::ENOENT)
No such file or directory - C:\Johan_Wasserman.rvm\gems\jruby-1.7.18\gems\bundler-1.7.11

jruby -S irb
irb(main):001:0> File.exists?('/Johan_Wasserman.rvm/test.txt')
=> true
irb(main):002:0> File.expand_path('/Johan_Wasserman.rvm/test.txt')
=> "C:/Johan_Wasserman.rvm/test.txt"
irb(main):003:0> File.absolute_path('/Johan_Wasserman.rvm/test.txt')
=> "C:/Johan_Wasserman.rvm/test.txt"
irb(main):004:0> File.dirname('/Johan_Wasserman.rvm/test.txt')
=> "/Johan_Wasserman.rvm"

My home path in Cygwin is /Johan_Wasserman.rvm, translating to the
Windows canonical path
C:\Zones\Programs\xnix\cygwin64\Johan_Wasserman.rvm

expand_path and absolute_path both returned the windows path
C:\Johan_Wasserman.rvm, which of course is incorrect, and therefore the
gem installer cannot find the files it just downloaded.

rvm info for JRuby and gem env:
jruby-1.7.18:

system:
uname: "CYGWIN_NT-6.1 HP-PC 1.7.33-2(0.280/5/3) 2014-11-13
15:47 x86_64 Cygwin"
system: "cygwin/unknown/x86_64"
bash: "/usr/bin/bash => GNU bash, version 4.1.17(9)-release
(x86_64-unknown-cygwin)"
zsh: " => not installed"

rvm:
version: "rvm 1.26.8 (latest) by Wayne E. Seguin
wayneeseguin@gmail.com, Michal Papis mpapis@gmail.com
[https://rvm.io/]"
updated: "2 hours 47 minutes 50 seconds ago"
path: "/Johan_Wasserman.rvm"

ruby:
interpreter: "jruby"
version: "1.7.18"
" date: "jruby 1.7.18 (1.9.3p551) 2014-12-22 625381c on Java
HotSpot(TM) 64-Bit Server VM 1.8.0_25-b18 +jit [Windows 7-amd64]
platform: "Windows 7-amd64"
patchlevel: "TM"
" full_version: "jruby 1.7.18 (1.9.3p551) 2014-12-22 625381c on Java
HotSpot(TM) 64-Bit Server VM 1.8.0_25-b18 +jit [Windows 7-amd64]

homes:
gem: "/Johan_Wasserman.rvm/gems/jruby-1.7.18"
ruby: "/Johan_Wasserman.rvm/rubies/jruby-1.7.18"

binaries:
ruby: "/Johan_Wasserman.rvm/rubies/jruby-1.7.18/bin/ruby"
irb: "/Johan_Wasserman.rvm/rubies/jruby-1.7.18/bin/irb"
gem: "/Johan_Wasserman.rvm/rubies/jruby-1.7.18/bin/gem"
rake: "/Johan_Wasserman.rvm/rubies/jruby-1.7.18/bin/rake"

environment:
PATH:
"/Johan_Wasserman.rvm/gems/jruby-1.7.18/bin:/Johan_Wasserman.rvm/gems/jruby-1.7.18@global/bin:/Johan_Wasserman.rvm/rubies/jruby-1.7.18/bin:/Johan_Wasserman.rvm
/Program Files (x86)/Java/jre1.8.0_25/bin/client:/cygdrive/c/Program
Files (x86)/Java/jre1.8.0_25/bin:/cygdrive/c/Program Files
(x86)/Java/jre1.8.0_25/lib/i386:/cygdrive/c/Progr
Zones/Programs/Java/jre1.8.0_20/bin:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdr
gdrive/c/Users/Johan Wasserman/AppData/Roaming/npm:/cygdrive/c/Program
Files/Boot2Docker for Windows:/cygdrive/c/Zones/Develoment/Aptana Studio
3 Workspace:/usr/lib/lapack"
GEM_HOME: "/Johan_Wasserman.rvm/gems/jruby-1.7.18"
GEM_PATH:
"/Johan_Wasserman.rvm/gems/jruby-1.7.18:/Johan_Wasserman.rvm/gems/jruby-1.7.18@global"
MY_RUBY_HOME: "/Johan_Wasserman.rvm/rubies/jruby-1.7.18"
IRBRC: "/Johan_Wasserman.rvm/rubies/jruby-1.7.18/.irbrc"
RUBYOPT: ""
gemset: ""

RubyGems Environment:

  • RUBYGEMS VERSION: 2.1.9
  • RUBY VERSION: 1.9.3 (2014-12-22 patchlevel 551) [java]
  • INSTALLATION DIRECTORY: /Johan_Wasserman.rvm/gems/jruby-1.7.18
  • RUBY EXECUTABLE:
    C:/Zones/Programs/xnix/cygwin64/Johan_Wasserman.rvm/rubies/jruby-1.7.18/bin/jruby.exe
  • EXECUTABLE DIRECTORY: /Johan_Wasserman.rvm/gems/jruby-1.7.18/bin
  • SPEC CACHE DIRECTORY: C:/Zones/Programs/xnix/cygwin64/home/Johan
    Wasserman/.gem/specs
  • RUBYGEMS PLATFORMS:
    • ruby
    • universal-java-1.8
  • GEM PATHS:
    • /Johan_Wasserman.rvm/gems/jruby-1.7.18

      /Johan_Wasserman.rvm/gems/jruby-1.7.18:/Johan_Wasserman.rvm/gems/jruby-1.7.18@global
  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :backtrace => false
    • :bulk_threshold => 1000
    • "install" => "--no-rdoc --no-ri --env-shebang"
    • "update" => "--no-rdoc --no-ri --env-shebang"
  • REMOTE SOURCES:
  • SHELL PATH:

    C:\Zones\Programs\xnix\cygwin64\Johan_Wasserman.rvm\gems\jruby-1.7.18\bin

    C:\Zones\Programs\xnix\cygwin64\Johan_Wasserman.rvm\rubies\jruby-1.7.18\lib\ruby\gems\shared\bin

    C:\Zones\Programs\xnix\cygwin64\Johan_Wasserman.rvm\rubies\jruby-1.7.18\bin
    • C:\Zones\Programs\xnix\cygwin64\Johan_Wasserman.rvm\bin
    • C:\Zones\Programs\xnix\cygwin64\usr\local\bin
    • C:\Zones\Programs\xnix\cygwin64\bin
    • C:\Program Files (x86)\Java\jre1.8.0_25\bin\client
    • C:\Program Files (x86)\Java\jre1.8.0_25\bin
    • C:\Program Files (x86)\Java\jre1.8.0_25\lib\i386
    • C:\ProgramData\Oracle\Java\javapath
    • C:\Zones\Programs\Java\jre1.8.0_20\bin
    • C:\Windows\system32
    • C:\Windows
    • C:\Windows\System32\Wbem
    • C:\Windows\System32\WindowsPowerShell\v1.0
    • C:\Zones\Programs\nodejs
    • C:\Zones\Programs\xnix\cygwin64\bin
    • C:\Users\Johan Wasserman\AppData\Roaming\npm
    • C:\Program Files\Boot2Docker for Windows
    • C:\Zones\Develoment\Aptana Studio 3 Workspace
    • C:\Zones\Programs\xnix\cygwin64\lib\lapack

@enebo enebo modified the milestones: JRuby 1.7.19, JRuby 1.7.20 Jan 28, 2015
enebo added a commit that referenced this issue May 1, 2015
absolute paths without drive letter don't work in windows
@enebo enebo closed this as completed in 2daa9d3 May 1, 2015
@enebo
Copy link
Member

enebo commented May 1, 2015

This issue specifically fixes the problem reported in the original Jira issue. Namely, that IO/File.open of a unix-style absolute path will end up using the current directory drive letter like MRI does.

For @johanwasserman if this does not help then you can open up a new issue. Strangely enough, MRI's windows release behaves exactly as JRuby for the methods you mention above expand_path, absolute_path, dirname. This was quite surprising to me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants