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

http://issues.apache.org/bugzilla/show_bug.cgi?id=38574

           Summary: [io] FileSystemUtils returns incorrect free space on
                    Linux
           Product: Commons
           Version: 1.1.0
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: IO
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: [EMAIL PROTECTED]


Re: Commons-IO class FileSystemUtils

The method freeSpace(String path) returns free disk space in bytes on Windows,
and returns free disk space in kilobytes (not bytes) on Linux (possibly Unix /
Mac OS etc. also).  

The internal method freeSpaceUnix javadoc reads "Find free space on the *nix
platform using the 'df' command." The value returned by df is read in to a
variable called bytes and returned. Man pages for df on Linux (Fedora Core 4)
read "Disk  space  is  shown  in  1K blocks  by  default". So method
freeSpaceUnix is returning the number of kilobytes free space, not bytes.

A simple fix could be to add line "bytes = bytes * 1024;" after bytes are read 
in.

The javadocs for this class could be improved also. Comment "@return the amount
of free drive space on the volume" could read "@return the amount of free drive
space on the volume in bytes".

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to