This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: tar and the symlinks


> -----Original Message-----
> From: Larry Hall [mailto:cygwin-lh@cygwin.com]
> Sent: Monday, July 05, 2004 8:09 PM
> To: lassauge@users.sourceforge.net; 'cygwin@sources.redhat.com'
> Subject: Re: tar and the symlinks
> 
> 
> 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
> >example:
> >
> >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:
> >usr/
> >usr/X11R6/
> >usr/X11R6/bin/
> >usr/X11R6/bin/xmlock.exe
> >usr/X11R6/lib/
> >usr/X11R6/lib/X11/
> >usr/X11R6/lib/X11/app-defaults/
> >usr/X11R6/lib/X11/app-defaults/XmLock
> >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.

	OK. This is tar normal behavior (never really asked myself what tar
was doing in that case). I even tried this on a linux box:
[user@linux]$ tree
.
|-- link_to_dir -> real_dir/
|-- package.tar.bz2
|-- real_dir
|   `-- real_file
`-- temp_root_for_package
    `-- link_to_dir
        `-- added_file

[user@linux]$ tar xvjf package.tar.bz2 
./
./link_to_dir/
./link_to_dir/added_file
[user@linux]$ tree
.
|-- link_to_dir
|   `-- added_file
|-- package.tar.bz2
|-- real_dir
|   `-- real_file
`-- temp_root
    `-- link_to_dir
        `-- added_file


The answer to my question is finally:
"you have to know that a dir in your install tree is a symlink before 
doing the package." and "you MUST use the real dir name (not the link)
when packaging you application" (maybe this should be added somewhere
in the packager documentation ?). Maybe setup.exe could verify that
before installing ?

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


-- 
	Eric Lassauge <ext.zxplespac001@astrium.eads.net>
	ASTRIUM - SPACEBEL - TRASYS G2i
 

Attachment: important_notice.txt
Description: Text document

--
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/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]