[#118346] [Ruby master Bug#20586] Some filesystem calls in dir.c are missing error handling and can return incorrect results if interrupted — "ivoanjo (Ivo Anjo) via ruby-core" <ruby-core@...>
Issue #20586 has been reported by ivoanjo (Ivo Anjo).
13 messages
2024/06/19
[ruby-core:118210] [Ruby master Bug#20416] IO#read doesn't change buffer encoding unless `maxlen = nil`
From:
"mame (Yusuke Endoh) via ruby-core" <ruby-core@...>
Date:
2024-06-06 09:43:11 UTC
List:
ruby-core #118210
Issue #20416 has been updated by mame (Yusuke Endoh).
Status changed from Open to Closed
Discussed at the dev meeting, and @matz agreed with @nobu. Closing
----------------------------------------
Bug #20416: IO#read doesn't change buffer encoding unless `maxlen = nil`
https://bugs.ruby-lang.org/issues/20416#change-108697
* Author: andrykonchin (Andrew Konchin)
* Status: Closed
* ruby -v: 3.3.0
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
`IO#read(nil, buffer)` doesn't change buffer's encoding, but it does when `maxlen` parameter is specified:
```ruby
buffer = "".encode(Encoding::ISO_8859_1)
p File.open("test.rb").read(1000, buffer).encoding # => #<Encoding:ISO-8859-1>
buffer = "".encode(Encoding::ISO_8859_1)
p File.open("test.rb").read(nil, buffer).encoding # => #<Encoding:UTF-8>
```
I would expect changing buffer encoding in all the cases.
--
https://bugs.ruby-lang.org/