"require" behaves differently on ppc64el during certain conditions
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ruby3.0 (Ubuntu) |
Confirmed
|
High
|
Unassigned |
Bug Description
I have verified that under specific circumstances, 'require' can behave differently between ppc64el and other architectures.
Simple reproducer:
$ cat > foo.rb << __EOF__
begin
require 'bar'
rescue LoadError
puts "Caught first LoadError. Continuing..."
end
puts require 'bar'
__EOF__
$ cat > bar.rb << __EOF__
require 'baz'
__EOF__
$ ruby3.0 -I . foo.rb
On ppc64el, you will see:
Caught first LoadError. Continuing...
false
On non-ppc64el, you will see:
Caught first LoadError. Continuing...
<internal:
Did you mean? bar
from <internal:
from /home/ubuntu/
from <internal:
from <internal:
from foo.rb:7:in `<main>'
Changed in ruby3.0 (Ubuntu): | |
milestone: | none → ubuntu-22.04-beta |
I debugged this a little bit and found that the difference manifests on ruby3.0's load.c: require_ internal, more specifically this part here:
1118 if (found) {
1119 if (!path || !(ftptr = load_lock(th->vm, RSTRING_PTR(path), warn))) {
1120 result = 0;
1121 }
On ppc64el, the call to "load_lock" fails for some reason. On non-ppc64el, the call succeeds and the function proceeds to successfully load "bar".