[#97536] [Ruby master Bug#16694] JIT vs hardened GCC with PCH — v.ondruch@...
Issue #16694 has been reported by vo.x (Vit Ondruch).
11 messages
2020/03/18
[ruby-core:97582] [Ruby master Bug#16737] File::BINARY doesn't work
From:
mail@...
Date:
2020-03-24 14:24:55 UTC
List:
ruby-core #97582
Issue #16737 has been reported by sos4nt (Stefan Sch=FC=DFler).
----------------------------------------
Bug #16737: File::BINARY doesn't work
https://bugs.ruby-lang.org/issues/16737
* Author: sos4nt (Stefan Sch=FC=DFler)
* Status: Open
* Priority: Normal
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
`File.open` takes a `mode` argument which can be given as a string or as an=
integer using `File::Constants`.
When using the latter, the constant `File::BINARY` doesn't have any effect:
```ruby
# this works:
File.open('foo', 'wb') do |f|
p f.binmode?
p f.external_encoding
end
#=3D> true
#=3D> #<Encoding:ASCII-8BIT>
# this doesn't:
File.open('foo', File::WRONLY|File::TRUNC|File::CREAT|File::BINARY) do |f|
p f.binmode?
p f.external_encoding
end
#=3D> false
#=3D> nil
```
Further inspecting `File::BINARY` reveals that it has a value of zero:
```ruby
File::BINARY #=3D> 0
```
So it's no surprise that OR-ing it doesn't do anything.
I've tried various Ruby versions from 1.9.3 to 2.7.0 and all showed the abo=
ve behavior. (I'm on macOS if that matters)
I'm aware that I can achieve the desired result by using a string mode or b=
y passing `binary: true`. But since Ruby accepts `mode` to be given as an i=
nteger, there should be a (working) "b" equivalent.
-- =
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=3Dunsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>