Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Aug 2008 08:56:08 GMT
From:      Etienne <na.eb.ml@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/126849: tar -x -P doesn't follow symlinks that already exist in target location
Message-ID:  <200808260856.m7Q8u8SF060396@www.freebsd.org>
Resent-Message-ID: <200808260900.m7Q90Ckk084918@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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@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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808260856.m7Q8u8SF060396>