Bug #4062
closed"gem uninstall" does not honor --program-suffix
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
Files
Updated by naruse (Yui NARUSE) over 13 years ago
- Status changed from Open to Assigned
- Assignee set to drbrain (Eric Hodel)
Updated by sakuro (Sakuro OZAWA) over 13 years ago
- File issue4062.patch issue4062.patch added
=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
Updated by nahi (Hiroshi Nakamura) over 13 years ago
- Target version set to 1.9.3
Updated by sakuro (Sakuro OZAWA) over 13 years ago
=begin
Following tests appear to test this feature.
- source:test/rubygems/test_gem_uninstaller.rb#L91
- source:test/rubygems/test_gem_commands_uninstall_command.rb#L59
But these files require 'rubygems/installer_test_case.rb' which requires 'rubygems/installer.rb'
=end
Updated by drbrain (Eric Hodel) over 13 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]
Updated by drbrain (Eric Hodel) over 13 years ago
The feature was only partially implemented in RubyGems 1.8. It was missing a require and had confusing messaging.