ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gus Heck <>
Subject Re: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net
Date Tue, 12 Aug 2003 19:18:03 GMT
Antoine Levy-Lambert wrote:

>----- Original Message -----
>From: "Gus Heck" <>
>Sent: Tuesday, August 12, 2003 4:10 PM
>>Since you have recently been playing with symlinks/FTP what are your
>>thoughts on bug 14320?
>First the bad news : I do not have the time to work on this in the frame of
>ant 1.6. I am concerned that this might open a large Pandora box. :-(
Fair enough :)

>Once ant 1.6 is released, I would like to discuss again the topic of
>"Resource(s)" and/or Jakarta-Common VFS. I would like to evaluate the use of
>Jakarta-Common VFS in ant, so that ant does not need to reinvent the wheel
>for everything. Just a thought at the moment, might be wrong.
hmm I should find out what Jakarta-Common VFS is :)


>Manipulating the symbolic link as a link is doable in a portable way for
>packaging tasks (zip, jar, war, ear, tar). I am not sure what is the API to
>find the target of the symbolic link (do an exec of ls -L and read the
>result, or go the JNI route ?) ...
Parsing command line output seems dicey and brittle.

>*** We need another attribute for filesets and directoryscanner called
>preservesymlinks. ***
>I can imagine that one could add an atribute that caused an OS check and if
>it is a *nix set a flag that caused copy to use FileUtils.isSymbolicLink to
>identify symlinks. symlinks could then be reproduced in either absolute form
>minimum relative form or not reproduced in the destination directory based
>on an
>atribute such as copySymlinksAs="none"|"absolute"|"minRelative"
>I don't know how much time I can put into it, but I'd be willing to try that
>it sounds like a good idea to anyone else.
>Does "minRelative" mean relative to the root dir of the fileset ?
>Maybe "asis" would be a good option too, to copy somelink -> ../../foo/bar
>as ../../foo/bar
/usr/local/storage/links/link2foo -> /usr/local/storage/gus/baz/bar/foo

is also equivalent to the following
/usr/local/storage/links/lin2foo -> 
/usr/local/storage/links/lin2foo -> ../../../local/storage/gus/baz/bar/foo
/usr/local/storage/links/lin2foo -> ../../storage/gus/baz/bar/foo
/usr/local/storage/links/lin2foo -> ../gus/baz/bar/foo

The last of these is what I call minRelative. (I don't know if there is 
a more standard term).
I currently convert all links in my website to this form by execing the 
linux command
(not the ant task): "symlinks -rcs" from the document root twice. The 
first invocation changes absolute to relative, and the second reduces 
the lenghthy links to minimal links. I do not know if this command is 
available on other *nix platforms.

It should also be possible to compare the canoniacal path of the dir the 
link is to be created in and the canonical path of the target of the 
link and calculate the minimum number of ../ 's needed to create the 
link and get "minRelative" that way.

Maintaining asis requires direct knowledge of which of the 4 
posibilities above was on the file system, and probably does require 
parsing output of ln or ls or whatever. "minRelative" links are of 
particular to me interest because they are the least likely to break 
when moving directories containing links around. The first of the 4 
relative links always breaks, if it gets moved up or down a level, but 
if I move /usr/local/storage to /usr/local/old/storage then the last two 
forms still work. My website build creates links in a tempdir before 
moving the whole thing to where the world can see it (assuming all went 

>This attribute would only be legal with followsymlinks="false" (since true
>means manipulate the objects pointed to by the links).
>Then we need to define task by task how to use
>Symbolic links do not exist in Windows (for ant's FileUtils#isSymbolicLink)
>Symbolic links can be created via the symlink task, which relies on ln -s
>available in the operating system

>.lnk files exist
>non .lnk links exist
>not aware of command line utility distributed with all versions of the OS to
>do this
>aware of ln.exe in cygwin
>aware of shortcut.exe, a program which is part of the Windows NT resource
>kit of Microsoft
lnk files have substantial functional differences. a .lnk to a directory 
cannot be included in the middle of a path as such: 
C:\projects\ant.lnk\src\main ... this won't work, but of course does 
work with symlinks. I have heard that there is something like symlinks 
out there called "reparse points" but I really don't know anything other 
than the name. (google searches a year ago wern't too fruitful on the 
topic, but this may have changed).

>the area where symbolic links support should be least problematic,
>except for possible exceptions due to media not accepting symbolic links
>Apart from <copy/>,  packaging tasks are good candidates for having the
>option of copying/preserving symbolic links. They would only be impacted if
>they run on UNIX.
That sounds good to me.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message