Bugs item #25882, was opened at 2009-05-12 09:01 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=575&aid=25882&group_id=126
Category: `gem install` command Group: v1.3.x Status: Closed Resolution: Accepted Priority: 3 Submitted By: Lars Christensen (larsch) Assigned to: Daniel Berger (djberg96) Summary: Handling of Windows paths broken in 1.3.3 Initial Comment: Installing gems from local drives other than the current is broken on Windows. RubyGems strips the drive letter (through using the URI class for something which isn't an URI). C:\> gem install p:\path\to\mygem-2.1.18.gem ERROR: While executing gem ... (Errno::ENOENT) No such file or directory - /path/to/mygem-2.1.18.gem Then I tried to pass a valid URI: C:\> gem install file:///p:/path/to/mygem-2.1.18.gem But that doesn't work either; ERROR: could not find gem file:///p:/path/to/mygem-2.1.18.gem locally or in a repository I believe this is because URI#path returns "/p:/path/to/mygem..." (with leading slash), which is not a valid path on Windows. Finally, I attempted to hack RubyGems to prefix file:/// itself, but I don't understand the reason for this line of code in remote_fetcher.rb: remote_gem_path = File.join(path, 'gems', gem_file_name) That causes this error instead: ERROR: While executing gem ... (Errno::ENOENT) No such file or directory - p:/path/to/gems/mygem-2.1.18.gem Notice the extra /gems/ path. ---------------------------------------------------------------------- >Comment By: Luis Lavena (luislavena) Date: 2010-09-13 18:38 Message: Hello, First you need to use SET VARIABLE=VALUE, not "env" as env is not a native Windows command, perhaps from gnuwin32. Also, you can modify those at runtime, but everyt ie you start a new command prompt or session, the values will be restored with the values your Admin set for you. Is Z: mapped? do you have write permissions to the root? Can you do this? ruby -rfileutils -ve "FileUtils.touch 'z:/foo'" ---------------------------------------------------------------------- Comment By: Saurabh Doshi (cashkap) Date: 2010-09-13 18:34 Message: My HomeDrive still remains Z: after I used env HOMEDRIVE=C: C:\Ruby192\bin>set gem Environment variable gem not defined C:\Ruby192\bin>set home HOMEDRIVE=Z: HOMEPATH=\ HOMESHARE=\(servername)\users\saurabh.doshi I am using 32 bit Win XP and have installed gnuwin32. I have added C:\gnuwin32\bin to my PATH env variable. Does the Default drive change from Z: to C: be done at the domain level by my System Administrator? Thanks, ---------------------------------------------------------------------- Comment By: Luis Lavena (luislavena) Date: 2010-09-13 18:05 Message: Can you tell me what "SET GEM" tells you? Also, what "SET HOME" tells you? Please include complete output. Also, include details about the exact version of Windows you're using,a nd if is 64bits, if you had E-editor installed or cygwin. ---------------------------------------------------------------------- Comment By: Saurabh Doshi (cashkap) Date: 2010-09-13 17:55 Message: Thanks Luis, Apologies for posting this against this thread. Here is my gem env : RubyGems Environment: - RUBYGEMS VERSION: 1.3.7 - RUBY VERSION: 1.9.2 (2010-08-18 patchlevel 0) [i386-mingw32] - INSTALLATION DIRECTORY: C:/Ruby192/lib/ruby/gems/1.9.1 - RUBY EXECUTABLE: C:/Ruby192/bin/ruby.exe - EXECUTABLE DIRECTORY: C:/Ruby192/bin - RUBYGEMS PLATFORMS: - ruby - x86-mingw32 - GEM PATHS: - C:/Ruby192/lib/ruby/gems/1.9.1 - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :benchmark => false - :backtrace => false - :bulk_threshold => 1000 - REMOTE SOURCES: - http://rubygems.org/ My HomeDrive was Z:, I changed it to C: HomePath = \ USERPROFILE=C:\Documents and Settings\saurabh.doshi Still getting the error. Based on my environment, do I need to set the GEM_HOME variable? ---------------------------------------------------------------------- Comment By: Luis Lavena (luislavena) Date: 2010-09-13 11:16 Message: Saurabh, Seems to me that your report has nothing to do with the original report here. See, it is indicating "Z:/" not been accesible or exist, while you have C: as your system drive. Please provide the full output of "gem env" when reporting any error. Also, see what are the values of HOME, HOMEDRIVE, HOMEPATH and USERPROFILE in your system (use SET command). ---------------------------------------------------------------------- Comment By: Saurabh Doshi (cashkap) Date: 2010-09-13 11:04 Message: I have used the One Click Ruby installer(1.9.2) and have installed it as C:\Ruby192. I am facing the same error: C:\Ruby192\bin>gem install rake ERROR: While executing gem ... (Errno::ENOENT) No such file or directory - Z:/ I have tried changing the default mapping from z: to c: but havent found success. I don't have admin priv on my m/c. can some please guide me on this Thanks, ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-05-12 14:55 Message: Fixed in SVN. Thanks for the report. Dan ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-05-12 12:59 Message: Oops, let's update that to "if Gem.win_platform && source_uri.scheme" Regards, Dan ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-05-12 12:51 Message: I think this patch does what we want: --- remote_fetcher.orig Sun Apr 12 13:52:46 2009 +++ remote_fetcher.rb Tue May 12 09:35:30 2009 @@ -139,7 +139,11 @@ Gem.configuration.really_verbose when nil then # TODO test for local overriding cache begin - FileUtils.cp URI.unescape(source_uri.path), local_gem_path + if Gem.win_platform? + FileUtils.cp URI.unescape(source_uri.scheme + ':' + source_uri.path), local_gem_path + else + FileUtils.cp URI.unescape(source_uri.path), local_gem_path + end rescue Errno::EACCES local_gem_path = source_uri.to_s end ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-05-12 10:46 Message: Looks like a bug in line 142 of remote_fetcher.rb related to the URI class and the fact that we're stripping the scheme off of Windows paths. It works for "C:" because, iirc, certain Ruby core File methods assume "C:" if no drive is found. We'll have to fix this. Regards, Dan ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-05-12 10:22 Message: Well, this is odd. I tried installing from an explicit path using "C:\Documents and Settings\djberge". That worked fine. But, when I tried to install from a drive other than "C:", things went bad: C:\Documents and Settings\djberge>gem install "z:\djberge on my mac\documents\workspace\ptools\ptools-1.1.7.gem" --verbose --debug Exception `NameError' at C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:161 - uninitialized constant Gem::Commands::InstallCommand Exception `IOError' at C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/format.rb:50 - closed stream Installing gem ptools-1.1.7 Exception `Errno::ENOENT' at C:/Ruby/lib/ruby/1.8/fileutils.rb:1200 - No such file or directory - /djberge on my mac/documents/workspace/ptools/ptools-1.1.7.gem ERROR: While executing gem ... (Errno::ENOENT) No such file or directory - /djberge on my mac/documents/workspace/ptools/ptools-1.1.7.gem C:/Ruby/lib/ruby/1.8/fileutils.rb:1200:in `stat' C:/Ruby/lib/ruby/1.8/fileutils.rb:1200:in `lstat' C:/Ruby/lib/ruby/1.8/fileutils.rb:1178:in `stat' C:/Ruby/lib/ruby/1.8/fileutils.rb:1260:in `copy_file' C:/Ruby/lib/ruby/1.8/fileutils.rb:463:in `copy_file' C:/Ruby/lib/ruby/1.8/fileutils.rb:383:in `cp' C:/Ruby/lib/ruby/1.8/fileutils.rb:1395:in `fu_each_src_dest' C:/Ruby/lib/ruby/1.8/fileutils.rb:1411:in `fu_each_src_dest0' C:/Ruby/lib/ruby/1.8/fileutils.rb:1393:in `fu_each_src_dest' C:/Ruby/lib/ruby/1.8/fileutils.rb:382:in `cp' C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:142:in `download' C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:232:in `install' C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:222:in `each' C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:222:in `install' C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb:78:in `execute' C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb:75:in `each' C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb:75:in `execute' C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/command.rb:254:in `invoke' C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:132:in `process_args' C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:102:in `run' C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:58:in `run' C:/Ruby/bin/gem:21 I'll have to investigate further to determine if this is a bug in rubygems or fileutils. Regards, Dan ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-05-12 09:20 Message: The use of file urls is meant for use with the --source flag (i.e. from a local repository), which is why the method includes the 'gems' directory. However, the "gem install p:\path\to\mygem-2.1.18.gem" should work. I'll take a look. Regards, Dan ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=575&aid=25882&group_id=126 _______________________________________________ Rubygems-developers mailing list http://rubyforge.org/projects/rubygems Rubygems-developers@rubyforge.org http://rubyforge.org/mailman/listinfo/rubygems-developers