-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check for common permissions issues with scratch area (#765)
Fixes #747
- Loading branch information
1 parent
21a6cf5
commit 82b208f
Showing
10 changed files
with
265 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import stat | ||
from pathlib import Path | ||
|
||
|
||
def is_sgid_set(path: Path) -> bool: | ||
"""Check if the SGID bit is set so that new files created | ||
under a directory owned by a group are owned by that same group. | ||
See https://www.redhat.com/en/blog/suid-sgid-sticky-bit | ||
Args: | ||
path: Path to the file to check | ||
Returns: | ||
bool: True if the SGID bit is set | ||
""" | ||
|
||
mask = path.stat().st_mode | ||
return bool(mask & stat.S_ISGID) | ||
|
||
|
||
def get_owner_gid(path: Path) -> int: | ||
"""Get the GID of the owner of a file | ||
Args: | ||
path: Path to the file to check | ||
Returns: | ||
bool: The GID of the file owner | ||
""" | ||
|
||
return path.stat().st_gid |
Oops, something went wrong.