[DRE-maint] Bug#459882: libgemplugin-ruby1.8: makes too many assumptions about gem paths

Jeremy Laine jeremy.laine at m4x.org
Wed Jan 9 09:52:57 UTC 2008


Package: libgemplugin-ruby1.8
Version: 0.2.2-1
Severity: minor
Tags: patch

gem_plugin does too many manipulations on file paths for its own good:

- it passes the location of gem specifications to
  Gem::SourceIndex.from_installed_gems (deprecated)

- it manually builds the full path for a gem, even though this can be
  retrieved by using gem.gem_full_path

This does not cause any problems for now, but if the file layout of gems
changes in the future it will break gem_plugin.

The attached patch fixes these issues.

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.23-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libgemplugin-ruby1.8 depends on:
ii  libgems-ruby1.8               1.0.1-4    libraries to use RubyGems, a packa
ii  ruby                          1.8.2-2    An interpreter of object-oriented 

libgemplugin-ruby1.8 recommends no packages.

-- no debconf information
-------------- next part --------------
diff -urN libgemplugin-ruby-0.2.2.orig/lib/gem_plugin.rb libgemplugin-ruby-0.2.2/lib/gem_plugin.rb
--- libgemplugin-ruby-0.2.2.orig/lib/gem_plugin.rb	2007-05-12 22:21:38.000000000 +0200
+++ libgemplugin-ruby-0.2.2/lib/gem_plugin.rb	2008-01-09 10:40:18.000000000 +0100
@@ -105,8 +105,7 @@
     # To prevent this load requires the full path to the "init.rb" file, which
     # avoids the RubyGems autorequire magic.
     def load(needs = {})
-      sdir = File.join(Gem.dir, "specifications")
-      gems = Gem::SourceIndex.from_installed_gems(sdir)
+      gems = Gem::SourceIndex.from_installed_gems
       needs = needs.merge({"gem_plugin" => INCLUDE})
       
       gems.each do |path, gem|
@@ -129,7 +128,7 @@
           
           # Previously was set wrong, we already have the correct gem path!
           #gem_dir = File.join(Gem.dir, "gems", "#{gem.name}-#{gem.version}")
-          gem_dir = File.join(Gem.dir, "gems", path)
+          gem_dir = gem.gem_full_path
           
           require File.join(gem_dir, "lib", gem.name, "init.rb")
           @gems[gem.name] = gem_dir


More information about the Pkg-ruby-extras-maintainers mailing list