New submission from Denis Martinez <deuns.marti...@gmail.com>:

I have written a server backup script (file attached) which archives a
list of directories with tarfile and uploads the file to FTP. Today, the
script hanged, with an exception:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.6/threading.py", line 525, in __bootstrap_inner
    self.run()
  File "./backup.py", line 48, in run
    tar.add(file_or_directory, recursive=True)
  File "/usr/lib/python2.6/tarfile.py", line 1981, in add
    self.add(os.path.join(name, f), os.path.join(arcname, f), recursive,
exclude)
  File "/usr/lib/python2.6/tarfile.py", line 1965, in add
    tarinfo = self.gettarinfo(name, arcname)
  File "/usr/lib/python2.6/tarfile.py", line 1834, in gettarinfo
    statres = os.lstat(name)
OSError: [Errno 2] No such file or directory: '/srv/myfile.htdigest'

What I did here is that I removed the htdigest file while the tarfile
was archiving /srv. I haven't managed to reproduce the bug a second time.
It seems normal that tarfile shouldn't fail is this case; maybe it needs
some exception checking around the stat/lstat calls.

----------
components: Library (Lib)
files: backup2.py
messages: 93845
nosy: denis
severity: normal
status: open
title: tarfile: OSError with TarFile.add(..., recursive=True) about 
non-existing file
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file15098/backup2.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7101>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to