Skip to content

Commit 1a002fc

Browse files
GuillaumeGomezgitbot
authored and
gitbot
committed
Rollup merge of rust-lang#129409 - grinapo:patch-1, r=Amanieu
Expand std::os::unix::fs::chown() doc with a warning Include warning about losing setuid/gid when chowning, per POSIX. It is about the underlying system call but it is rather useful to mention it in the help in case someone accidentally forgets (don't look at me :)).
2 parents 7856647 + 2338e6d commit 1a002fc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

std/src/os/unix/fs.rs

+5
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,11 @@ impl DirBuilderExt for fs::DirBuilder {
987987
/// Changing the group typically requires either being the owner and a member of the group, or
988988
/// having privileges.
989989
///
990+
/// Be aware that changing owner clears the `suid` and `sgid` permission bits in most cases
991+
/// according to POSIX, usually even if the user is root. The sgid is not cleared when
992+
/// the file is non-group-executable. See: <https://www.man7.org/linux/man-pages/man2/chown.2.html>
993+
/// This call may also clear file capabilities, if there was any.
994+
///
990995
/// If called on a symbolic link, this will change the owner and group of the link target. To
991996
/// change the owner and group of the link itself, see [`lchown`].
992997
///

0 commit comments

Comments
 (0)