Add a method for setting permissions directly on an open file.#37886
Add a method for setting permissions directly on an open file.#37886bors merged 1 commit intorust-lang:masterfrom
Conversation
|
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
Just set the file times to 0. That way they won't update and you'll only modify the file attributes. |
|
Is that documented anywhere? I couldn't find that information on MSDN. |
|
I couldn't find any documentation about it myself, but I'm pretty sure it is a feature. Even |
|
Grumble... undocumented APIs... anti-trust settlement... sigh (but thanks). |
src/libstd/sys/windows/fs.rs
Outdated
src/libstd/sys/windows/fs.rs
Outdated
There was a problem hiding this comment.
This field isn't listed in your FILE_BASIC_INFO definition.
2f404f5 to
1ebe3ef
Compare
|
So, the question is, does this need an RFC (it's a new public API but it mirrors methods like |
|
This is small enough that it shouldn't need an RFC, although it might still go through the rfcbot merge process with the libs subteam. |
|
Looks good to me, thanks @Stebalien! Yeah it's ok to not have an RFC for this. Could you file a tracking issue for this, though, and fill that out? I'll tag it afterwards and then r+ so we can land. |
|
Done. |
src/libstd/fs.rs
Outdated
There was a problem hiding this comment.
Before you merge, would you like me to keep this note or wait till File::set_permissions stabilizes?
There was a problem hiding this comment.
Ah let's leave this out until the method stabilizes
|
@bors: r+ |
|
📌 Commit 11e8120 has been approved by |
Add a method for setting permissions directly on an open file. On unix like systems, the underlying file corresponding to any given path may change at any time. This function makes it possible to set the permissions of the a file corresponding to a `File` object even if its path changes. @retep998, what's the best way to do this on Windows? I looked into `SetFileInformationByHandle` but couldn't find a way to do it atomically risking clobbering access time information. This is a first step towards fixing #37885. This function doesn't *have* to be public but this is useful functionality that should probably be exposed.
|
💔 Test failed - auto-win-msvc-64-opt-rustbuild |
On unix like systems, the underlying file corresponding to any given path may change at any time. This function makes it possible to set the permissions of the a file corresponding to a `File` object even if its path changes.
|
(should be fixed, sorry). |
|
@bors: r+ |
|
📌 Commit 1aaca5f has been approved by |
Add a method for setting permissions directly on an open file. On unix like systems, the underlying file corresponding to any given path may change at any time. This function makes it possible to set the permissions of the a file corresponding to a `File` object even if its path changes. @retep998, what's the best way to do this on Windows? I looked into `SetFileInformationByHandle` but couldn't find a way to do it atomically risking clobbering access time information. This is a first step towards fixing #37885. This function doesn't *have* to be public but this is useful functionality that should probably be exposed.
On unix like systems, the underlying file corresponding to any given path may change at any time. This function makes it possible to set the permissions of the a file corresponding to a
Fileobject even if its path changes.@retep998, what's the best way to do this on Windows? I looked into
SetFileInformationByHandlebut couldn't find a way to do it atomically risking clobbering access time information.This is a first step towards fixing #37885. This function doesn't have to be public but this is useful functionality that should probably be exposed.