Commons IO
  1. Commons IO
  2. IO-34

[io] FileSystemUtils returns incorrect free space on Linux

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1
    • Fix Version/s: 1.2
    • Component/s: None
    • Labels:
      None
    • Environment:

      Operating System: Linux
      Platform: Other

      Description

      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".

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Resolved Resolved Reopened Reopened
        117d 16h 6m 1 Stephen Colebourne 06/Jun/06 19:36
        Reopened Reopened Closed Closed
        1m 30s 1 Stephen Colebourne 06/Jun/06 19:37
        Mark Thomas made changes -
        Workflow jira [ 12371800 ] Default workflow, editable Closed status [ 12601722 ]
        Stephen Colebourne made changes -
        Resolution Fixed [ 1 ]
        Status Reopened [ 4 ] Closed [ 6 ]
        Stephen Colebourne made changes -
        Fix Version/s 1.2 Final [ 12311767 ]
        Bugzilla Id 38574
        Affects Version/s 1.1 Final [ 12311746 ]
        Affects Version/s 1.1.0 [ 12311871 ]
        Stephen Colebourne made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Hide
        Stephen Colebourne added a comment -

        Reopening to change versions

        Show
        Stephen Colebourne added a comment - Reopening to change versions
        Henri Yandell made changes -
        Affects Version/s 1.1.0 [ 12311871 ]
        Henri Yandell made changes -
        Assignee Jakarta Commons Developers Mailing List [ commons-dev@jakarta.apache.org ]
        Component/s IO [ 12311117 ]
        Key COM-2743 IO-34
        Project Commons [ 12310458 ] Commons IO [ 12310477 ]
        Affects Version/s 1.1.0 [ 12311676 ]
        Henri Yandell made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 38574 12342895
        Hide
        Stephen Colebourne added a comment -

        FileSystemUtils.freeSpaceKb(drive)
        New method that unifies result to be in kilobytes

        Please reopen if you believe that the new method returns the wrong result (I can
        on test on Windows)

        Show
        Stephen Colebourne added a comment - FileSystemUtils.freeSpaceKb(drive) New method that unifies result to be in kilobytes Please reopen if you believe that the new method returns the wrong result (I can on test on Windows)
        Niall Gallagher created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Niall Gallagher
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development