* [ruby-core:120797] [Ruby master Bug#21091] recursive require not detected on case insensitive filesystem
@ 2025-01-27 6:43 rrotter (Ryan Rotter) via ruby-core
2025-01-27 8:25 ` [ruby-core:120799] " shyouhei (Shyouhei Urabe) via ruby-core
2025-01-27 9:14 ` [ruby-core:120800] " rrotter (Ryan Rotter) via ruby-core
0 siblings, 2 replies; 3+ messages in thread
From: rrotter (Ryan Rotter) via ruby-core @ 2025-01-27 6:43 UTC (permalink / raw)
To: ruby-core; +Cc: rrotter (Ryan Rotter)
Issue #21091 has been reported by rrotter (Ryan Rotter).
----------------------------------------
Bug #21091: recursive require not detected on case insensitive filesystem
https://bugs.ruby-lang.org/issues/21091
* Author: rrotter (Ryan Rotter)
* Status: Open
* ruby -v: ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +PRISM [arm64-darwin24]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
On case insensitive filesystems `require`ing a file from itself causes the file to be `require`d twice if the initial `require` and the `require` inside the file have different capitalization.
I expect the second `require` to return false, and not execute the file a second time.
```
~ % cat /tmp/foo.rb
puts "loading #{__FILE__}"
require "/tmp/foo"
SOME_GLOBAL = "foobar".freeze
~ % ruby -r/tmp/FOO
loading /tmp/FOO.rb
loading /tmp/foo.rb
/tmp/FOO.rb:3: warning: already initialized constant SOME_GLOBAL
/tmp/foo.rb:3: warning: previous definition of SOME_GLOBAL was here
```
This is on macOS 15.1.1, using the default case-insensitive APFS, and ruby 3.4.1.
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
* [ruby-core:120799] [Ruby master Bug#21091] recursive require not detected on case insensitive filesystem
2025-01-27 6:43 [ruby-core:120797] [Ruby master Bug#21091] recursive require not detected on case insensitive filesystem rrotter (Ryan Rotter) via ruby-core
@ 2025-01-27 8:25 ` shyouhei (Shyouhei Urabe) via ruby-core
2025-01-27 9:14 ` [ruby-core:120800] " rrotter (Ryan Rotter) via ruby-core
1 sibling, 0 replies; 3+ messages in thread
From: shyouhei (Shyouhei Urabe) via ruby-core @ 2025-01-27 8:25 UTC (permalink / raw)
To: ruby-core; +Cc: shyouhei (Shyouhei Urabe)
Issue #21091 has been updated by shyouhei (Shyouhei Urabe).
Status changed from Open to Third Party's Issue
There's not much thing we can do to this situation. Your file system opted to provide us multiple file paths for an identical content. That's how your operating system is designed to work. Ruby doesn't prevent you from shooting yourself in foot.
----------------------------------------
Bug #21091: recursive require not detected on case insensitive filesystem
https://bugs.ruby-lang.org/issues/21091#change-111666
* Author: rrotter (Ryan Rotter)
* Status: Third Party's Issue
* ruby -v: ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +PRISM [arm64-darwin24]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
On case insensitive filesystems `require`ing a file from itself causes the file to be `require`d twice if the initial `require` and the `require` inside the file have different capitalization.
I expect the second `require` to return false, and not execute the file a second time.
```
~ % cat /tmp/foo.rb
puts "loading #{__FILE__}"
require "/tmp/foo"
SOME_GLOBAL = "foobar".freeze
~ % ruby -r/tmp/FOO
loading /tmp/FOO.rb
loading /tmp/foo.rb
/tmp/FOO.rb:3: warning: already initialized constant SOME_GLOBAL
/tmp/foo.rb:3: warning: previous definition of SOME_GLOBAL was here
```
This is on macOS 15.1.1, using the default case-insensitive APFS, and ruby 3.4.1.
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
* [ruby-core:120800] [Ruby master Bug#21091] recursive require not detected on case insensitive filesystem
2025-01-27 6:43 [ruby-core:120797] [Ruby master Bug#21091] recursive require not detected on case insensitive filesystem rrotter (Ryan Rotter) via ruby-core
2025-01-27 8:25 ` [ruby-core:120799] " shyouhei (Shyouhei Urabe) via ruby-core
@ 2025-01-27 9:14 ` rrotter (Ryan Rotter) via ruby-core
1 sibling, 0 replies; 3+ messages in thread
From: rrotter (Ryan Rotter) via ruby-core @ 2025-01-27 9:14 UTC (permalink / raw)
To: ruby-core; +Cc: rrotter (Ryan Rotter)
Issue #21091 has been updated by rrotter (Ryan Rotter).
I would agree with your assessment if requiring both names of the same file sequentially loaded it twice,
but ruby is detecting and handling this when it's not recursive. The following code works as expected:
```
# returns true
require '/tmp/foo'
# returns false
require '/tmp/FOO'
```
----------------------------------------
Bug #21091: recursive require not detected on case insensitive filesystem
https://bugs.ruby-lang.org/issues/21091#change-111667
* Author: rrotter (Ryan Rotter)
* Status: Third Party's Issue
* ruby -v: ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +PRISM [arm64-darwin24]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
On case insensitive filesystems `require`ing a file from itself causes the file to be `require`d twice if the initial `require` and the `require` inside the file have different capitalization.
I expect the second `require` to return false, and not execute the file a second time.
```
~ % cat /tmp/foo.rb
puts "loading #{__FILE__}"
require "/tmp/foo"
SOME_GLOBAL = "foobar".freeze
~ % ruby -r/tmp/FOO
loading /tmp/FOO.rb
loading /tmp/foo.rb
/tmp/FOO.rb:3: warning: already initialized constant SOME_GLOBAL
/tmp/foo.rb:3: warning: previous definition of SOME_GLOBAL was here
```
This is on macOS 15.1.1, using the default case-insensitive APFS, and ruby 3.4.1.
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-01-27 9:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-27 6:43 [ruby-core:120797] [Ruby master Bug#21091] recursive require not detected on case insensitive filesystem rrotter (Ryan Rotter) via ruby-core
2025-01-27 8:25 ` [ruby-core:120799] " shyouhei (Shyouhei Urabe) via ruby-core
2025-01-27 9:14 ` [ruby-core:120800] " rrotter (Ryan Rotter) via ruby-core
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).