Repository navigation
Permission denied on config.lock when cloning in Docker under MacOS #1566
Description
Activity
- changed the title
[-]Permission denied on `config.lock` when clonning in Docker under MacOS[/-][+]Permission denied on `config.lock` when cloning in Docker under MacOS[/+]on Mar 25, 2023 I am not sure this issue is related to GitPython, as having it here implies GitPython should work in an environment where file permissions are not working as expected.
Thus I am closing the issue as it's not actionable.
However, maybe also thanks to the scripts to help reproduce it, one can experiment and see if the situation is common enough to try implement (and contribute) workarounds. Please feel free to keep commenting here and once the context changed the issue can be reopened.
I've got a simple example to reproduce the issue on MacOS
- Get Dockerfile
- Get Python script
- Build the container:
docker build -t clone-test .- Run the container:
docker run -v $PWD:/work clone-testTested under:
MacOS13.2.1 (22D68)
Docker version20.10.23, build 7155243I reduced the example to the simplest one, and it seems the issue is
os.openmethod. When built-in Python'sopenfunction is used, there is no issue with file permissions.
According to Python docs the built-inopenfunction is preferred (unless we need to do very low-level tasks, which is not the case here).Thanks for your help! From the description above it seems clear that
os.opencould be replaced withopenwithout side-effects to fix the issue right away.Could I interest in contributing this fix? Thanks for your consideration.
Yup, definitely! I will make a PR soon.
Definitely we can switch from
os.open()toopen()as the fix. But underlying root cause isVirtioFSin Docker Desktop, and we can switch togRPC Fuseas a temporary fix. Just posting it as it may help someone till PR is merged.@muthurajr @mmajchrzycki Just created a PR. Found that removing the "0" in the
os.opencall would also reach the same goal shortly after having opened the PR though, what do you think? Why is the 0 even there?fd = os.open(lock_file, flags, 0)Just realised that you are the maintainer @Byron - do you know what the rationale is behind setting
mode=0inos.open()? Shouldn't it bemode=0o700🤔I think a relevant part of the answer would be my reply in your PR.
Regarding
mode=0, I don't know and it probably doesn't matter as this 'lock-file' implementation is racy and won't actually protect concurrent access, from what I can tell now.- added a commit that references this issue
on Sep 1, 2023
Hi,
I found a bug related to the
FileLocksystem. What I'm doing:clone_from.docker run --rm --interactive -v $PWD:/work --user $(id -u):$(id -g) /bin/bashI'm getting this error:
The
config.lockfile as listed under Ubuntu:Also listed under MacOS:
I will provide a minimum set-up (docker file and python script) to reproduce it later.