Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File.open ignores flags option #2820

Closed
mhib opened this issue Jan 6, 2023 · 3 comments
Closed

File.open ignores flags option #2820

mhib opened this issue Jan 6, 2023 · 3 comments

Comments

@mhib
Copy link

mhib commented Jan 6, 2023

Code to reproduce the issue:

File.open("not_existing_file", flags: File::CREAT | File::WRONLY)

This line returns a File both on CRuby and JRuby, but throws an error on TruffleRuby.

My ruby --version:

truffleruby 22.3.0, like ruby 3.0.3, GraalVM CE Native [x86_64-darwin]
@eregon
Copy link
Member

eregon commented Jan 6, 2023

Thank you for the report.

@eregon
Copy link
Member

eregon commented Jan 6, 2023

I can repro on truffleruby-dev:

$ ruby -e 'File.open("not_existing_file", flags: File::CREAT | File::WRONLY)'
<internal:core> core/errno.rb:48:in `handle': No such file or directory - not_existing_file (Errno::ENOENT)
	from <internal:core> core/io.rb:898:in `sysopen'
	from <internal:core> core/file.rb:1216:in `initialize'
	from <internal:core> core/io.rb:674:in `open'
	from -e:1:in `<main>'

@andrykonchin
Copy link
Member

Fixed in 8bb04d8

@andrykonchin andrykonchin added this to the 23.0.0 Release milestone Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants