Skip to content

Ignore close errors in read-only files. #1130

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

Merged
merged 4 commits into from
Dec 31, 2019

Conversation

pvdrz
Copy link
Contributor

@pvdrz pvdrz commented Dec 27, 2019

this fixes #999

r? @RalfJung

@pvdrz pvdrz marked this pull request as ready for review December 27, 2019 14:02
@pvdrz pvdrz force-pushed the ignore-close-read-only branch from f2783db to aec2f31 Compare December 29, 2019 16:31
src/shims/fs.rs Outdated
// And return the result.
result
// We sync the file if it was opened in a mode different than read-only.
if !handle.read_only {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless there are good arguments for the opposite, it's better to put the positive case first (if handle.read_only). That avoids a mental double-negation when considering the else branch.

Copy link
Contributor Author

@pvdrz pvdrz Dec 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did it this way to keep the "usual" behavior first and then be able to explain why the read-only exception is required.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is read-write more "usual" than read-only?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huh that's a good question. I don't think that's the case. Taking that into account, should I change the field inside the handle to read-write then?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whatever you prefer, as long as you avoid the negation here. ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it to avoid the double negation.

@pvdrz pvdrz force-pushed the ignore-close-read-only branch from aec2f31 to ce4e1f9 Compare December 30, 2019 03:51
@RalfJung
Copy link
Member

Looking good, thanks!

@bors r+

@bors
Copy link
Contributor

bors commented Dec 31, 2019

📌 Commit a40a99d has been approved by RalfJung

bors added a commit that referenced this pull request Dec 31, 2019
Ignore close errors in read-only files.

this fixes #999

r? @RalfJung
@bors
Copy link
Contributor

bors commented Dec 31, 2019

⌛ Testing commit a40a99d with merge 39146c4...

@RalfJung RalfJung mentioned this pull request Dec 31, 2019
@bors
Copy link
Contributor

bors commented Dec 31, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: RalfJung
Pushing 39146c4 to master...

@bors bors merged commit a40a99d into rust-lang:master Dec 31, 2019
bors added a commit that referenced this pull request Dec 31, 2019
test macOS hashmap

With #1130 landed, this should work now. Thanks @christianpoveda!

Fixes #686
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.

macOS: Implement stat64 to get rid of the termcap hack
3 participants