Bug 54182 - Soft links with relative paths not restored correctly
Soft links with relative paths not restored correctly
Status: CLOSED WORKSFORME
Product: Red Hat Linux
Classification: Retired
Component: tar (Show other bugs)
7.1
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Peter Vrabec
Ben Levenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-09-30 20:27 EDT by Scott Gordon
Modified: 2007-04-18 12:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-12-20 07:53:26 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Sample commands and output to illustrate the bug. (5.16 KB, text/plain)
2001-09-30 20:29 EDT, Scott Gordon
no flags Details

  None (edit)
Description Scott Gordon 2001-09-30 20:27:33 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.4.2-2 i686)

Description of problem:
`tar' as supplied with RedHat 7.1 (i386) sometimes does not restore
soft links correctly when using `tar xf', at least when restoring files to
a different directory to their original locations. Links with absolute
paths appear to be restored correctly, but frequently every link or most
links with a relative path (ie. no leading slash) are replaced with an
zero-length normal file with all permission bits reset.

On other (possibly most) occasions, however, it works correctly. I have not
found any pattern controlling when it works and when it does
not.


Version-Release number of selected component (if applicable):


How reproducible:
Sometimes

Steps to Reproduce:
1. Create a tar file using `tar cvf', containing both absolute and
   relative soft links.
2. Restore to a different location using `tar xvf'
3. Examine the links produced (`ls -l' etc)


Actual Results:  See the output below : all soft links were corrupted.
Note: the tar file is a 2GB backup of someone else's computer (running
Mandrake 8.0) which I was attempting to restore to their hard disk
after accidental deletion of files. The disk was not mounted as `/' at the
time (hence a different location). The tar file appears correct, and on one
attempt the same file apparently produced the correct results when un-tar
ing at a different location.

gecko:/tmp # uname -a
Linux gecko.physics.uq.edu.au 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686
unknown
gecko:/tmp # tar --version
tar (GNU tar) 1.13.19
Copyright 2001 Free Software Foundation, Inc.
This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute it under the terms of the GNU General Public License;
see the file named COPYING for details.
Written by John Gilmore and Jay Fenlason.
gecko:/tmp # tar tvf all.tar boot
drwxr-xr-x root/root         0 2001-09-26 15:35:12 boot/
-rw-r--r-- root/root    410731 2001-04-16 07:14:20
boot/System.map-2.4.3-20mdk
-rw-r--r-- root/root     33572 2001-04-16 07:14:20 boot/config-2.4.3-20mdk
-rw-r--r-- root/root    833285 2001-04-16 07:14:20 boot/vmlinuz-2.4.3-20mdk
drwxr-xr-x root/root         0 2001-09-21 13:35:28 boot/grub/
-rw-r--r-- root/root      8156 2001-04-03 20:02:33 boot/grub/e2fs_stage1_5
-rw-r--r-- root/root      7564 2001-04-03 20:02:33 boot/grub/fat_stage1_5
-rw-r--r-- root/root      6940 2001-04-03 20:02:33 boot/grub/ffs_stage1_5
-rw-r--r-- root/root      7100 2001-04-03 20:02:33 boot/grub/minix_stage1_5
-rw-r--r-- root/root      9660 2001-04-03 20:02:33
boot/grub/reiserfs_stage1_5
-rw-r--r-- root/root       512 2001-04-03 20:02:33 boot/grub/stage1
-rw-r--r-- root/root     90292 2001-04-03 20:02:33 boot/grub/stage2
-rw-r--r-- root/root        60 2001-09-22 11:00:44 boot/grub/device.map
-rw-r--r-- root/root       284 2001-09-22 11:00:44 boot/grub/menu.lst
-rw-r--r-- root/root       101 2001-09-22 11:00:44 boot/grub/menu.once
-rw-r--r-- root/root       158 2001-09-22 11:00:44 boot/grub/install.sh
-rw-r--r-- root/root       282 2001-09-22 11:00:44 boot/grub/messages
-rw-r--r-- root/root       370 2001-09-21 13:35:28 boot/grub/menu.lst.old
-rw-r--r-- root/root      5868 2001-04-09 02:11:51 boot/boot-graphic.b
-rw-r--r-- root/root      6108 2001-04-09 02:11:51 boot/boot-menu.b
-rw-r--r-- root/root      4356 2001-04-09 02:11:51 boot/boot-text.b
-rw-r--r-- root/root       608 2001-04-09 02:11:51 boot/chain.b
-rw-r--r-- root/root     35130 2001-04-09 02:11:53 boot/message-graphic
-rw-r--r-- root/root       640 2001-04-09 02:11:51 boot/os2_d.b
lrwxrwxrwx root/root         0 2001-09-26 14:49:28 boot/boot.b ->
boot-text.b
-rw-r--r-- root/root       441 2001-09-26 15:34:35 boot/kernel.h-2.4.3
lrwxrwxrwx root/root         0 2001-04-24 04:21:55 boot/kernel.h ->
kernel.h-2.4.3
lrwxrwxrwx root/root         0 2001-09-26 14:41:59 boot/vmlinuz ->
vmlinuz-2.4.3-20mdk
-rw-r--r-- root/root       256 2001-04-24 08:26:05 boot/us-latin1.klt
-rw-r--r-- root/root     35130 2001-09-22 13:29:39 boot/message
-rw-r--r-- root/root       512 2001-09-26 14:42:04 boot/boot.0300
-rw------- root/root     15872 2001-09-26 15:35:12 boot/map
lrwxrwxrwx root/root         0 2001-09-26 15:34:08 boot/System.map ->
System.map-2.4.3-20mdk
lrwxrwxrwx root/root         0 2001-09-26 15:34:08 boot/config ->
config-2.4.3-20mdk
-rw-r--r-- root/root    422341 2001-08-21 08:37:05
boot/System.map-2.4.7-12.3mdk
-rw-r--r-- root/root     36656 2001-08-21 08:37:05
boot/config-2.4.7-12.3mdk
-rw-r--r-- root/root   1004714 2001-08-21 08:37:05
boot/vmlinuz-2.4.7-12.3mdk
-rw-r--r-- root/root       512 2001-04-24 08:26:05 boot/boot.0300.old
-rw-r--r-- root/root       512 2001-09-26 14:54:40 boot/boot.0200
-rw-r--r-- root/root       512 2001-09-26 15:31:52 boot/boot.1600

gecko:/tmp # tar xf all.tar boot

gecko:/tmp # ll boot
total 2822
-rw-r--r--    1 root     root          512 Sep 26 14:54 boot.0200
-rw-r--r--    1 root     root          512 Sep 26 14:42 boot.0300
-rw-r--r--    1 root     root          512 Apr 24 08:26 boot.0300.old
-rw-r--r--    1 root     root          512 Sep 26 15:31 boot.1600
----------    1 root     root            0 Oct  1 10:08 boot.b
-rw-r--r--    1 root     root         5868 Apr  9 02:11 boot-graphic.b
-rw-r--r--    1 root     root         6108 Apr  9 02:11 boot-menu.b
-rw-r--r--    1 root     root         4356 Apr  9 02:11 boot-text.b
-rw-r--r--    1 root     root          608 Apr  9 02:11 chain.b
----------    1 root     root            0 Oct  1 10:08 config
-rw-r--r--    1 root     root        33572 Apr 16 07:14 config-2.4.3-20mdk
-rw-r--r--    1 root     root        36656 Aug 21 08:37
config-2.4.7-12.3mdk
drwxr-xr-x    2 root     root         2048 Oct  1 10:08 grub/
----------    1 root     root            0 Oct  1 10:08 kernel.h
-rw-r--r--    1 root     root          441 Sep 26 15:34 kernel.h-2.4.3
-rw-------    1 root     root  15872 Sep 26 15:35 map
-rw-r--r--    1 root     root        35130 Sep 22 13:29 message
-rw-r--r--    1 root     root        35130 Apr  9 02:11 message-graphic
-rw-r--r--    1 root     root          640 Apr  9 02:11 os2_d.b
----------    1 root     root            0 Oct  1 10:08 System.map
-rw-r--r--    1 root     root       410731 Apr 16 07:14
System.map-2.4.3-20mdk
-rw-r--r--    1 root     root       422341 Aug 21 08:37
System.map-2.4.7-12.3mdk
-rw-r--r--    1 root     root          256 Apr 24 08:26 us-latin1.klt
----------    1 root     root            0 Oct  1 10:08 vmlinuz
-rw-r--r--    1 root     root       833285 Apr 16 07:14 vmlinuz-2.4.3-20mdk
-rw-r--r--    1 root     root      1004714 Aug 21 08:37
vmlinuz-2.4.7-12.3mdk


Expected Results:  All of the files showing permissions `----------' should
have been
soft links to other files in the same directory.

Additional info:

There is a simply work-around to this problem.
Extract the files and do :

  tar tvf tar_file list_of_files | grep -e " -> " 
  | awk '{print "ln -fs " $8 " " $6}' > some_filename

then execute 'some_filename' as a shell script (from the base directory of
the restored files). It seems to work fine.
Comment 1 Scott Gordon 2001-09-30 20:29:04 EDT
Created attachment 33038 [details]
Sample commands and output to illustrate the bug.

Note You need to log in before you can comment on or make changes to this bug.