You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
shutil.Error while installing hooks (alpine docker, musl) #655
We are moving to docker based CI and I'm trying to build a pre-commit testing container that is pre-populated with our hooks. Could you help me diagnose the cause of this failure? When the hooks try to install I get:
Initialized empty Git repository in /root/pre-commit/.git/
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.git.
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.git.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: Command: ('/root/.cache/pre-commit/repojfihsrn1/py_env-python3.5/bin/python3.5', '/root/.cache/pre-commit/repojfihsrn1/py_env-python3.5/bin/pip', 'install', '.')
Return code: 2
Expected return code: 0
Output:
Processing /root/.cache/pre-commit/repojfihsrn1
The error it is complaining about (errno 95) appears to be EOPNOTSUPP.
The files it is complaining about are all symlinks -- is it possible that you're on a platform which doesn't support symlinks -- is this perhaps docker-for-windows?
Also, it may be a cascading failure -- if you upgrade pre-commit/pre-commit-hooks to a newer version there's fewer symlinks (and no broken ones) -- that might magically fix the problem?
Ah! Nice find - I was thinking of switching this container to a different linux as a trial. Thanks for the help. Here are the relevant files if you want to poke some more
Outside of docker (ubuntu), I receive an error that the platform doesn't even support follow_symlinks:
$ python3.6 -c 'import os; os.chmod("baz", 0o777, follow_symlinks=False)'
NotImplementedError: chmod: follow_symlinks unavailable on this platform
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<string>", line 1, in <module>
SystemError: <built-in function chmod> returned a result with an error set
Going to close this as it's a problem with cpython on alpine itself. This is good documentation for googling of the error message -- hopefully my patch is accepted upstream :)
changed the title [-]Help diagnose failure of precommit install-hooks[/-][+]shutil.Error while installing hooks (alpine docker, musl) [/+]on Dec 13, 2018
Activity
asottile commentedon Nov 3, 2017
Hmm!
The error it is complaining about (errno 95) appears to be EOPNOTSUPP.
The files it is complaining about are all symlinks -- is it possible that you're on a platform which doesn't support symlinks -- is this perhaps docker-for-windows?
asottile commentedon Nov 3, 2017
Also, it may be a cascading failure -- if you upgrade
pre-commit/pre-commit-hooksto a newer version there's fewer symlinks (and no broken ones) -- that might magically fix the problem?(courtesy of this change)
FatherShawn commentedon Nov 3, 2017
docker-machine (boot2docker) on Mac doing a trial build of the Dockerfile. Also happens on Docker cloud builder.
The underlaying OS is Alpine linux. It is installing pre-commit from scratch.
asottile commentedon Nov 3, 2017
could you share a
Dockerfileperhaps so I can try and poke this?From googling the exception message I've found someone else with the same trace -- but it's also pre-commit so that isn't helping this situation 😆
asottile commentedon Nov 3, 2017
This also seems related: docker-library/python#155
FatherShawn commentedon Nov 3, 2017
Ah! Nice find - I was thinking of switching this container to a different linux as a trial. Thanks for the help. Here are the relevant files if you want to poke some more
pre-commit-issue-655.zip
I'll give it a go with a different Linux.
asottile commentedon Nov 3, 2017
Nice, I have it reproducing with this dockerfile:
And output:
asottile commentedon Nov 3, 2017
I've simplified it to a reproduction without pre-commit:
This writes a tiny
setup.pyinto a directory, makes a virtualenv in that directory, and tries to runpip install .The failure is similar to above:
asottile commentedon Nov 3, 2017
I've now reduced it to not need virtualenv:
Output:
asottile commentedon Nov 3, 2017
Seems to be rooted in the
chmodimplementation of python:Here's the difference in strace:
asottile commentedon Nov 3, 2017
Outside of docker (ubuntu), I receive an error that the platform doesn't even support follow_symlinks:
asottile commentedon Nov 3, 2017
This seems to be the difference in how they get configured:
vs ubuntu:
FatherShawn commentedon Nov 3, 2017
Wow! You are amazing!! I’ll recraft my container to use python 2.7. Thank you!!
asottile commentedon Nov 3, 2017
I've created a python bug for this: https://bugs.python.org/issue31940
I've also created an alpine bug for this: https://bugs.alpinelinux.org/issues/8103
asottile commentedon Nov 4, 2017
Here's a patch to cpython: python/cpython#4267
asottile commentedon Nov 6, 2017
Going to close this as it's a problem with cpython on alpine itself. This is good documentation for googling of the error message -- hopefully my patch is accepted upstream :)
FatherShawn commentedon Nov 6, 2017
Thank you for the help! In the meantime, I refactored my container to use debian.
hectorv commentedon Feb 20, 2018
I ran into this today on our Python 3 + Alpine projects. Unfortunately, the mandate from above is more Python 3 and more Alpine... 🗻
asottile commentedon Feb 20, 2018
@hectorv I've been trying to get the python devs to review my change without luck: python/cpython#4783
hectorv commentedon Feb 20, 2018
Thanks @asottile 🤞
And I agree with @FatherShawn: you're the 💥
hartwork commentedon Dec 13, 2018
Can this ticket be renamed to include Alpine and musl in the title?
[-]Help diagnose failure of precommit install-hooks[/-][+]shutil.Error while installing hooks (alpine docker, musl) [/+]asottile commentedon Dec 13, 2018
Done! Note that a fix was merged in 3.7.1 if you're able to upgrade