GNU bug report logs -
#23285
tar lacks a 'preserve symlinks on extract' option
Previous Next
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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
This bug report was last modified 9 years and 100 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.