Title: Tar file symbolic link bug fix
Type: Stage:
Components: Extension Modules Versions: Python 2.3
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ellers88, lars.gustaebel, loewis
Priority: normal Keywords: patch

Created on 2005-03-20 20:14 by ellers88, last changed 2005-08-27 10:10 by loewis. This issue is now closed.

File name Uploaded Description Edit
tarfile.patch ellers88, 2005-03-20 20:14 Patch file
Messages (5)
msg48018 - (view) Author: Ellers (ellers88) Date: 2005-03-20 20:14
OS: linux

If you use 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/
	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:

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: )
msg48019 - (view) Author: Lars Gustäbel (lars.gustaebel) * (Python committer) Date: 2005-03-22 19:21
Logged In: YES 

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.
msg48020 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2005-03-22 19:47
Logged In: YES 

Following gustaebel's recommendation, I reject this patch, and will accept 
1168594 instead.
msg48021 - (view) Author: Ellers (ellers88) Date: 2005-03-22 21:10
Logged In: YES 

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  :)
msg48022 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2005-08-27 10:10
Logged In: YES 

I have now committed #1168594, both for 2.4 and 2.5.
Date User Action Args
2005-03-20 20:14:59ellers88create