Bugs item #1583537, was opened at 2006-10-24 14:05
Message generated for change (Comment added) made by cdwave
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1583537&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
>Status: Deleted
>Resolution: Invalid
Priority: 5
Private: No
Submitted By: Mike Looijmans (cdwave)
Assigned to: Nobody/Anonymous (nobody)
Summary: tarfile incorrectly handles long filenames

Initial Comment:
tarfile seems to incorrectly handle filenames longer
than 100 characters. This is tarfile as provided with
2.4.3 and 2.4.4. The 0.8.0 version of tarfile is even
worse - it will cut off the last character of any
filename that is exactly 100 in size.

Below the unit test that I use to reproduce the problem:

class Test00tarfile(unittest.TestCase):
    def runtest(self, longName):
        import tarfile
        dst=StringIO()
        src=StringIO("Hello world!")
        srclen = len("Hello world!")
        tar = tarfile.open(mode='w|', fileobj=dst)
        tar.add('test.py')
        info = tar.gettarinfo('test.py', longName)
        info.size = srclen
        tar.addfile(info, src)
        src.seek(0)
        tar.addfile(info, src)
        tar.close()
        dst.seek(0)
        tar = tarfile.open(mode='r|', fileobj=dst)
        info = tar.next()
        self.assertEqual(info.name, 'test.py')
        info = tar.next()
        self.assertEqual(info.size, srclen)
        self.assertEqual(info.name, longName)
        info = tar.next()
        self.assertEqual(info.name, longName)
        info = tar.next()
        self.assertEqual(None, info)
    def testLongFileName200(self):
        "tarfile with 200+ length filename"
        self.runtest("LongName/" + 200 * "x" + "/LongTail")
    def testLongFileName100(self):
        "tarfile with 100 length filename"
       
self.runtest('MyWiki/underlay/pages/(e7ae80e4bd93e4b8ade69687)MoinMoin(2fe5ae89e8a385e6898be5868c)/cache/text_html')


The "200" test fails on the standard version, on
tarfile 0.8.0 the 100 test fails too.

----------------------------------------------------------------------

>Comment By: Mike Looijmans (cdwave)
Date: 2006-10-24 15:33

Message:
Logged In: YES 
user_id=1372511

Test was wrong, and there were distinct bugs in various
versions.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1583537&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to