Subject: bug#23285: closed (Re: bug#23285: tar lacks a 'preserve symlinks on extract' option)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 13 Apr 2016 21:05:03 +0000

Your bug report

#23285: tar lacks a 'preserve symlinks on extract' option

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
23285: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=23285
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#23285: tar lacks a 'preserve symlinks on extract' option
From: Eric Blake <[email-masked]>
To: Jason Vas Dias <[email-masked]>, [email-masked]
Date: Wed, 13 Apr 2016 15:04:30 -0600
List-Id: <debbugs-submit.debbugs.gnu.org>

tag 23285 notabug
thanks

On 04/13/2016 02:58 PM, Jason Vas Dias wrote:
> There appears to be no way of telling tar
> not to replace a destination symlink with a directory ,
> in this scenario :

Thanks for the report.  However, you've reached the coreutils list,
which does not include tar; and tar does not (yet?) use the
debbugs.gnu.org bug tracker, so we can't reassign your bug.  The best we
can do is close this bug (as it is not a coreutils problem) and tell you
to resend your mail to [email-masked], as directed by 'tar --help'.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Subject: tar lacks a 'preserve symlinks on extract' option
From: Jason Vas Dias <[email-masked]>
To: [email-masked]
Date: Wed, 13 Apr 2016 21:58:56 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

There appears to be no way of telling tar
not to replace a destination symlink with a directory ,
in this scenario :

$ cd /tmp
$ mkdir d s t
$ ln -s ../t d/t
$ mkdir s/t
$ touch s/t/f
$ (cd s; tar -cpf - .) | (cd d; tar -xpf -)
$ ls -R d
  d:
t

d/t:
f

On extraction, tar has replaced the symlink d/t with a directory d/t .

I think there should be a way of getting tar to follow and preserve
such symlinks on extraction .

The manual page :
http://www.gnu.org/software/tar/manual/html_node/Dealing-with-Old-Files.html
states:
" When extracting files, if tar discovers that the extracted file
already exists, it
  normally replaces the file by removing it before extracting it, to
prevent confusi
 on in the presence of hard or symbolic links. (If the existing file
is a symbolic link,
 it is removed, not followed.)
" ...
"To be more aggressive about altering existing files, use the
`--overwrite' option.
 It causes tar to overwrite existing files and to follow existing
symbolic links when
 extracting.
"

But the --overwrite option does not prevent tar from removing symlinks in
the above scenario !

Morever, despite adding -v / --verbose, tar does not say anything about
removing such symlinks - I think it should.

Please, either make the --overwrite option follow & preserve symlinks
on extraction, or provide a --preserve-symlinks-on-extract option or
something
like it .
This problem prevents administrators from maintaining symlinks on systems
which might be updated with tar .

Is it likely that GNU tar will ever support this in future or or do I
have to develop
a patch to make it preserve symlinks on extraction  ?

Thanks & Regards,
Jason