[#80974] [Ruby trunk Feature#13517] [PATCH] reduce rb_mutex_t size from 160 to 80 bytes on 64-bit — ko1@...
Issue #13517 has been updated by ko1 (Koichi Sasada).
4 messages
2017/05/02
[#81024] Re: [Ruby trunk Feature#13517] [PATCH] reduce rb_mutex_t size from 160 to 80 bytes on 64-bit
— SASADA Koichi <ko1@...>
2017/05/07
sorry for late response.
[#80996] [Ruby trunk Feature#13544] Allow loading an ISeqs sequence directly from a C extension without requiring buffer is in an RVALUE — sam.saffron@...
Issue #13544 has been reported by sam.saffron (Sam Saffron).
3 messages
2017/05/04
[#81016] [Ruby trunk Bug#13526] Segmentation fault at 0x0055c2e58e8920 ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux] — s.wanabe@...
Issue #13526 has been updated by wanabe (_ wanabe).
3 messages
2017/05/07
[#81048] Re: [ruby-cvs:65788] normal:r58614 (trunk): rb_execution_context_t: move stack, stack_size and cfp from rb_thread_t — SASADA Koichi <ko1@...>
It causes compile error on raspi 3.
3 messages
2017/05/09
[#81201] Re: [ruby-cvs:65935] normal:r58761 (trunk): test/test_extilibs.rb: do not check the existence of fiddle — "U.NAKAMURA" <usa@...>
Hi, Eric
4 messages
2017/05/16
[#81202] Re: [ruby-cvs:65935] normal:r58761 (trunk): test/test_extilibs.rb: do not check the existence of fiddle
— Eric Wong <normalperson@...>
2017/05/16
"U.NAKAMURA" <usa@garbagecollect.jp> wrote:
[#81427] Fwd: [ruby-changes:46809] normal:r58924 (trunk): test for IO.copy_stream CPU usage (r58534) — SASADA Koichi <ko1@...>
Hi,
6 messages
2017/05/28
[#81428] Re: Fwd: [ruby-changes:46809] normal:r58924 (trunk): test for IO.copy_stream CPU usage (r58534)
— Eric Wong <normalperson@...>
2017/05/28
SASADA Koichi <ko1@atdot.net> wrote:
[ruby-core:81463] [Ruby trunk Bug#12159] Thread::Backtrace::Location#path returns absolute path for files loaded by require_relative
From:
ko1@...
Date:
2017-05-30 06:10:14 UTC
List:
ruby-core #81463
Issue #12159 has been updated by ko1 (Koichi Sasada).
After consideration, I changed my proposal.
* Rename `#absolute_path` to `#real_path` (or `#realpath`) and make `#aboluste_path` as alias of `#real_path`.
* change `absolute_path` (`real_path`) on `eval` with given file name.
# summary of current behavior
On MRI, "path" is used several ways.
* `__FILE__`
* `caller(_locations)`, backtrace
* `requre_relative` (base directory)
* `$0`
And ISeq has `path` and `absolute_path`. I use this terminology.
* path: given path.
* absolute_path: realpath(path) if path is exist. If not, it is nil.
Above usages are implemented with `path` and `absolute_path`.
```
* `__FILE__` # path
* `caller(_locations)`, backtrace # path
* `requre_relative` (base directory) # absolute_path
* `$0` # path
```
Most of case, path and absolute_path is same. However, the following case they are not same.
* `path` and `realpath(path)` is different because of symlink (`absolute_path` is realpath).
* script name is given by command parameter (`ruby x.rb`) (`absolute_path` will be `/path/to/x.rb`).
* `eval()` without file name (`path` will be "(eval)" and `absolute_path` will be nil).
Note that `eval(script, binding, "x.rb")` makes `path` and `absolute_path` return `"x.rb"` even if given file name is not realpath.
```
eval('caller_locations(0, 1).each{|e| p [e.path, e.absolute_path]}')
eval('caller_locations(0, 1).each{|e| p [e.path, e.absolute_path]}', binding, 'x.rb')
["(eval)", nil]
["x.rb", "x.rb"]
```
# proposal
Checking current behavior, `#absolute_path` is used as `realpath` (check the existing and resolve symlink). So I want to add `#realpath` or `#real_path`. I'm not sure which is better because there is `File#realpath` and `absolute_path` include `_`.
Also I want to check realpass for file name given at `eval()`. If file name is not existing, `#realpath` should be `nil`. In this case, `require_relative` should fail because MRI can't infer the base directory.
How about it?
----------------------------------------
Bug #12159: Thread::Backtrace::Location#path returns absolute path for files loaded by require_relative
https://bugs.ruby-lang.org/issues/12159#change-65168
* Author: tagomoris (Satoshi TAGOMORI)
* Status: Assigned
* Priority: Normal
* Assignee: ko1 (Koichi Sasada)
* Target version:
* ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin14]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
I expected that Thread::Backtrace::Location#path always returns base filename, but returns absolute path for files loaded by require_relative.
Is it intentional? or a bug?
~~~
$ ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin14]
$ cat > x.rb
def a
caller_locations
end
p a.first.path
$ cat > y.rb
require_relative "x"
$ ruby x.rb
"x.rb"
$ ruby y.rb
"/Users/tagomoris/x.rb"
~~~
--
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>