Skip to content

Clarify writable behavior of readonly-named Permissions methods. #43883

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 3 commits into from
Aug 16, 2017

Conversation

frewsxcv
Copy link
Member

Opened primarily to fix #41984.

@rust-highfive
Copy link
Contributor

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

src/libstd/fs.rs Outdated
/// Modifies the readonly flag for this set of permissions. If the
/// `readonly` argument is `true`, using the resulting `Permission` will
/// make the file unwritable. Conversely, if it's is `false`, using the
/// resulting `Permission` will make the file writable.
Copy link
Member Author

@frewsxcv frewsxcv Aug 15, 2017

Choose a reason for hiding this comment

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

This all sounds wordy, if anyone has suggestions to improve the flow here, would love to hear!

@QuietMisdreavus
Copy link
Member

copying from our conversation in IRC:

"Unwritable", while accurate, sounds a little clumsy. The readonly function can keep it as-is, but the set_readonly might work better by breaking it out:

Modifies the readonly flag for this set of permissions. If the
readonly argument is true, using the resulting Permission will
forbid writing to the file. Conversely, if it's is false, using the
resulting Permission will allow writing to the file.

I originally had "will make the file unable to be written to" for the "if true" sentence, but i kinda like the allow/forbid dichotomy like this.

@alexcrichton
Copy link
Member

r? @QuietMisdreavus

@arielb1 arielb1 added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 15, 2017
@frewsxcv frewsxcv force-pushed the frewsxcv-set-readonly-clarification branch 2 times, most recently from 9043b7a to 4c68a52 Compare August 16, 2017 01:41
@frewsxcv frewsxcv force-pushed the frewsxcv-set-readonly-clarification branch from 4c68a52 to 10a479e Compare August 16, 2017 01:43
@frewsxcv
Copy link
Member Author

@QuietMisdreavus tweaked the wording a little bit. let me know how that sounds

diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs
index d678705626..a12f55ad9c 100644
--- a/src/libstd/fs.rs
+++ b/src/libstd/fs.rs
@@ -936,8 +936,9 @@ impl Permissions {
 
     /// Modifies the readonly flag for this set of permissions. If the
     /// `readonly` argument is `true`, using the resulting `Permission` will
-    /// make the file unwritable. Conversely, if it's is `false`, using the
-    /// resulting `Permission` will make the file writable.
+    /// update file permissions to forbid writing. Conversely, if it's `false`,
+    /// using the resulting `Permission` will update file permissions to allow
+    /// writing.
     ///
     /// This operation does **not** modify the filesystem. To modify the
     /// filesystem use the `fs::set_permissions` function.

@QuietMisdreavus
Copy link
Member

Looks good, thanks!

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Aug 16, 2017

📌 Commit 10a479e has been approved by QuietMisdreavus

@bors
Copy link
Collaborator

bors commented Aug 16, 2017

⌛ Testing commit 10a479e with merge 4fc3765...

bors added a commit that referenced this pull request Aug 16, 2017
…r=QuietMisdreavus

Clarify writable behavior of readonly-named `Permissions` methods.

Opened primarily to fix #41984.
@bors
Copy link
Collaborator

bors commented Aug 16, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: QuietMisdreavus
Pushing 4fc3765 to master...

@bors bors merged commit 10a479e into rust-lang:master Aug 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fs::Permissions set_readonly is odd on Unix.
6 participants