Skip to content

Address issue #7280 with a WARNING rather than exception #7544

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

Closed
wants to merge 9 commits into from

Conversation

danizen
Copy link

@danizen danizen commented Jan 2, 2020

Fix includes following work:

  • New tests capability in tests/lib/filesystem.py which opens a file in an external sub-process and holds it open. This is designed to be usable as either a context opener or a fixture, if so wired, and the open of the file is deferred in order to create just such race conditions as [WinError 5] Access is denied during cleanup/rmtree #7280
  • This test class has tests in tests/unit/test_utils_fileystem.py
  • pip/_internal/temp_dir.py is patched to convert an EACCES exception on Windows to a warning, and raise in other cases.
  • tests/unit/tests_utils_temp_dir.py is updated to test this functionality.

Dan Davis added 5 commits December 30, 2019 18:21
- Try to delete the temporary directory, as most of the time this works
- If it fails on windows due to an Access error, it clearly is not an
  Access error because we just created the directory.
  Warn the user and continue.
- Add issue description file
- Provide a class that manages a sub-process which can open a file and
  monkey with pip's abiliity to remove a file on windows.
- This class can function as both a context manager and/or a pytest fixture.
- TempDirectory() tries to delete the directory as normal
- if cleanup fails on Windows due to EACCES, warn about virus scanner
- This is a more specific error than previous error, but does not change
  the behavior when a user is attempting to pip uninstall in a system directory
- This changes the messaging, but risks leaving the directory behind.
- Leaving the directory behind, however, is what is already happening
- The fix for pypa#7479 gives the Virus scanner more time to finish its work,
  but there is still a possibility for a race condition that leaves the
  impression that there is an error in pip itself.
@danizen
Copy link
Author

danizen commented Jan 2, 2020

Note - I have installed Python2.7 (again, though I was done with that), and I'm trying to reproduce this locally in my environment.

@danizen
Copy link
Author

danizen commented Jan 2, 2020

I think the appveyor test is stuck. Will retry in a new pull-request.

@danizen danizen closed this Jan 2, 2020
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Feb 1, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Feb 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant