Issue #11915 has been updated by Linus Sellberg.


Nobuyoshi Nakada wrote:
> Linus Sellberg wrote:
> > It is one thing that some of the `.open` methods actually can execute stuff, but a method named 'read' should not behave like that.
> 
> `File.open` does not.

But File.read DOES. Which is what I find wrong. That File.open doesn't is another reason to not have .read do that.

----------------------------------------
Bug #11915: File.read reading string starting with | executes it.
https://bugs.ruby-lang.org/issues/11915#change-55944

* Author: Linus Sellberg
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 2.1.5p273
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
```ruby
puts File.read "|/bin/ls"
[output of executing ls]
=> nil
```
This is quite surprising behaviour.

It is one thing that some of the `.open` methods actually can execute stuff, but a method named 'read' should not behave like that.



-- 
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>