Project

General

Profile

Bug #3056

gem unpack fails

Added by nobu (Nobuyoshi Nakada) over 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Target version:
ruby -v:
ruby 1.9.2dev (2010-04-21 trunk 27424) [i686-linux]
Backport:
[ruby-core:29158]

Description

=begin
Hi

`gem unpack something.gem' fails by following error.

ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /opt/local/lib/ruby/gems/1.9.1 directory.

I consider it regression.

This is a workaround, but I suspect why unpack method is
defined in Installer class.

diff --git i/lib/rubygems/installer.rb w/lib/rubygems/installer.rb
index 50f8d20..9be87fa 100644
--- i/lib/rubygems/installer.rb
+++ w/lib/rubygems/installer.rb
@@ -132,9 +132,6 @@ class Gem::Installer
end
end

  • FileUtils.mkdir_p @gem_home
  • raise Gem::FilePermissionError, @gem_home unless File.writable? @gem_home

    @spec = @format.spec

    @gem_dir = File.join(@gem_home, "gems", @spec.full_name).untaint
    @@ -187,6 +184,7 @@ class Gem::Installer
    end

    FileUtils.mkdir_p @gem_home unless File.directory? @gem_home

  • raise Gem::FilePermissionError, @gem_home unless File.writable? @gem_home

    Gem.ensure_gem_subdirectories @gem_home

diff --git i/test/rubygems/test_gem_install_update_options.rb w/test/rubygems/test_gem_install_update_options.rb
index 385fd9d..6735f0b 100644
--- i/test/rubygems/test_gem_install_update_options.rb
+++ w/test/rubygems/test_gem_install_update_options.rb
@@ -56,8 +56,9 @@ class TestGemInstallUpdateOptions < GemInstallerTestCase
File.chmod 0755, @userhome
FileUtils.chmod 0000, @gemhome

  • @installer = Gem::Installer.new @gem, @cmd.options assert_raises(Gem::FilePermissionError) do
  • @installer = Gem::Installer.new @gem, @cmd.options
  • @installer.install end end ensure

--
Nobu Nakada
=end

History

#1

Updated by mame (Yusuke Endoh) over 9 years ago

  • Category set to lib
  • Assignee set to drbrain (Eric Hodel)
  • Priority changed from 3 to Normal
  • Target version set to 1.9.2
  • ruby -v set to ruby 1.9.2dev (2010-04-21 trunk 27424) [i686-linux]

=begin
Hi, Eric

I can still reproduce this issue with trunk.
I guess this is inconvenient in practice.
What do you think about this ticket?

$ chmod 555 ~/work/ruby-trunk-local/lib/ruby/gems/1.9.1/

$ ~/work/ruby-trunk-local/bin/gem unpack _-1.2.gem
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /home/mame/work/ruby-trunk-local/lib/ruby/gems/1.9.1 directory.

$ chmod 755 ~/work/ruby-trunk-local/lib/ruby/gems/1.9.1/

$ ~/work/ruby-trunk-local/bin/gem unpack -1.2.gem
Unpacked gem: '/tmp/
-1.2'

--
Yusuke Endoh mame@tsg.ne.jp
=end

#2

Updated by drbrain (Eric Hodel) over 9 years ago

  • Status changed from Open to Closed

=begin
Fixed in r27441
=end

Also available in: Atom PDF