[ http://issues.apache.org/jira/browse/IO-34?page=all ] Stephen Colebourne reopened IO-34: ----------------------------------
Reopening to change versions > [io] FileSystemUtils returns incorrect free space on Linux > ---------------------------------------------------------- > > Key: IO-34 > URL: http://issues.apache.org/jira/browse/IO-34 > Project: Commons IO > Type: Bug > Versions: 1.1 Final > Environment: Operating System: Linux > Platform: Other > Reporter: Niall Gallagher > Fix For: 1.2 Final > > 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". -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]