You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2002/11/08 21:06:47 UTC

DO NOT REPLY [Bug 14063] - ANT FTP will not download a file if it is a symlink

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14063>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14063

ANT FTP will not download a file if it is a symlink





------- Additional Comments From Bill@Explosivo.com  2002-11-08 20:06 -------
This does not mirror the functionality of command line FTP utilities which will 
download a symlink to a file.

I finally had a chance to peek into the source code and found where the problem 
is...  In org.apache.tools.ant.taskdefs.optional.net.FTP.java (Thanks for the 
tip Gus)

For a symlink the FTPFile will return false for both isFile and isDirectory...  
These are the only flags that get checked, so anything that comes back as a 
symlink (isSymbolicLink = true) is not counted or looked at.

Its easy enough to add in the code to include the symlink

Just change:

if (file.isFile()) {
     String name = vpath + file.getName();

to

if (file.isFile() || file.isSymbolicLink()) {
     String name = vpath + file.getName();

Now this brings out another problem...  Symlinks to a directory.  These do not 
register as directories.  You can get the linked to name by FTPFile.getLink() 
but this is string for the filename, not another FTPFile object.

I am still working on it, and most likely will need to get a file object for 
the target to see if its a directory... If so, it may need to be followed 
depending on how the decend into directories is done...

Any thoughts would be appreciated

I would guess that pattern matching should only happen against the link name, 
not the target...

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>