This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours

Bug 722887

Summary: Load paths duplicated for i386 =>ActiveSupport build fails on i386
Product: Red Hat Enterprise Linux 6 Reporter: Vít Ondruch <vondruch>
Component: rubyAssignee: Vít Ondruch <vondruch>
Status: CLOSED ERRATA QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1CC: amarecek, eng-i18n-bugs, jeremy, mmorsi, mtasaka, tagoh, vanmeeuwen+fedora, vondruch
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 718695 Environment:
Last Closed: 2011-12-06 07:08:09 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On: 718695    
Bug Blocks:    

Description Vít Ondruch 2011-07-18 07:21:27 EDT
+++ This bug was initially created as a clone of Bug #718695 +++

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

--- Additional comment from mtasaka@fedoraproject.org on 2011-07-04 07:51:51 EDT ---

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).

--- Additional comment from vondruch@redhat.com on 2011-07-04 08:01:39 EDT ---

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.

--- Additional comment from mtasaka@fedoraproject.org on 2011-07-04 08:03:10 EDT ---

(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 )

--- Additional comment from mtasaka@fedoraproject.org on 2011-07-04 08:05:01 EDT ---

(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.

--- Additional comment from mtasaka@fedoraproject.org on 2011-07-04 08:08:21 EDT ---

In other words, I wonder why duplicate paths on ruby really matters on mocha (although it may be that fixing this is preferable)

--- Additional comment from vondruch@redhat.com on 2011-07-04 08:45:54 EDT ---

(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

--- Additional comment from tagoh@redhat.com on 2011-07-04 21:47:49 EDT ---

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.

--- Additional comment from updates@fedoraproject.org on 2011-07-15 21:51:02 EDT ---

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

--- Additional comment from updates@fedoraproject.org on 2011-07-15 21:51:44 EDT ---

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

--- Additional comment from updates@fedoraproject.org on 2011-07-16 03:25:00 EDT ---

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).

--- Additional comment from vondruch@redhat.com on 2011-07-18 03:55:24 EDT ---

I did not tested it yet, but thank you for the fix anyway :)
Comment 6 errata-xmlrpc 2011-12-06 07:08:09 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2011-1581.html