[#106355] [Ruby master Bug#18373] RBS build failure: '/include/x86_64-linux/ruby/config.h', needed by 'constants.o'. — "vo.x (Vit Ondruch)" <noreply@...>
Issue #18373 has been reported by vo.x (Vit Ondruch).
28 messages
2021/12/01
[ruby-core:106637] [Ruby master Bug#18407] Behavior difference between integer and string flags to File creation
From:
"byroot (Jean Boussier)" <noreply@...>
Date:
2021-12-13 15:17:23 UTC
List:
ruby-core #106637
Issue #18407 has been updated by byroot (Jean Boussier).
Digging just a little bit:
```c
#ifdef O_BINARY
if (oflags & O_BINARY) {
fmode |= FMODE_BINMODE;
}
#endif
```
and:
```ruby
>> File::BINARY
=> 0
```
In short `File::BINARY` is noop on unixes, it's a windows only option, so Ruby defines it as `0` on these OS and basically does nothing.
The problem now is that to make it behave like `b`, it would need to have another value than `0`, which could be a breaking change :/
----------------------------------------
Bug #18407: Behavior difference between integer and string flags to File creation
https://bugs.ruby-lang.org/issues/18407#change-95309
* Author: deivid (David Rodr鱈guez)
* Status: Open
* Priority: Normal
* ruby -v: 3.0.3
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
Hi!
I was under the impression that these two commands should either both work of both fail, however they behave differently.
```
$ ruby -ropen-uri -EUTF-8:UTF-8 -e 'f = File.new("foo", "wb"); f.write URI.open("https://rubygems.org/gems/rake-13.0.6.gem").read'
$ ruby -ropen-uri -EUTF-8:UTF-8 -e 'f = File.new("foo", File::WRONLY | File::TRUNC | File::BINARY); f.write URI.open("https://rubygems.org/gems/rake-13.0.6.gem").read'
-e:1:in `write': "\\x8B" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
from -e:1:in `<main>'
```
Could be an actual bug, and me misunderstanding the documentation. In any case it seemed worth reporting.
--
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>