tar and the symlinks

Larry Hall cygwin-lh@cygwin.com
Mon Jul 5 18:15:00 GMT 2004

At 06:54 AM 7/5/2004, you wrote:
>    Hi,
>I (tried to) read the FAQ carefully and did'nt find a clue.
>The problem is for the packaging of applications that install
>some of their files in a directory that is a link.
>On NT4 I have a strange behavior: the directory is hidding
>the link and the files didn't mix. OK, I know that my english is not
>very clear (sorry but I'm french :->), 

I'm sorry too. ;-) ;-) ;-)

>so let's explain with an
>1/ I am porting the xlockmore application. This is an X11 program
>and after being compiled and configured the X11 resource files
>will be installed in $prefix/lib/X11/app-defaults (prefix is /usr/X11R6)
>2/ I package the file within a bzip2 compress tar-ball, and this tar 
>(for example for the motif GUI xmlock) contains:
>3/ after using setup to install this package I have in /usr/X11R6
>a directory named app-defaults (which is "hiding" the symlink for the 
>initial app-defaults which is a link to /etc/X11/app-defaults and is 
>created when installing xorg):

Right.  This is standard 'tar' behavior.  There's nothing Cygwin specific
here.  'tar's info page has this to say:

   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 confusion in the presence of hard or symbolic
links.  (If the existing file is a symbolic link, it is removed, not
followed.)  However, if a directory cannot be removed because it is
nonempty, `tar' neither removes it nor modifies its ownership,
permissions, or time stamps.

   To be more cautious and prevent existing files from being replaced,
use the `--keep-old-files' (`-k') option.  It causes `tar' to refuse to
replace or update a file that already exists, i.e., a file with the
same name as an archive member prevents extraction of that archive
member.  Instead, it reports an error.

   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.  The
`--overwrite-dir' option is somewhat more conservative than
`--overwrite': it overwrites metadata (ownership, permission, etc.) for
directories, but removes other files before extracting them.

Make sense?

Larry Hall                              http://www.rfk.com
RFK Partners, Inc.                      (508) 893-9779 - RFK Office
838 Washington Street                   (508) 893-9889 - FAX
Holliston, MA 01746                     

Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

More information about the Cygwin mailing list