[ https://issues.apache.org/jira/browse/IO-319?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13251624#comment-13251624 ]
Ravi Prakash commented on IO-319: --------------------------------- I'll be happy to. I'm working on it now. I'm not sure how platform-independent the test code needs to be, but I'll give it a fair shot and hopefully you'll be able to guide me to a better iteration. > FileUtils.sizeOfDirectory follows symbolic links. > ------------------------------------------------- > > Key: IO-319 > URL: https://issues.apache.org/jira/browse/IO-319 > Project: Commons IO > Issue Type: Bug > Affects Versions: 2.1 > Reporter: Ravi Prakash > Priority: Critical > > First of all Thanks tons Apache Commons folks for all the amazing work! :) My > first JIRA. Yayyy. I contributed B-) > A symbolic link may create a cycle and so sizeOfDirectory crashes with an > IllegalArgumentException. e.g. > {noformat} > $ tree test > test > ├── file > └── ravi > ├── cycle -> ../../test > └── file > {noformat} > causes FileUtils.sizeOfDirectory to crash like so > {noformat} > java TestJAVA > Exception in thread "main" java.lang.IllegalArgumentException: > <somepath>/test/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle/ravi/cycle > does not exist > at org.apache.commons.io.FileUtils.sizeOf(FileUtils.java:2053) > at > org.apache.commons.io.FileUtils.sizeOfDirectory(FileUtils.java:2089) > at org.apache.commons.io.FileUtils.sizeOf(FileUtils.java:2057) > at > org.apache.commons.io.FileUtils.sizeOfDirectory(FileUtils.java:2089) > at org.apache.commons.io.FileUtils.sizeOf(FileUtils.java:2057) > at > org.apache.commons.io.FileUtils.sizeOfDirectory(FileUtils.java:2089) > at org.apache.commons.io.FileUtils.sizeOf(FileUtils.java:2057) > at > org.apache.commons.io.FileUtils.sizeOfDirectory(FileUtils.java:2089) > {noformat} > We faced the same issue in Hadoop :(. Checkout > https://issues.apache.org/jira/browse/HADOOP-6963 for our solution -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira