Skip to content

Commit

Permalink
Add comment explaining the bitwise operations in the context of Unix …
Browse files Browse the repository at this point in the history
…permissions
  • Loading branch information
JustinVanHeek committed Nov 8, 2024
1 parent 976c1ad commit 13f2e81
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/pip/_internal/network/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ def _write(self, path: str, data: bytes) -> None:
with adjacent_tmp_file(path) as f:
f.write(data)

# `& 0o666` selects the read/write permissions of the directory.
# `| 0o600` sets owner read/write permissions.
os.chmod(f.name, os.stat(self.directory).st_mode & 0o666 | 0o600)
replace(f.name, path)

Expand Down

0 comments on commit 13f2e81

Please sign in to comment.