Skip to content

Commit 082be90

Browse files
authored
Use 0o666 permissions for flock files instead of 0o777 (#16845)
This removes executable permissions while retaining global read / global write. It's been suggested we should use 0o644 instead, dropping the global write permissions (i.e., just the owner can write), but since we're taking an exclusive lock I don't think that would work and we'd regress the issue that was solved by updating the permissions. I think we'll need to revisit the locking scheme if that's the goal, but regardless, this seems like a net improvement.
1 parent fbf925e commit 082be90

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

crates/uv-fs/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ impl LockedFile {
825825
return Ok(file);
826826
}
827827

828-
// Otherwise, create a temporary file with 777 permissions. We must set
828+
// Otherwise, create a temporary file with 666 permissions. We must set
829829
// permissions _after_ creating the file, to override the `umask`.
830830
let file = if let Some(parent) = path.as_ref().parent() {
831831
NamedTempFile::new_in(parent)?
@@ -834,7 +834,7 @@ impl LockedFile {
834834
};
835835
if let Err(err) = file
836836
.as_file()
837-
.set_permissions(std::fs::Permissions::from_mode(0o777))
837+
.set_permissions(std::fs::Permissions::from_mode(0o666))
838838
{
839839
warn!("Failed to set permissions on temporary file: {err}");
840840
}

0 commit comments

Comments
 (0)