Possible tar bug when restoring symlinks in a chrooted environment

Tony Green <[email protected]>
Newsgroups gmane.comp.gnu.fileutils.bugs
Message-ID <[email protected]>
I've come across what I *think* is a bug in the way GNU tar restores 
symbolically linked files.
The problem appears to relate to restoring symlinks that have absolute paths 
when in a chrooted environment.
Specifically, I have had this problem when rebuilding my filesystem after 
booting from a rescue disc and mounting the real filesystems under /mnt. 
After restoring from a tarball, symlinks that had absolute paths become empty 
files with null file permissions.

As an example, the proper listing for /bin/vi from ls -al is:
lrwxrwxrwx    1 root root  20 Feb  4 20:43 /bin/vi -> /etc/alternatives/vi*

If I restore from my backup with filesystems mounted as normal, this is 
restored correctly. However, if I restore in the chrooted rescue environment, 
the listing becomes:
---------- 1 root root 20 Feb  4 20:43 /bin/vi

This occurs every time and does not seem to be related to the filesystem type, 
as I have replicated it with ext2 and ReiserFS types.

Not something that 's a problem in normal day-to-day use, but just what you 
don't need when you're trying to restore a broken system :-)

System details:
tar version 1.13.25
GNU/Linux Mandrake 9.0 (although I'm pretty sure I've had the problem on 
earlier versions) using the rescue image provided on the CD.
Filesystem: ext2 or ReiserFS

Commands used:
Building the archive:
tar --bzip2 -cX /tmp/backup-excludes --atime-preserve -p -f \
/tmp/full-backup.tar.bz2 /*

Restoring:
tar --bzip2 -xvf /tmp/full-backup.tar.bz2

It might be that I'm doing something wrong, although I haven't managed to work 
out what it might be. Apologies for bothering you if it *is* user error...

If I can provide any further information, please ask.

Thanks for a useful bit of software - I'd be lost without it :-)
-- 
Tony Green
Ipswich, Suffolk, England
Website http://www.beermad.org.uk/

*** No Micro$oft products were used in the generation of this communication 
***

*** A little something to keep the CIA spooks at Echelon busy ***
Hijack
Kabul
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.