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

Add read check in IO#getbyte #1194

Merged
merged 3 commits into from
Sep 3, 2023

Conversation

herwinw
Copy link
Member

@herwinw herwinw commented Sep 2, 2023

This is similar to #1190 where we had to convert the exception in case of no write access. Two helper methods have been added to help with this check, I expect we'll be needing a lot more of them.

ruby/spec#1068 has been added as an upstream request to add this to the specs. For the time being, a local test has has been added.

@herwinw herwinw marked this pull request as draft September 2, 2023 12:40
@herwinw herwinw self-assigned this Sep 2, 2023
@herwinw
Copy link
Member Author

herwinw commented Sep 2, 2023

This needs a different approach. The value of sb.st_mode is the mode on the filesystem, so if I have a file that is writable for the user, and open that file in read only mode, it would still return this file as writable.

For now a test has been added to `test/natalie/`. As soon as the
upstream PR will be merged, we can remove this one.
@herwinw herwinw marked this pull request as ready for review September 3, 2023 17:05
@herwinw
Copy link
Member Author

herwinw commented Sep 3, 2023

This one is good to go now

@seven1m seven1m merged commit 24ab4d3 into natalie-lang:master Sep 3, 2023
10 checks passed
@herwinw herwinw deleted the io_getbyte_writeonly branch September 3, 2023 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants