classification
Title: shutil.rmtree(..., ignore_errors=True) doesn't ignore errors from os.close()
Type: behavior Stage: patch review
Components: Library (Lib) Versions: Python 3.8, Python 3.7, Python 3.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: David.Edelsohn, ZackerySpytz, rabraham, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2018-11-27 19:51 by rabraham, last changed 2020-12-15 08:20 by serhiy.storchaka.

Pull Requests
URL Status Linked Edit
PR 23766 open ZackerySpytz, 2020-12-14 16:33
Messages (3)
msg330553 - (view) Author: Ronal Abraham (rabraham) Date: 2018-11-27 19:51
These lines throw intermittently for me on AIX when removing a directory on NFS (python version 3.6.6-1), even when "ignore_errors=True":

https://github.com/python/cpython/blob/v3.6.6rc1/Lib/shutil.py#L433
https://github.com/python/cpython/blob/v3.6.6rc1/Lib/shutil.py#L492

Should there be try-except blocks around these lines and calls to onerror(...)?
msg330856 - (view) Author: Ronal Abraham (rabraham) Date: 2018-12-01 17:22
I forgot to mention: the exception raised is an OSError and the errno is 52 (ESTALE on AIX).
msg383038 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-12-15 08:20
I am wondering whether we should silence that error in os.close() unconditionally.

In what circumstances the error is raised? Can it be reproduced on Linux (by monkey-patching os.rmdir)? What can happen in worst case when the error is ignored?
History
Date User Action Args
2020-12-15 08:20:47serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg383038
2020-12-14 16:33:44ZackerySpytzsetkeywords: + patch
nosy: + ZackerySpytz

pull_requests: + pull_request22622
stage: patch review
2018-12-01 17:22:44rabrahamsetmessages: + msg330856
2018-11-28 16:18:48SilentGhostsetnosy: + David.Edelsohn
2018-11-27 19:51:53rabrahamcreate