Issue #4062 has been updated by Sakuro OZAWA.

File 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 `<main>'
Rebuild ruby with the attached patch.
 $ 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 nokogiriRemove executables:
 	nokogiri
  
 in addition to the gem? [Yn]  y
 Removing nokogiri
 Successfully uninstalled nokogiri-1.4.6
 $ rehash
 $ ls -R ~/.gem/ruby/1.9.1/bin 
 /Users/sakuro/.gem/ruby/1.9.1/bin:
=end

----------------------------------------
Bug #4062: "gem uninstall" does not honor --program-suffix
http://redmine.ruby-lang.org/issues/4062

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


=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



-- 
http://redmine.ruby-lang.org