[ 
https://issues.apache.org/jira/browse/IO-319?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13251767#comment-13251767
 ] 

Ravi Prakash commented on IO-319:
---------------------------------

Thanks Gary! Aah! I did not notice that. You probably meant isSymLink always 
returns false
bq. Note: the current implementation always returns false if the system is 
detected as Windows using FilenameUtils#isSystemWindows()
causing isSymLink to always be true on Windows. I guess the real fix would be 
to make the isSymlink() method not do that. Could you please append to the 
patch and fix it on Windows? I'm sorry I don't have a Windows machine :(
                
> 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
>         Attachments: commons-io-319.patch, commons-io-319.patch
>
>
> 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


Reply via email to