Message134555
It happens on RedHat and CentOS 5, but I suspect it would happen on any Unix variant. Here's a test that exacerbates the issue:
#
# test_tarfile.py
#
# Description:
# tests for python tarfile module
#
# $Id$
#
import os
import shutil
import tarfile
import tempfile
def test_tar_overwrites_symlink():
d = tempfile.mkdtemp()
try:
new_dir_name = os.path.join(d, 'newdir')
archive_name = os.path.join(d, 'newdir.tar')
os.mkdir(new_dir_name)
source_file_name = os.path.join(new_dir_name, 'source')
target_link_name = os.path.join(new_dir_name, 'symlink')
with open(source_file_name, 'w') as f:
f.write('something\n')
os.symlink(source_file_name, target_link_name)
with tarfile.open(archive_name, 'w') as tar:
for f in [source_file_name, target_link_name]:
tar.add(f, arcname=os.path.basename(f))
# this should not raise OSError: [Errno 17] File exists
with tarfile.open(archive_name, 'r') as tar:
tar.extractall(path=new_dir_name)
finally:
shutil.rmtree(d) |
|
Date |
User |
Action |
Args |
2011-04-27 12:24:42 | Scott.Leerssen | set | recipients:
+ Scott.Leerssen, lars.gustaebel, orsenthil, srid, santoso.wijaya |
2011-04-27 12:24:42 | Scott.Leerssen | set | messageid: <1303907082.34.0.851657990451.issue10761@psf.upfronthosting.co.za> |
2011-04-27 12:24:41 | Scott.Leerssen | link | issue10761 messages |
2011-04-27 12:24:41 | Scott.Leerssen | create | |
|