Bug #4062

"gem uninstall" does not honor --program-suffix

Added by Sakuro OZAWA over 3 years ago. Updated over 2 years ago.

[ruby-core:33216]
Status:Closed
Priority:Normal
Assignee:Eric Hodel
Category:core
Target version:1.9.3
ruby -v:ruby 1.9.3dev (2010-11-16 trunk 29806) [x86_64-darwin10.5.0] Backport:

Description

=begin
When I uninstall a gem which has bin scripts and installed with format-executable option, the scripts remain after the gem uninstallation.

# install the trunk ruby with program suffix configuration.

$ ../ruby/configure --prefix=/usr/local --program-suffix=-r29806 --srcdir=../ruby --enable-shared --with-opt-dir=/opt/local
$ make
$ sudo make install
$ rehash
$ ruby-r29806 -v
ruby 1.9.3dev (2010-11-16 trunk 29806) [x86_64-darwin10.5.0]

# temporarily hide my instaled gems and gem configuration

$ mv ~/.gemrc ~/.gemrc.hiden
$ mv ~/.gem ~/.gem.hidden

# install a gem with explicit options.

$ gem-r29806 install --format-executable --user-install --no-ri --no-rdoc nokogiri
Building native extensions. This could take a while...
Successfully installed nokogiri-1.4.4
1 gem installed
$ rehash
$ which nokogiri-r29806
/Users/sakuro/.gem/ruby/1.9.1/bin/nokogiri-r29806

# uninstall it immediately.

$ gem-r29806 uninstall --format-executable --user-install nokogiri
ERROR: While executing gem ... (OptionParser::InvalidOption)
invalid option: --format-executable
$ gem-r29806 uninstall --user-install nokogiri
Remove executables:
nokogiri
^ SHOULD SHOW nokogiri-r29806 ^

in addition to the gem? [Yn] y
Removing nokogiri

^ SHOULD SHOW nokogiri-r29806 ^
Successfully uninstalled nokogiri-1.4.4
$ ls ~/.gem/ruby/1.9.1/bin
nokogiri-r29806*
^ SHOULD NOT EXIST ^

See also old #1728.
=end

issue4062.patch Magnifier - Explictly require rubygems/installer.rb (workaround) (377 Bytes) Sakuro OZAWA, 06/26/2011 05:19 PM

Associated revisions

Revision 32697
Added by Eric Hodel over 2 years ago

  • lib/rubygems/uninstaller.rb: Add missing require and update messaging to avoid confusion with uninstall --format-executable. [Ruby 1.9 - Bug #4062]

History

#1 Updated by Yui NARUSE almost 3 years ago

  • Status changed from Open to Assigned
  • Assignee set to Eric Hodel

#2 Updated by Sakuro OZAWA almost 3 years ago

=begin
Reproducible with r32231.

Environment setup.
$ ruby-r32231 -v
ruby 1.9.3dev (2011-06-26 trunk 32231) [x86_64-darwin10.8.0]
$ mv ~/.gemrc ~/.gemrc.hidden
$ mv ~/.gem ~/.gem.hidden

Install a gem with suffix.
$ gem-r32231 install --format-executable --user-install --no-ri --no-rdoc nokogiri
Building native extensions. This could take a while...
Successfully installed nokogiri-1.4.6
1 gem installed
$ rehash
$ which nokogiri-r32231
/Users/sakuro/.gem/ruby/1.9.1/bin/nokogiri-r32231

Try uninstalling it.
$ gem-r32231 uninstall --format-executable --user-install nokogiri
Remove executables:
nokogiri

in addition to the gem? [Yn] y
Removing nokogiri
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Installer

This is because rubygems/uninstaller.rb references Gem::Installer.exec_format without requiring rubygems/installer.rb.

Try again without --format-executable...
$ gem-r32231 uninstall --user-install nokogiri Remove executables:
nokogiri

in addition to the gem? [Yn] y
Removing nokogiri
Successfully uninstalled nokogiri-1.4.6
$ rehash
$ which nokogiri-r32231
/Users/sakuro/.gem/ruby/1.9.1/bin/nokogiri-r32231
$ nokogiri-r32231
/usr/local/lib/ruby/1.9.1/rubygems/dependency.rb:253:in to_specs': Could not find nokogiri (>= 0) amongst [json-1.5.0, minitest-2.2.2, rake-0.9.2, rdoc-3.7] (Gem::LoadError)
from /usr/local/lib/ruby/1.9.1/rubygems/dependency.rb:262:in
to_spec'
from /usr/local/lib/ruby/1.9.1/rubygems.rb:1188:in gem'
from /Users/sakuro/.gem/ruby/1.9.1/bin/nokogiri-r32231:18:in
'
Rebuild ruby with the attached patch, and retry.
$ gem-r32231 install --format-executable --user-install --no-ri --no-rdoc nokogiri
Building native extensions. This could take a while...
Successfully installed nokogiri-1.4.6
1 gem installed
$ gem-r32231 uninstall --format-executable --user-install nokogiri
Remove executables:
nokogiri

in addition to the gem? [Yn] y
Removing nokogiri
Successfully uninstalled nokogiri-1.4.6
$ ls -R ~/.gem/ruby/1.9.1/bin
/Users/sakuro/.gem/ruby/1.9.1/bin:
Uninstalled.
=end

#3 Updated by Hiroshi Nakamura almost 3 years ago

  • Target version set to 1.9.3

#4 Updated by Sakuro OZAWA almost 3 years ago

=begin
Following tests appear to test this feature.
* source:test/rubygems/testgemuninstaller.rb#L91
* source:test/rubygems/testgemcommandsuninstallcommand.rb#L59
But these files require 'rubygems/installertestcase.rb' which requires 'rubygems/installer.rb'
=end

#5 Updated by Motohiro KOSAKI almost 3 years ago

Ping?

#6 Updated by Eric Hodel over 2 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r32697.
Sakuro, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • lib/rubygems/uninstaller.rb: Add missing require and update messaging to avoid confusion with uninstall --format-executable. [Ruby 1.9 - Bug #4062]

#7 Updated by Eric Hodel over 2 years ago

The feature was only partially implemented in RubyGems 1.8. It was missing a require and had confusing messaging.

Also available in: Atom PDF