Investigating GitPython git.util.rmtree
permissions bug
$ ./perm.sh
Permissions BEFORE rmtree call:
-r--r--r-- 1 ek ek 0 Oct 30 05:13 dir1/file
Traceback (most recent call last):
File "/usr/lib/python3.12/shutil.py", line 695, in _rmtree_safe_fd
os.unlink(entry.name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: 'symlink'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/ek/repos-wsl/GitPython/git/util.py", line 212, in rmtree
shutil.rmtree(path, onexc=handler)
File "/usr/lib/python3.12/shutil.py", line 769, in rmtree
_rmtree_safe_fd(fd, path, onexc)
File "/usr/lib/python3.12/shutil.py", line 697, in _rmtree_safe_fd
onexc(os.unlink, fullname, err)
File "/home/ek/repos-wsl/GitPython/git/util.py", line 203, in handler
function(path)
PermissionError: [Errno 13] Permission denied: 'dir2/symlink'
Permissions AFTER rmtree call:
--w------- 1 ek ek 0 Oct 30 05:13 dir1/file
License for this gist (including perm.sh
): CC0-1.0 (public domain) [SPDX]