Issue 30511: shutil.make_archive should not need to chdir (alternatively: make shutil.make_archive thread-safe) (original) (raw)

Created on 2017-05-30 13:46 by Alex Gaynor, last changed 2022-04-11 14:58 by admin.

Pull Requests
URL Status Linked Edit
PR 26933 merged andrei.avk,2021-06-28 13:13
PR 27274 merged miss-islington,2021-07-21 08:33
PR 27275 merged miss-islington,2021-07-21 08:33
PR 27276 merged miss-islington,2021-07-21 08:33
PR 28271 FFY00,2021-09-17 13:26
Messages (10)
msg294756 - (view) Author: Alex Gaynor (Alex Gaynor) Date: 2017-05-30 13:46
Currently shutil.make_archive uses os.chdir, however there's no need for that. Everything that's done could be equally accomplished with path manipulation: https://github.com/python/cpython/blob/master/Lib/shutil.py#L773-L779 We should switch to using path manipulation in order to make shutil.make_archive thread safe. (Flag: This is probably a good bug for someone with Python skills interested in contributing to CPython!)
msg294758 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-05-30 14:13
Unfortunately this is not possible. The signature of functions registered with register_archive_format() doesn't support this.
msg294759 - (view) Author: Alex Gaynor (Alex Gaynor) Date: 2017-05-30 14:13
None of those functions are a public API, so changing them shouldn't be a problem IMO.
msg294760 - (view) Author: Alex Gaynor (Alex Gaynor) Date: 2017-05-30 14:14
Ugh, except via |register_archive_format . register_archive_format
msg297902 - (view) Author: Joey Harrington (Joey Harrington) Date: 2017-07-07 18:55
It would be nice if there was at least a warning in the docs that make_archive is not thread-safe, and that if you have two threads creating archives that it's extremely likely you'll get erroneous results since the race condition lasts for the entire duration of the archive creation.
msg389849 - (view) Author: Michael Osipov (michael-o) * Date: 2021-03-30 20:09
Just wasted two hours for this. Can someone really update the documentation of it if this is not going to change.
msg396633 - (view) Author: Andrei Kulakov (andrei.avk) * (Python triager) Date: 2021-06-28 13:14
PR is added here: https://github.com/python/cpython/pull/26933
msg397928 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-07-21 08:33
New changeset 64f54b7ccd49764b0304e076bfd79b5482988f53 by andrei kulakov in branch 'main': bpo-30511: Add note on thread safety to shutil.make_archive() (#26933) https://github.com/python/cpython/commit/64f54b7ccd49764b0304e076bfd79b5482988f53
msg397932 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-07-21 08:55
New changeset d17449f31d4af7a735e81b587bb329481764412f by Miss Islington (bot) in branch '3.10': bpo-30511: Add note on thread safety to shutil.make_archive() (GH-26933) (GH-27274) https://github.com/python/cpython/commit/d17449f31d4af7a735e81b587bb329481764412f
msg397934 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-07-21 09:04
New changeset c8e35abfe304eb052a5220974006072c37d4b06a by Miss Islington (bot) in branch '3.9': bpo-30511: Add note on thread safety to shutil.make_archive() (GH-26933) (GH-27275) https://github.com/python/cpython/commit/c8e35abfe304eb052a5220974006072c37d4b06a
msg397935 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-07-21 09:04
New changeset 54d387105a5f0c3825a0f4fa607b58d55d05e572 by Miss Islington (bot) in branch '3.8': bpo-30511: Add note on thread safety to shutil.make_archive() (GH-26933) (#27276) https://github.com/python/cpython/commit/54d387105a5f0c3825a0f4fa607b58d55d05e572
History
Date User Action Args
2022-04-11 14:58:47 admin set github: 74696
2021-09-17 13:26:13 FFY00 set nosy: + FFY00pull_requests: + <pull%5Frequest26830>
2021-07-21 09:04:56 lukasz.langa set messages: +
2021-07-21 09:04:55 lukasz.langa set messages: +
2021-07-21 08:55:47 lukasz.langa set messages: +
2021-07-21 08:33:47 miss-islington set pull_requests: + <pull%5Frequest25821>
2021-07-21 08:33:41 miss-islington set pull_requests: + <pull%5Frequest25820>
2021-07-21 08:33:36 miss-islington set nosy: + miss-islingtonpull_requests: + <pull%5Frequest25819>
2021-07-21 08:33:15 lukasz.langa set nosy: + lukasz.langamessages: +
2021-06-28 13:14:35 andrei.avk set messages: +
2021-06-28 13:13:36 andrei.avk set keywords: + patchnosy: + andrei.avkpull_requests: + <pull%5Frequest25502>stage: patch review
2021-03-30 20:09:12 michael-o set nosy: + michael-omessages: +
2017-07-07 18:55:53 Joey Harrington set nosy: + Joey Harringtonmessages: +
2017-05-30 14:14:46 Alex Gaynor set messages: +
2017-05-30 14:13:47 Alex Gaynor set messages: +
2017-05-30 14:13:05 serhiy.storchaka set nosy: + serhiy.storchakamessages: +
2017-05-30 13:46:18 Alex Gaynor create