[New-bugs-announce] [issue41134] distutils.dir_util.copy_tree FileExistsError when updating symlinks

Tom Hale report at bugs.python.org
Fri Jun 26 23:26:02 EDT 2020


New submission from Tom Hale <tom at hale.ee>:

Here is a minimal test case:

==========================================================
#!/bin/bash

cd /tmp || exit 1

dir=test-copy_tree
src=$dir/src
dst=$dir/dst

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/dir_util.py", line 152, in copy_tree
    os.symlink(link_dest, dst_name)
FileExistsError: [Errno 17] File exists: 'file' -> 'test-copy_tree/dst/symlink'

==========================================================


Related:
=========

This issue will likely be resolved via:

bpo-36656 Add race-free os.link and os.symlink wrapper / helper

https://bugs.python.org/issue36656
(WIP under discussion at python-mentor)


Prior art:
===========
https://stackoverflow.com/questions/53090360/python-distutils-copy-tree-fails-to-update-if-there-are-symlinks

----------
messages: 372449
nosy: Tom Hale
priority: normal
severity: normal
status: open
title: distutils.dir_util.copy_tree FileExistsError when updating symlinks

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41134>
_______________________________________


More information about the New-bugs-announce mailing list