[Patches] [ python-Patches-1167128 ] Tar file symbolic link bug fix

SourceForge.net noreply at sourceforge.net
Sat Aug 27 12:10:27 CEST 2005


Patches item #1167128, was opened at 2005-03-20 21:14
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1167128&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: Modules
Group: Python 2.3
Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Ellers (ellers88)
Assigned to: Nobody/Anonymous (nobody)
Summary: Tar file symbolic link bug fix

Initial Comment:
OS: linux

If you use tarfile.py to create a tarfile with a
symbolic link followed by a regular file, then use gnu
tar to list the contents you will see:

tar tvf archives/test1.my.tar
	lrwxrwxrwx andrew/dev        3 2005-03-20 16:00:35
barlink -> bar
	tar: Skipping to next header
	tar: Error exit delayed from previous errors

I have traced the problem down to the size field in the
tar header being set to the length of the link target
name, not zero as it should be.

I have put an extended description and proof of this at:

http://software.ellerton.net/supertar/README.txt
http://software.ellerton.net/supertar/PythonTarPatchProof.tar

The patch file attached fixes this by setting size == 0
if filetype == SYMLINK, and verified this works
perfectly on linux.

CAUTION: I don't know, though I can fairly safely
assume, that this will work also on other unix's.

(Shameless plug: this is where the supertar utility
is/will be: http://software.ellerton.net/supertar/ )


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

>Comment By: Martin v. Löwis (loewis)
Date: 2005-08-27 12:10

Message:
Logged In: YES 
user_id=21627

I have now committed #1168594, both for 2.4 and 2.5.

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

Comment By: Ellers (ellers88)
Date: 2005-03-22 22:10

Message:
Logged In: YES 
user_id=1046139

I don't mind which patch is accepted, so long as all uses
where a symlink is added results in the correct result, i.e.
size==0  :)

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

Comment By: Martin v. Löwis (loewis)
Date: 2005-03-22 20:47

Message:
Logged In: YES 
user_id=21627

Following gustaebel's recommendation, I reject this patch, and will accept 
1168594 instead.

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

Comment By: Lars Gustäbel (gustaebel)
Date: 2005-03-22 20:21

Message:
Logged In: YES 
user_id=642936

The size for a non-regular file is already set to zero but
at the wrong place. It is currently done in the add() method
and not in gettarinfo() as it should be. Since you use the
addfile() and gettarinfo() methods in your test script, you
get unwanted results.

I submitted patch #1168594 that fixes the whole problem in a
more generic way and is closely related to the fix for bug
#1031148 from last year.

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1167128&group_id=5470


More information about the Patches mailing list