[#25936] [Bug:1.9] [rubygems] $LOAD_PATH includes bin directory — Nobuyoshi Nakada <nobu@...>

Hi,

10 messages 2009/10/05

[#25943] Disabling tainting — Tony Arcieri <tony@...>

Would it make sense to have a flag passed to the interpreter on startup that

16 messages 2009/10/05

[#26028] [Bug #2189] Math.atanh(1) & Math.atanh(-1) should not raise an error — Marc-Andre Lafortune <redmine@...>

Bug #2189: Math.atanh(1) & Math.atanh(-1) should not raise an error

14 messages 2009/10/10

[#26222] [Bug #2250] IO::for_fd() objects' finalization dangerously closes underlying fds — Mike Pomraning <redmine@...>

Bug #2250: IO::for_fd() objects' finalization dangerously closes underlying fds

11 messages 2009/10/22

[#26244] [Bug #2258] Kernel#require inside rb_require() inside rb_protect() inside SysV context fails — Suraj Kurapati <redmine@...>

Bug #2258: Kernel#require inside rb_require() inside rb_protect() inside SysV context fails

24 messages 2009/10/22

[#26361] [Feature #2294] [PATCH] ruby_bind_stack() to embed Ruby in coroutine — Suraj Kurapati <redmine@...>

Feature #2294: [PATCH] ruby_bind_stack() to embed Ruby in coroutine

42 messages 2009/10/27

[#26371] [Bug #2295] segmentation faults — tomer doron <redmine@...>

Bug #2295: segmentation faults

16 messages 2009/10/27

[ruby-core:25936] [Bug:1.9] [rubygems] $LOAD_PATH includes bin directory

From: Nobuyoshi Nakada <nobu@...>
Date: 2009-10-05 03:47:35 UTC
List: ruby-core #25936
Hi,

What is the reason that bin is needed in $LOAD_PATH?  AFAIK,
bin directory is for executable files, but not for libraries.


Index: gem_prelude.rb
===================================================================
--- gem_prelude.rb	(revision 25229)
+++ gem_prelude.rb	(working copy)
@@ -256,12 +256,11 @@ if defined?(Gem) then
         GemPaths.each_value do |path|
           if File.exist?(file = File.join(path, ".require_paths")) then
-            paths = File.read(file).split.map do |require_path|
+            paths = File.readlines(file).map! do |require_path|
+              require_path.chomp!
               File.join path, require_path
             end
-
             require_paths.concat paths
           else
-            require_paths << file if File.exist?(file = File.join(path, "bin"))
-            require_paths << file if File.exist?(file = File.join(path, "lib"))
+            require_paths << (File.directory?(file = File.join(path, "lib")) ? file : path)
           end
         end
Index: lib/rubygems.rb
===================================================================
--- lib/rubygems.rb	(revision 25229)
+++ lib/rubygems.rb	(working copy)
@@ -294,7 +294,4 @@ module Gem
     end
 
-    # bin directory must come before library directories
-    spec.require_paths.unshift spec.bindir if spec.bindir
-
     require_paths = spec.require_paths.map do |path|
       File.join spec.full_gem_path, path
Index: lib/rubygems/require_paths_builder.rb
===================================================================
--- lib/rubygems/require_paths_builder.rb	(revision 25229)
+++ lib/rubygems/require_paths_builder.rb	(working copy)
@@ -3,13 +3,10 @@ require 'rubygems'
 module Gem::RequirePathsBuilder
   def write_require_paths_file_if_needed(spec = @spec, gem_home = @gem_home)
-    return if spec.require_paths == ["lib"] &&
-              (spec.bindir.nil? || spec.bindir == "bin")
+    require_paths = spec.require_paths
+    return if require_paths == ["lib"]
     file_name = File.join(gem_home, 'gems', "#{@spec.full_name}", ".require_paths")
     file_name.untaint
-    File.open(file_name, "w") do |file|
-      spec.require_paths.each do |path|
-        file.puts path
-      end
-      file.puts spec.bindir if spec.bindir
+    File.open(file_name, "wb") do |file|
+      file.puts require_paths
     end
   end


-- 
Nobu Nakada

In This Thread

Prev Next