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=15031>. 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=15031 ANT <copy> with <fileset> does not spot bad symlinks [EMAIL PROTECTED] changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|WONTFIX | ------- Additional Comments From [EMAIL PROTECTED] 2003-07-23 14:53 ------- BUT YOU CANFIX ! You say "Also, according to java.io.File the file does not exist." - thats the key though isn't it! Any file that exists in the directory but for which java.io.File.exists() return false is almost certainly a dead symlink. We don't actually need to know its a symlink all we are trying to trap is the error where ant cannot copy the given file for some reason. I would argue that ant should also report an error for files that DO exist but however do not have read access. The program below traps these cases easily. ls -l /tmp/src_with_some_bad_links/ lrwxrwxrwx 1 badlink -> nonexistantfile lrwxrwxrwx 1 goodlink -> realfile -rw-r--r-- 1 realfile ---------- 1 unreadable ... we get .... /tmp/src_with_some_bad_links: is a directory /tmp/src_with_some_bad_links/realfile: exists and is readable /tmp/src_with_some_bad_links/realfile: exists and is readable /tmp/src_with_some_bad_links/badlink:exists in the parent directory, but does not actually exist - this is a dead symlink - ANT SHOULD REPORT THIS ERROR /tmp/src_with_some_bad_links/unreadable: exists but is not readable ANT SHOULD REPORT THIS ERROR Given this proof I would say it is entirely unreasonable that ant ignore such build errors. ================================================== import java.io.File; class test { public static void main(String [] args ) { test("/tmp//src_with_some_bad_links"); } static void test(String name) { test(new java.io.File(name)); } static void test(File f) { try { String filename = f.getCanonicalPath(); try { if (f.isDirectory()) { System.err.println(filename+": is a directory"); File[] files = f.listFiles(); for (int iFile=0; iFile < files.length; iFile++) { test(files[iFile]); } } else { if ( f.exists() ) { if ( f.canRead() ) System.err.println(filename+": exists and is readable"); else System.err.println(filename+": exists but is not readable ANT SHOULD REPORT THIS ERROR"); } else { System.err.println(filename+":exists in the parent directory, but does not actually exist - this is a dead symlink - ANT SHOULD REPORT THIS ERROR"); } } } catch(Exception e) { System.err.println(filename + ":exception " + e.getMessage()); } } catch(Exception e) { System.err.println(e.getMessage()); } } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]