Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

util: also run chmod on EPERM #1725

Merged
merged 2 commits into from Dec 6, 2020
Merged

util: also run chmod on EPERM #1725

merged 2 commits into from Dec 6, 2020

Conversation

@fsouza
Copy link
Contributor

@fsouza fsouza commented Dec 6, 2020

Writing a test for this one is tricky, because I was seeing the issue
only when the directory being removed is a docker volume, so instead of
getting EACCES we get EPERM.

This is easy to reproduce though. The existing test fails when the
directory being used for the files is a docker volume:

% docker run \
	-v $(mktemp -d):/tmp \
	-v ${PWD}:/src \
	-w /src \
	python:3 \
	bash -c 'pip install -e . && pip install -r requirements-dev.txt && python -m pytest tests/util_test.py'
Writing a test for this one is tricky, because I was seeing the issue
only when the directory being removed is a docker volume, so instead of
getting EACCES we get EPERM.

This is easy to reproduce though. The existing test fails when the
directory being used for the files is a docker volume:

```
% docker run \
	-v $(mktemp -d):/tmp \
	-v ${PWD}:/src \
	-w /src \
	python:3 \
	bash -c 'pip install -e . && pip install -r requirements-dev.txt && python -m pytest tests/util_test.py'
```
@fsouza fsouza force-pushed the fsouza:fix-rmtree branch from b5c9a96 to bb0d957 Dec 6, 2020
@fsouza
Copy link
Contributor Author

@fsouza fsouza commented Dec 6, 2020

@asottile what do you think? I can add a test with a mock, or not add a test. Or do you have any other ideas? x)

pre_commit/util.py Outdated Show resolved Hide resolved
Co-authored-by: Paul Fischer <70564747+paulhfischer@users.noreply.github.com>
Copy link
Member

@asottile asottile left a comment

@asottile asottile merged commit cf604f6 into pre-commit:master Dec 6, 2020
2 checks passed
2 checks passed
pre-commit.ci - pr checks completed successfully
Details
pre-commit.pre-commit #20201206.3 succeeded
Details
@fsouza fsouza deleted the fsouza:fix-rmtree branch Dec 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants