[#99115] [Ruby master Bug#17023] How to prevent String memory to be relocated in ruby-ffi — larskanis@...
Issue #17023 has been reported by larskanis (Lars Kanis).
22 messages
2020/07/10
[#99375] [Ruby master Feature#17055] Allow suppressing uninitialized instance variable and method redefined verbose mode warnings — merch-redmine@...
Issue #17055 has been reported by jeremyevans0 (Jeremy Evans).
29 messages
2020/07/28
[#101207] [Ruby master Feature#17055] Allow suppressing uninitialized instance variable and method redefined verbose mode warnings
— merch-redmine@...
2020/12/02
Issue #17055 has been updated by jeremyevans0 (Jeremy Evans).
[#101231] Re: [Ruby master Feature#17055] Allow suppressing uninitialized instance variable and method redefined verbose mode warnings
— Austin Ziegler <halostatue@...>
2020/12/03
What does this mean?
[ruby-core:99099] [Ruby master Feature#16978] Ruby should not use realpath for __FILE__
From:
merch-redmine@...
Date:
2020-07-09 21:10:51 UTC
List:
ruby-core #99099
Issue #16978 has been updated by jeremyevans0 (Jeremy Evans). Backport deleted (2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN) ruby -v deleted (ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]) Tracker changed from Bug to Feature I don't think this is a bug. `__FILE__` is documented as follows: `The path to the current file.` Which path (real, absolute, relative, expanded) is not specified. Not using the real path would lead to behavior that depends on the first path used when requiring the file. `a/test.rb` (`b` symlinked to `a`): ```ruby def a __FILE__ end ``` ``` ruby -Ia -Ib -rtest -e 'a' # /path/to/a/test.rb ruby -Ib -Ia -rtest -e 'a' # Current: /path/to/a/test.rb # Your proposed: /path/to/b/test.rb ``` What actually happens is not the file path being converted to a real path, but the include directory being converted to a real path before the file is required (in `rb_construct_expanded_load_path`). Changing this to not use a real path would probably break the code that checks that a feature hasn't been require twice. For example, this code would change behavior: ``` $: << 'a' require 'test' $: << 'b' require 'test' # Current: not loaded again # Your proposed: loaded again ``` If you symlink the file itself and not the include directory, Ruby will attempt to require it as a separate feature. Note that if you provide a path when requiring, Ruby already operates the way you want: ``` ruby -r./a/test -e 'a' # /path/to/a/test.rb ruby -r./b/test -e 'a' # /path/to/b/test.rb ``` I can certainly see pros and cons from changing the behavior, but I would consider this a feature request and not a bug. ---------------------------------------- Feature #16978: Ruby should not use realpath for __FILE__ https://bugs.ruby-lang.org/issues/16978#change-86473 * Author: vo.x (Vit Ondruch) * Status: Open * Priority: Normal ---------------------------------------- This is the simplest test case: ~~~ $ mkdir a $ echo "puts __FILE__" > a/test.rb $ ln -s a b $ ruby -Ib -e "require 'test'" /builddir/a/test.rb ~~~ This behavior is problematic, because Ruby should not know nothing about the `a` directory. It was not instructed to use it. I should always refer to the file using the original path and do not dig into the underlying details, otherwise depending on file system setup, one might be forced to used `File.realpath` everywhere trying to use `__FILE__`. -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>