[Rubygems-developers] GEM_PATH is ignored when looking for installed dependencies

Martin Krauskopf martin.krauskopf at gmail.com
Mon Jan 28 05:38:18 EST 2008


Chad Woolley wrote:
> On Jan 27, 2008 4:22 PM, Martin Krauskopf <martin.krauskopf at gmail.com> wrote:
>>    $ ls -d /space/ruby/gem-repo-c/gems/ruby-debug-base-0.9.3
>>    /space/ruby/gem-repo-c/gems/ruby-debug-base-0.9.3
>>    $ ls -d /space/ruby/gem-repo/gems/ruby-debug-*
>>    ls: /space/ruby/gem-repo/gems/ruby-debug-*: No such file or directory
>>    $ gem install ruby-debug -v 0.9.3 # ERROR HERE IN INSTALLING -base
>>    Building native extensions.  This could take a while...
>>    Successfully installed ruby-debug-base-0.9.3
>>    Successfully installed ruby-debug-0.9.3
>>    2 gems installed
>>    $ ls -d /space/ruby/gem-repo/gems/ruby-debug-*
>>    /space/ruby/gem-repo/gems/ruby-debug-0.9.3
>>    /space/ruby/gem-repo/gems/ruby-debug-base-0.9.3 # REDUNDANT
> 
> That looks like unexpected behavior and a bug, unless there's
> something with the ruby-debug-base already installed in gem-repo-c.

No it was not. See the scenario below.

> What other files are already under /space/ruby/gem-repo-c/gems for
> ruby-debug-base (are there specs/cache/etc)?  I don't even know if
> this matters - what exactly is used when creating the source cache -
> the gem files, the spec, ???

source index is build from spec files in the specification directory. 
But the problem seems to be that it is build just from the main 
repository in Gem::DependencyInstaller#installer. Other repositories are 
ignored differently to run-time where they are 'seen' as expected.

> Also, what are the exact commands you used to install
> /space/ruby/gem-repo-c/gems/ruby-debug-base-0.9.3?

See below.

> A fully reproducible error scenario would help.

Here it is. Reproducible scenario with new fresh repos. Should be 
reproducible on whatever machine:

   $ mkdir -p /space/ruby/gem-repos
   $ cd /space/ruby/gem-repos
   $ export 
GEM_PATH="/space/ruby/gem-repos/gems:/space/ruby/gem-repos/gems-c"
   $ export GEM_HOME="/space/ruby/gem-repos/gems"
   $ gem env # this will also initializes/creates repositories
   RubyGems Environment:
     - RUBYGEMS VERSION: 1.0.1 (1.0.1)
     - RUBY VERSION: 1.8.6 (2007-09-24 patchlevel 111) [i686-linux]
     - INSTALLATION DIRECTORY: /space/ruby/gem-repos/gems
     - RUBY EXECUTABLE: /space/ruby/ruby-1.8.6-p111/bin/ruby1.8.6-p111
     - RUBYGEMS PLATFORMS:
       - ruby
       - x86-linux
     - GEM PATHS:
        - /space/ruby/gem-repos/gems
        - /space/ruby/gem-repos/gems-c
     - GEM CONFIGURATION:
        - :update_sources => true
        - :verbose => true
        - :benchmark => false
        - :backtrace => false
        - :bulk_threshold => 1000
        - "gem" => "--no-rdoc --no-ri"
     - REMOTE SOURCES:
        - http://gems.rubyforge.org
   $ ls
   gems/  gems-c/
   $ gem install -i /space/ruby/gem-repos/gems-c ruby-debug-base -v 0.9.3
   Bulk updating Gem source index for: http://gems.rubyforge.org
   Building native extensions.  This could take a while...
   Successfully installed ruby-debug-base-0.9.3
   1 gem installed
   $ gem install ruby-debug -v 0.9.3
   Building native extensions.  This could take a while...
   Successfully installed ruby-debug-base-0.9.3 # [1]
   Successfully installed ruby-debug-0.9.3
   2 gems installed

[1] this is wrong, already installed in repository on Gem Path.

So now we have ruby-debug-base installed two-times. Also note if you do:

$ gem uninstall ruby-debug-base

It will uninstall the gem from the main repository and leave the second 
copy in the 'secondary' repository - which is quite ok; and debugger 
still works as expected. So the second installation is really redundant.

Also this can be reproduce with all other gems, e.g. rake.

Regards,
	m.

PS: I could try to peek in and fix this if nobody else. But first I will 
need to checkout trunk and see how the process of tests, etc. works in 
RubyGems development process. I suppose that the fix will be simple as 
traversing all the repositories, not just main, when filling source_index.



More information about the Rubygems-developers mailing list