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
Copy link
Contributor Author

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asottile asottile merged commit cf604f6 into pre-commit:master Dec 6, 2020
@fsouza fsouza deleted the fix-rmtree branch December 6, 2020 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants