Bug 673

Summary: tar: including twice the same file/directory will end tar prematurely
Product: Busybox Reporter: Federico Pellegrin <fede>
Component: OtherAssignee: unassigned
Status: RESOLVED FIXED    
Severity: trivial CC: busybox-cvs
Priority: P5    
Version: 1.15.x   
Target Milestone: ---   
Hardware: Other   
OS: Linux   
Host: i386-linux-gnu Target: armel-crunch-linux-gnu
Build: BusyBox v1.15.2 (2009-10-09 09:42:34 CEST)
Attachments: Fix (against current git)

Description Federico Pellegrin 2009-10-19 06:30:45 UTC
If the same file is included in a tar archive (operation permitted in creation stage) then on extraction and error will occour and the operation will be aborted ignoring files that follows.

To reproduce:

/mnt # mkdir test1                                                              
/mnt # mkdir test2                                                              
/mnt # mkdir test3                                                              
/mnt # :> test1/file1                                                           
/mnt # :> test2/file2                                                           
/mnt # :> test3/file3                                                           
/mnt # tar cf comp.tar test1/ test2/ test1/ test3/                              
/mnt # mkdir decomp                                                             
/mnt # cd decomp/                                                               
/mnt/decomp # tar xf ../comp.tar                                                
tar: cannot remove old file test1: Is a directory                               
/mnt/decomp # ls                                                                
test1  test2                                                                    
/mnt/decomp # 

Tried and happens also on an old v1.00 ARM build.
Comment 1 Denys Vlasenko 2009-11-29 05:43:18 UTC
Created attachment 769 [details]
Fix (against current git)

Please try this fix, or try current git.
Comment 2 Federico Pellegrin 2009-11-30 09:15:48 UTC
Checked in current git and the bug seems fixed. Cannot reproduce the original report or simillar anymore.