Bug 718695

Summary: Load paths duplicated for i386 =>ActiveSupport build fails on i386
Product: [Fedora] Fedora Reporter: Vít Ondruch <vondruch>
Component: rubyAssignee: Jeroen van Meeuwen <vanmeeuwen+fedora>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: jeremy, mmorsi, mtasaka, tagoh, vanmeeuwen+fedora, vondruch
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ruby-1.8.7.352-1.fc15 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 722887 (view as bug list) Environment:
Last Closed: 2011-07-26 03:44:25 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 722887    

Description Vít Ondruch 2011-07-04 10:13:23 UTC
Description of problem:
The load paths are duplicated on i386. Due to this duplication, one of ActiveSupport 3.0.9 test fails:

  1) Failure:
test_uniq_load_paths(LoadPathsTest)
    [./test/load_paths_test.rb:14:in `test_uniq_load_paths'
     /usr/lib/ruby/gems/1.8/gems/mocha-0.9.8/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb:19:in `__send__'
     /usr/lib/ruby/gems/1.8/gems/mocha-0.9.8/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb:19:in `run']:
[["/usr/lib/ruby/1.8", 2], ["/usr/lib/ruby/site_ruby", 2], ["/usr/lib/ruby/site_ruby/1.8", 2]].
<false> is not true. 

This is the test code:

require 'abstract_unit'

class LoadPathsTest < Test::Unit::TestCase
  def test_uniq_load_paths
    load_paths_count = $LOAD_PATH.inject({}) { |paths, path|
      expanded_path = File.expand_path(path)
      paths[expanded_path] ||= 0
      paths[expanded_path] += 1
      paths
    }
    load_paths_count[File.expand_path('../../lib', __FILE__)] -= 1

    filtered = load_paths_count.select { |k, v| v > 1 }
    assert filtered.empty?, filtered.inspect
  end
end

This is not issue for x86_64

Version-Release number of selected component (if applicable):
> rpm -q ruby
ruby-1.8.7.334-2.fc16.i686

> rpm -q ruby
ruby-1.8.7.334-2.fc16.x86_64

How reproducible:
Always


Steps to Reproduce:
1. 
> ruby -v
ruby 1.8.7 (2011-02-18 patchlevel 334) [x86_64-linux]
> ruby -e "puts $:"
/usr/lib/ruby/site_ruby/1.8
/usr/lib64/ruby/site_ruby/1.8
/usr/lib64/ruby/site_ruby/1.8/x86_64-linux
/usr/lib/ruby/site_ruby
/usr/lib64/ruby/site_ruby
/usr/lib64/site_ruby/1.8
/usr/lib64/site_ruby/1.8/x86_64-linux
/usr/lib64/site_ruby
/usr/lib/ruby/1.8
/usr/lib64/ruby/1.8
/usr/lib64/ruby/1.8/x86_64-linux
.

2.
> ruby -v
ruby 1.8.7 (2011-02-18 patchlevel 334) [i386-linux]
> ruby -e "puts $:"
/usr/lib/ruby/site_ruby/1.8
/usr/lib/ruby/site_ruby/1.8
/usr/lib/ruby/site_ruby/1.8/i386-linux
/usr/lib/ruby/site_ruby
/usr/lib/ruby/site_ruby
/usr/lib/site_ruby/1.8
/usr/lib/site_ruby/1.8/i386-linux
/usr/lib/site_ruby
/usr/lib/ruby/1.8
/usr/lib/ruby/1.8
/usr/lib/ruby/1.8/i386-linux
.

Expected results:
The paths in load path should not be duplicated

Comment 1 Mamoru TASAKA 2011-07-04 11:51:51 UTC
Any reason that mocha should raise error for this issue?

(Well, it may be that there aren't any duplicate path, however I don't think raising error for this reason is preferable).

Comment 2 Vít Ondruch 2011-07-04 12:01:39 UTC
That is not mocha issue. If you'll take a look closer on my steps to reproduce, you will see that there are duplicated paths for i386.

The reason is because on x86_64 the paths are duplicated to load libraries from both, lib and lib64 where on i386 the lib64 falls back to lib and that creates the duplicated entries.

Comment 3 Mamoru TASAKA 2011-07-04 12:03:10 UTC
(This is not ruby, however for example as root:

# echo $PATH
/usr/lib/qt-3.3/bin:/usr/lib/mpich2/bin:/usr//sbin:/usr//bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin

So "duplicate path" is not ruby specific but somewhat common issue and we usually ignore this )

Comment 4 Mamoru TASAKA 2011-07-04 12:05:01 UTC
(In reply to comment #2)
> That is not mocha issue. If you'll take a look closer on my steps to reproduce,
> you will see that there are duplicated paths for i386.
> 
> The reason is because on x86_64 the paths are duplicated to load libraries from
> both, lib and lib64 where on i386 the lib64 falls back to lib and that creates
> the duplicated entries.

What I am saying is that I wonder there is any reason why mocha should complain and raise error for ruby that ruby has duplicate paths.

Comment 5 Mamoru TASAKA 2011-07-04 12:08:21 UTC
In other words, I wonder why duplicate paths on ruby really matters on mocha (although it may be that fixing this is preferable)

Comment 6 Vít Ondruch 2011-07-04 12:45:54 UTC
(In reply to comment #5)
> In other words, I wonder why duplicate paths on ruby really matters on mocha
> (although it may be that fixing this is preferable)

Mocha is not complaining about anything. ActiveSupport test is complaining. Here [1] is the patch which introduces the test case. Unfortunately there is no other explanation.

Since this problem is IMO introduced by ruby-1.8.7-lib-paths.patch patch, I would like to see it fixed in Fedora.

[1] https://github.com/rails/rails/commit/4419497e403387a3cc93c4c1a3b6a07314a85e43

Comment 7 Akira TAGOH 2011-07-05 01:47:49 UTC
IMHO expecting no duplicate load path may be wrong assumption. though that may directly affects the performance to find libs out. so that should be better fixed, but it's another issue.

Comment 8 Fedora Update System 2011-07-16 01:51:02 UTC
ruby-1.8.7.352-1.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/ruby-1.8.7.352-1.fc14

Comment 9 Fedora Update System 2011-07-16 01:51:44 UTC
ruby-1.8.7.352-1.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/ruby-1.8.7.352-1.fc15

Comment 10 Fedora Update System 2011-07-16 07:25:00 UTC
Package ruby-1.8.7.352-1.fc15:
* should fix your issue,
* was pushed to the Fedora 15 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing ruby-1.8.7.352-1.fc15'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/ruby-1.8.7.352-1.fc15
then log in and leave karma (feedback).

Comment 11 Vít Ondruch 2011-07-18 07:55:24 UTC
I did not tested it yet, but thank you for the fix anyway :)

Comment 12 Fedora Update System 2011-07-26 03:41:27 UTC
ruby-1.8.7.352-1.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 13 Fedora Update System 2011-07-26 03:44:20 UTC
ruby-1.8.7.352-1.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.