bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-tar] gnu tar fails to restore hard-linked symlinks


From: Andreas Stolcke
Subject: [Bug-tar] gnu tar fails to restore hard-linked symlinks
Date: Mon, 06 Jun 2011 19:28:37 -0700

This bug first showed up in tar 1.24, presumably related to the followng NEWS 
item:

** Symbolic link attributes

When extracting symbolic links, tar now restores attributes such as
last-modified time and link permissions, if the operating system
supports this.  For example, recent versions of the Linux kernel
support setting times on symlinks, and some BSD kernels also support
symlink permissions.

----------

1. Create symbolic link and a hard link to it, and make tar file of them:

        % mkdir foo
        % ln -s /bar foo/bar
        % ln foo/bar foo/bar2
        % ls -l foo
total 4
lrwxrwxrwx   2 stolcke  real           4 Jun  6 19:18 bar -> /bar
lrwxrwxrwx   2 stolcke  real           4 Jun  6 19:18 bar2 -> /bar

        % /usr/local/gnu/bin/tar cf foo.tar foo

        % /usr/local/gnu/bin/tar tvf foo.tar foo
drwxr-xr-x stolcke/real      0 2011-06-06 19:18 foo/
lrwxrwxrwx stolcke/real      0 2011-06-06 19:18 foo/bar -> /bar
hrwxrwxrwx stolcke/real      0 2011-06-06 19:18 foo/bar2 link to foo/bar

2. Untar :

        % rm -rf foo
        % /usr/local/gnu/bin/tar xf foo.tar
        % ls -l foo
total 0
----------   2 stolcke  real           0 Jun  6 19:19 bar
----------   2 stolcke  real           0 Jun  6 19:19 bar2

Observations:

- If the symlink in 1) is to "bar" instead of "/bar" the problem in 2) does not 
occur.
- The foo.tar file can be untarred correctly with Solaris /bin/tar, or with gnu 
tar 1.23 or earlier.
- The behavior above has been seen on Linux (various releases) and Solaris 10 
(sparc and x86).

Andreas 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]