[#99856] [Ruby master Feature#17143] Improve support for warning categories — merch-redmine@...

Issue #17143 has been reported by jeremyevans0 (Jeremy Evans).

16 messages 2020/09/03

[#99868] [Ruby master Bug#17144] Tempfile.open { ... } does not unlink the file — eregontp@...

Issue #17144 has been reported by Eregon (Benoit Daloze).

15 messages 2020/09/03

[#99885] [Ruby master Feature#17145] Ractor-aware `Object#deep_freeze` — marcandre-ruby-core@...

Issue #17145 has been reported by marcandre (Marc-Andre Lafortune).

32 messages 2020/09/03

[#99903] [Ruby master Bug#17146] Queue operations are allowed after it is frozen — eregontp@...

Issue #17146 has been reported by Eregon (Benoit Daloze).

16 messages 2020/09/03

[#100016] [Ruby master Feature#17171] Why is the visibility of constants not affected by `private`? — marcandre-ruby-core@...

Issue #17171 has been reported by marcandre (Marc-Andre Lafortune).

10 messages 2020/09/15

[#100024] [Ruby master Bug#17175] Ruby 2.5: OpenSSL related test failures — jaruga@...

Issue #17175 has been reported by jaruga (Jun Aruga).

10 messages 2020/09/16

[#100025] [Ruby master Feature#17176] GC.enable_autocompact / GC.disable_autocompact — tenderlove@...

Issue #17176 has been reported by tenderlovemaking (Aaron Patterson).

11 messages 2020/09/16

[#100099] [Ruby master Bug#17184] No stdlib function to perform simple string replacement — sheerun@...

Issue #17184 has been reported by sheerun (Adam Stankiewicz).

18 messages 2020/09/24

[#100192] [Ruby master Bug#17197] Some Hash methods still have arity 2 instead of 1 — marcandre-ruby-core@...

Issue #17197 has been reported by marcandre (Marc-Andre Lafortune).

14 messages 2020/09/28

[#100200] [Ruby master Misc#17199] id outputed by inspect and to_s output does not allow to find actual object_id and vice-versa — baptiste.courtois@...

Issue #17199 has been reported by Annih (Baptiste Courtois).

7 messages 2020/09/28

[#100206] [Ruby master Misc#17200] DevelopersMeeting20201026Japan — mame@...

Issue #17200 has been reported by mame (Yusuke Endoh).

18 messages 2020/09/28

[#100239] [Ruby master Feature#17206] Introduce new Regexp option to avoid MatchData allocation — fatkodima123@...

Issue #17206 has been reported by fatkodima (Dima Fatko).

8 messages 2020/09/30

[ruby-core:99987] [Ruby master Bug#13932] [PATCH] Extension libraries take precedence in checks of later Kernel.#require calls for features without file extensions

From: merch-redmine@...
Date: 2020-09-10 22:34:13 UTC
List: ruby-core #99987
Issue #13932 has been updated by jeremyevans0 (Jeremy Evans).

Status changed from Open to Closed

This patch appears to change a general behavior of `require` even when extension libraries are not involved.  For example, it changes the behavior of this code:

```ruby
Dir.mkdir('a')
Dir.mkdir('b')
File.write('a/c.rb', '$a = 1')
File.write('b/c.rb', '$a = 2')

$:.unshift('a')
require 'c'
p $a
$:.unshift('b')
require 'c'
p $a
# Before: 2
# With Patch: 1
```

I don't think Ruby's current behavior here is a bug.  `require` will not load the same file path a second time, but it will load a different file path for the same argument if there has been a change to the load path.  The documentation for `require` describes this behavior: `A file will not be loaded again if its path already appears in $"` (saying nothing about the argument to `require`).  As the current behavior does not appear to be a bug, I'm going to close this.

----------------------------------------
Bug #13932: [PATCH] Extension libraries take precedence in checks of later Kernel.#require calls for features without file extensions
https://bugs.ruby-lang.org/issues/13932#change-87525

* Author: akihikodaki (Akihiko Odaki)
* Status: Closed
* Priority: Normal
* ruby -v: ruby 2.5.0dev (2017-09-23 trunk 60002) [x86_64-linux]
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
Extension libraries take precedence in checks of later `Kernel.#require` calls for features without file extensions. That behavior is inconsistent with the first call, and can cause problems.

For instance, feature `openssl` has `openssl.rb` and `openssl.so`, but it assumes `openssl.rb` will always be loaded when it gets required. That assumption works for the first call of `Kernel.#require`, but for the later calls, `require` assumes `openssl.so` is being required and checks if the file is valid for the requirement.

Usually that is not so problematic since it just check if `openssl.so`, which is already required by `openssl.rb`, is required or not. However, if there is a new alternative `openssl.rb` in `$:`, the file will be loaded and conflict with the feature already loaded.
The below is a code example.

~~~Ruby
p $:.include? '/usr/lib/ruby/2.4.0' # true
p $:.include? '/home/aki/mastodon/vendor/bundle/ruby/2.4.0/gems/openssl-2.0.5/lib' # false

p $".include? '/usr/lib/ruby/2.4.0/openssl/openssl.rb' # false
p $".include? '/home/aki/mastodon/vendor/bundle/ruby/2.4.0/gems/openssl-2.0.5/lib/openssl.rb' # false

require 'openssl'

p $".include? '/usr/lib/ruby/2.4.0/openssl/openssl.rb' # true
p $".include? '/home/aki/mastodon/vendor/bundle/ruby/2.4.0/gems/openssl-2.0.5/lib/openssl.rb' # false

$:.unshift '/home/aki/mastodon/vendor/bundle/ruby/2.4.0/gems/openssl-2.0.5/lib'
require 'openssl'

p $".include? '/home/aki/mastodon/vendor/bundle/ruby/2.4.0/gems/openssl-2.0.5/lib/openssl.rb' # true (unexpected)
~~~

---Files--------------------------------
load.patch (2.42 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next