[#104169] [Ruby master Feature#17938] Keyword alternative for boolean positional arguments — matheusrichardt@...

Issue #17938 has been reported by matheusrich (Matheus Richard).

12 messages 2021/06/04

[#104213] [Ruby master Feature#17942] Add a `initialize(public @a, private @b)` shortcut syntax for defining public/private accessors for instance vars — tyler@...

SXNzdWUgIzE3OTQyIGhhcyBiZWVuIHJlcG9ydGVkIGJ5IFR5bGVyUmljayAoVHlsZXIgUmljayku

6 messages 2021/06/09

[#104288] [Ruby master Bug#17992] Upstreaming the htmlentities gem into CGI#.(un)escape_html — alexandermomchilov@...

Issue #17992 has been reported by AMomchilov (Alexander Momchilov).

9 messages 2021/06/15

[#104338] [Ruby master Misc#17997] DevelopersMeeting20210715Japan — mame@...

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

10 messages 2021/06/17

[#104361] [Ruby master Bug#18000] have_library doesn't work when ruby is compiled with --disable-shared --disable-install-static-library — jean.boussier@...

Issue #18000 has been reported by byroot (Jean Boussier).

9 messages 2021/06/18

[#104381] [Ruby master Feature#18004] Add Async to the stdlib — shannonskipper@...

Issue #18004 has been reported by shan (Shannon Skipper).

9 messages 2021/06/22

[#104401] [Ruby master Feature#18007] Help developers of C extensions meet requirements in "doc/extension.rdoc" — mike.dalessio@...

Issue #18007 has been reported by mdalessio (Mike Dalessio).

16 messages 2021/06/25

[#104430] [Ruby master Bug#18011] `Method#parameters` is incorrect for forwarded arguments — josh.cheek@...

Issue #18011 has been reported by josh.cheek (Josh Cheek).

12 messages 2021/06/29

[ruby-core:104335] [Ruby master Feature#17994] Clarify `IO.read` behavior and add `File.read` method

From: merch-redmine@...
Date: 2021-06-17 07:06:35 UTC
List: ruby-core #104335
Issue #17994 has been updated by jeremyevans0 (Jeremy Evans).


My only concern is that File isn't the only subclasses of IO.  There are also:

```
UNIXServer
UNIXSocket
UDPSocket
TCPServer
TCPSocket
IPSocket
Socket
BasicSocket
```

Do we want `Socket.read` to handle `|` specially (as `IO.read` does), or should it operate as `File.read` (as it does now)?  If it currently works as `File.read`, then switching to `IO.read` behavior could potentially result in security issues.  I doubt there is significant real-world usage of `Socket.read` or similar, so maybe this is not a significant concern.

Honestly, I don't think `read` makes sense as a class method on socket classes, so maybe we can avoid the issue by undefing it (after a deprecation period).

----------------------------------------
Feature #17994: Clarify `IO.read` behavior and add `File.read` method
https://bugs.ruby-lang.org/issues/17994#change-92556

* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
----------------------------------------
`IO.read` creates a subprocess when a given file name starts with a `|` character.

```
irb(main):001:0> IO.read("| ls /etc/passwd")
=> "/etc/passwd\n"
```

To disable this feature, `File.read` can be used.

```
irb(main):002:0> File.read("| ls /etc/passwd")
(irb):2:in `read': No such file or directory @ rb_sysopen - | ls /etc/passwd (Errno::ENOENT)
```

So, as far as I know, `File.read` is more prefereable to `IO.read` if a user want to just read a file.

However, in terms of the implementation, there is no definition of `File.read`. `File.read` invokes `IO.read` because `IO` is a superclass of `File`, and `IO.read` creates a subprocess only when its receiver is exactly the `IO` class.

I think there are two problems in the current situation:

1. The rdoc of `IO.read` does not explain the behavior to disable a subprocess invocation.
2. The rdoc does not have an entry for `File.read`.

I've created a PR to address the two issues by clarifying `IO.read` behavior and defining `File.read` as an alias to `IO.read`.

https://github.com/ruby/ruby/pull/4579



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

In This Thread