[BusyBox 0001509]: tar does not remove leading / from hard link target

bugs at busybox.net bugs at busybox.net
Wed Feb 13 16:34:04 UTC 2008


The following issue has been CLOSED 
====================================================================== 
http://busybox.net/bugs/view.php?id=1509 
====================================================================== 
Reported By:                Dwight Engen
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   1509
Category:                   Other
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     closed
Resolution:                 open
Fixed in Version:           
====================================================================== 
Date Submitted:             09-24-2007 06:54 PDT
Last Modified:              02-13-2008 08:34 PST
====================================================================== 
Summary:                    tar does not remove leading / from hard link target
Description: 
Since busybox tar does not strip the leading slash when saving a hard link,
attempting to restore a tar with hard links in it on a mounted volume
results in EXDEV from link(2). A patch is provided which fixes the
problem.
====================================================================== 

---------------------------------------------------------------------- 
 vda - 09-24-07 11:44  
---------------------------------------------------------------------- 
In an empty directory with busybox's executable only:

$ ln busybox busybox_z
$ ./busybox tar cf ../z.tar *
$ mkdir z; cd z
$ ../busybox tar xf ../../z.tar
$ ls -li
total 1528
7340110 -rwxr-xr-x 2 vda eng 775788 Sep 24 19:28 busybox
7340110 -rwxr-xr-x 2 vda eng 775788 Sep 24 19:28 busybox_z

Please provide a testcase where it fails. 

---------------------------------------------------------------------- 
 vda - 09-24-07 12:06  
---------------------------------------------------------------------- 
I managed to reproduce this.

Please test attached patch. 

---------------------------------------------------------------------- 
 Dwight Engen - 09-24-07 14:16  
---------------------------------------------------------------------- 
Sorry I wasn't clear about the test case: you must attempt to tar giving
/something as the files to tar up. For example:

$ mkdir /foo
$ cd /foo
$ touch bar
$ ln bar baz
$ tar cf /tmp/test.tar /foo

hexdump'ing /tmp/test.tar would show foo/baz's link target to be
/foo/bar.

I tested your patch and it works fine, I hadn't noticed that slash
skipping loop in writeFileToTarball, much cleaner place to fix. I think
the first part of the third hunk is just whitespace? Thanks for the fix. 

---------------------------------------------------------------------- 
 vda - 02-13-08 08:34  
---------------------------------------------------------------------- 
Fixed sometime ago. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
09-24-07 06:54  Dwight Engen   New Issue                                    
09-24-07 06:54  Dwight Engen   Status                   new => assigned     
09-24-07 06:54  Dwight Engen   Assigned To               => BusyBox         
09-24-07 06:54  Dwight Engen   File Added: tar.patch                        
09-24-07 11:44  vda            Note Added: 0002792                          
09-24-07 12:06  vda            File Added: 6.patch                          
09-24-07 12:06  vda            Note Added: 0002793                          
09-24-07 14:16  Dwight Engen   Note Added: 0002794                          
02-13-08 08:34  vda            Status                   assigned => closed  
02-13-08 08:34  vda            Note Added: 0004434                          
======================================================================




More information about the busybox-cvs mailing list