Skip to content

Commit

Permalink
Check permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
benedikt-schesch committed May 7, 2024
1 parent 2eb54c3 commit 52778e7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/python/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,20 @@ def copy_repo(self) -> None:
ignore_dangling_symlinks=True,
)
os.system("chmod -R 777 " + str(self.local_repo_path))
# Check if chmod worked
# Retrieve the mode (permissions) of the file/directory
mode = os.stat(str(self.local_repo_path)).st_mode

# Mask out the permission bits with 0o777 (octal for 777)
if mode & 0o777 == 0o777:
logger.error(
f"The permissions for {str(self.local_repo_path)} are set to 777."
)
else:
logger.error(
f"The permissions for {str(self.local_repo_path)} are not set to 777."
+ f" Current permissions: {oct(mode & 0o777)}"
)
self.repo = Repo(self.local_repo_path)

def checkout(self, commit: str, use_cache: bool = True) -> Tuple[bool, str]:
Expand Down

0 comments on commit 52778e7

Please sign in to comment.