misc/126849: tar -x -P doesn't follow symlinks that already exist in target location

Etienne na.eb.ml at gmail.com
Tue Aug 26 09:00:12 UTC 2008


>Number:         126849
>Category:       misc
>Synopsis:       tar -x -P doesn't follow symlinks that already exist in target location
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 26 09:00:11 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Etienne
>Release:        FreeBSD 6.3-RELEASE
>Organization:
NETASQ
>Environment:
FreeBSD jcd.localhost 6.3-RELEASE FreeBSD 6.3-RELEASE #1: Thu Aug  7 16:37:14 CEST 2008     root at jcd.localhost:/usr/obj/usr/src/sys/SMP  i386
>Description:
When extracting an archive, the -P option behavior of bsdtar differs on FreeBSD 6.2 and FreeBSD 6.3 :
when an archive containing "dir/file" is extracted somewhere "dir" already exists as a symlink to another location,
   - on FreeBSD 6.2, "dir" is left as a symlink and "file" is extracted into the target directory of the symlink (that is the behavior of gnu tar too)
   - on FreeBSD 6.3, "dir" is overwritten and contains "file" (there is no more symlink)

The problem still exists with bsdtar 2.5.5 - libarchive 2.5.5
>How-To-Repeat:
# create a tar file
mkdir dir
touch dir/file
tar cf test.tar dir

# remove files
rm -fr dir

#create a link
mkdir real_dir
ln -s real_dir dir

#untar
tar xPf test.tar

Results depending on FreeBSD versions :
FreeBSD 6.2              FreeBSD 6.3
.                    |   .
|-- dir -> real_dir  |   |-- dir
`-- real_dir         |   |   `-- file
    `-- file         |   `-- real_dir

>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list