commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ravi Prakash (Created) (JIRA)" <j...@apache.org>
Subject [jira] [Created] (IO-319) FileUtils.sizeOfDirectory follows symbolic links.
Date Fri, 30 Mar 2012 23:05:26 GMT
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

       

Mime
View raw message