This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: shutil.rmtree calls onerror with different function than failed
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: hynek, miss-islington, nijel, serhiy.storchaka, tarek
Priority: normal Keywords: patch

Created on 2020-10-12 12:54 by nijel, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 22585 merged nijel, 2020-10-12 12:54
PR 23228 merged miss-islington, 2020-11-10 16:06
PR 23229 merged miss-islington, 2020-11-10 16:06
Messages (5)
msg378495 - (view) Author: Michal Čihař (nijel) * Date: 2020-10-12 12:54
The onerror callback is called with os.lstat when the actual failing function is os.open.

To reproduce create directory that can not be listed:

import os
import shutil

def onerror(func, path, exc_info):
    print(func)

os.mkdir("test")
os.chmod("test", 0)
shutil.rmtree("test", onerror=onerror)
msg378610 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-10-14 09:16
Added Hynek, the original committer of this code.
msg380683 - (view) Author: miss-islington (miss-islington) Date: 2020-11-10 16:06
New changeset e59b2deffde61e5641cabd65034fa11b4db898ba by Michal Čihař in branch 'master':
bpo-42014: shutil.rmtree: call onerror with correct function (GH-22585)
https://github.com/python/cpython/commit/e59b2deffde61e5641cabd65034fa11b4db898ba
msg380686 - (view) Author: miss-islington (miss-islington) Date: 2020-11-10 16:27
New changeset c745b36ee3786fabc9231a43c085218df27dcd47 by Miss Islington (bot) in branch '3.8':
bpo-42014: shutil.rmtree: call onerror with correct function (GH-22585)
https://github.com/python/cpython/commit/c745b36ee3786fabc9231a43c085218df27dcd47
msg380687 - (view) Author: miss-islington (miss-islington) Date: 2020-11-10 16:29
New changeset 14a343a9af27725faeab8b330a6d66ff573704d3 by Miss Islington (bot) in branch '3.9':
bpo-42014: shutil.rmtree: call onerror with correct function (GH-22585)
https://github.com/python/cpython/commit/14a343a9af27725faeab8b330a6d66ff573704d3
History
Date User Action Args
2022-04-11 14:59:36adminsetgithub: 86180
2020-11-11 14:15:03hyneksetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-11-10 16:29:44miss-islingtonsetmessages: + msg380687
2020-11-10 16:27:11miss-islingtonsetmessages: + msg380686
2020-11-10 16:11:06giampaolo.rodolasetnosy: - giampaolo.rodola
2020-11-10 16:06:25miss-islingtonsetpull_requests: + pull_request22125
2020-11-10 16:06:18miss-islingtonsetkeywords: + patch
stage: patch review
pull_requests: + pull_request22124
2020-11-10 16:06:10miss-islingtonsetnosy: + miss-islington
messages: + msg380683
2020-10-14 09:16:03serhiy.storchakasetnosy: + hynek, serhiy.storchaka, tarek, giampaolo.rodola

messages: + msg378610
versions: - Python 3.5, Python 3.6, Python 3.7
2020-10-12 12:54:15nijelcreate