Title: distutils.dir_util.copy_tree FileExistsError when updating symlinks
Type: behavior Stage: patch review
Components: Distutils Versions: Python 3.10
Status: open Resolution:
Dependencies: 36656 Superseder:
Assigned To: Nosy List: Tom Hale, dstufft, eric.araujo
Priority: normal Keywords: patch

Created on 2020-06-27 03:26 by Tom Hale, last changed 2020-09-19 19:02 by iritkatriel.

Pull Requests
URL Status Linked Edit
PR 14464 open Tom Hale, 2020-07-17 05:28
Messages (1)
msg372449 - (view) Author: Tom Hale (Tom Hale) * Date: 2020-06-27 03:26
Here is a minimal test case:


cd /tmp || exit 1


mkdir -p "$src"
touch "$src"/file
ln -s file "$src/symlink"

python -c "from distutils.dir_util import copy_tree;
copy_tree('$src', '$dst', preserve_symlinks=1, update=1);
copy_tree('$src', '$dst', preserve_symlinks=1, update=1);"

rm -r "$dir"


Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "/usr/lib/python3.8/distutils/", line 152, in copy_tree
    os.symlink(link_dest, dst_name)
FileExistsError: [Errno 17] File exists: 'file' -> 'test-copy_tree/dst/symlink'



This issue will likely be resolved via:

bpo-36656 Add race-free and os.symlink wrapper / helper
(WIP under discussion at python-mentor)

Prior art:
Date User Action Args
2020-09-19 19:02:34iritkatrielsetnosy: + eric.araujo, dstufft
type: behavior
components: + Distutils
2020-07-29 12:50:05terry.reedysetdependencies: + Add race-free and os.symlink wrapper / helper
versions: + Python 3.10
2020-07-17 05:28:01Tom Halesetkeywords: + patch
stage: patch review
pull_requests: + pull_request20651
2020-06-27 03:26:02Tom Halecreate