[issue6547] shutil.copytree fails on dangling symlinks

2010-04-19 Thread Timothee Besset

Timothee Besset  added the comment:

It's a symlink that points to a file that doesn't exist. There are many ways 
this can happen, in this particular case my text editor (emacs) seems to keep 
some metadata about which user, machine and process is editing a file. I tried 
to reproduce in 2.6 (Debian sid amd64) and I can confirm it still happens:

t...@ttimozilla:~$ mkdir test
t...@ttimozilla:~$ cd test
t...@ttimozilla:~/test$ ln -s foo bar
t...@ttimozilla:~/test$ ls -1l bar
lrwxrwxrwx 1 timo timo 3 Apr 19 17:12 bar -> foo
t...@ttimozilla:~/test$ ls -1l foo
ls: cannot access foo: No such file or directory
t...@ttimozilla:~/test$ python2.6
Python 2.6.5 (r265:79063, Mar 20 2010, 03:56:44) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import shutil
>>> shutil.copytree( '../test', '../test2' )
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.6/shutil.py", line 177, in copytree
raise Error, errors
shutil.Error: [('../test/bar', '../test2/bar', "[Errno 2] No such file or 
directory: '../test/bar'")]
>>>

--

___
Python tracker 
<http://bugs.python.org/issue6547>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6547] shutil.copytree fails on dangling symlinks

2010-04-19 Thread Timothee Besset

Timothee Besset  added the comment:

I am not sure what shutil does with symlinks already. At the very least it 
should not abort the operation.

Ideally I feel it should create the same symlink pointing to a possibly missing 
file, since that's what '/bin/cp' does, and shutil.copytree is broadly 
understood as a drop in replacement..

--

___
Python tracker 
<http://bugs.python.org/issue6547>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6547] shutil.copytree fails on dangling symlinks

2010-04-20 Thread Timothee Besset

Timothee Besset  added the comment:

Good stuff. Didn't occur to me that the operation could have successfully 
completed before raising the exception

--

___
Python tracker 
<http://bugs.python.org/issue6547>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6547] shutil.copytree fails on dangling symlinks

2010-04-20 Thread Timothee Besset

Timothee Besset  added the comment:

My pleasure! We do use a lot of python.

--

___
Python tracker 
<http://bugs.python.org/issue6547>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6547] shutil.copytree fails on dangling symlinks

2009-07-22 Thread Timothee Besset

New submission from Timothee Besset :

shutil.copytree fails if there is a dangling symlink and symlink is set
to False (which is the default). It will raise an exception when trying
to get to the content of the symlink.

Tested on Debian Etch amd64, python 2.5.2

  File "/usr/lib/python2.5/shutil.py", line 138, in copytree
raise Error, errors
shutil.Error: [('/opt/daemons/gameslave/.#fabfile.py',
'/tmp/tmphxInsp/gameslave/.#fabfile.py', "[Errno 2] No such file or
directory: '/opt/daemons/gameslave/.#fabfile.py'")]

$ ls -1l /opt/daemons/gameslave/.#fabfile.py
lrwxrwxrwx 1 timo quakelive 20 Jul 22 14:32
/opt/daemons/gameslave/.#fabfile.py -> t...@localhost.12341

(the link is created by emacs - means file being edited I'm guessing)

--
components: Library (Lib)
messages: 90821
nosy: TTimo
severity: normal
status: open
title: shutil.copytree fails on dangling symlinks
type: behavior
versions: Python 2.5

___
Python tracker 
<http://bugs.python.org/issue6547>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com