#40633 [NEW]: disk_free_space returns a bad result on filesystems with negative free space

Ask a Question related to PHP Bugs, Design and Development.

  1. #1

    Default #40633 [NEW]: disk_free_space returns a bad result on filesystems with negative free space

    From: adam-phpbugs at adam dot gs
    Operating system: *BSD (at least)
    PHP version: 5.2.1
    PHP Bug Type: Filesystem function related
    Bug description: disk_free_space returns a bad result on filesystems with negative free space

    Description:
    ------------
    on a filesystem with a negative amount of free space (this
    can happen on at least FreeBSD) disk_free_space returns
    unreasonable results.

    -=[/some/path]=- -=[Sun Feb 25]=- -=[19:51:55]=-
    [root@cube]# php -r 'print disk_free_space(".")."\n";'
    3.77789318629E+22
    -=[/some/path]=- -=[Sun Feb 25]=- -=[19:51:57]=-
    [root@cube]# df -h .
    Filesystem Size Used Avail Capacity Mounted on
    /dev/ad7 289G 289G -23G 109% /some/path
    -=[/some/path]=- -=[Sun Feb 25]=- -=[19:51:58]=-
    [root@cube]# df .
    Filesystem 1K-blocks Used Avail Capacity Mounted
    on
    /dev/ad7 302732078 302699550 -24186038 109% /some/
    path


    Reproduce code:
    ---------------
    php -r 'print disk_free_space(".")."\n";'

    Expected result:
    ----------------
    -24186038

    Actual result:
    --------------
    3.77789318629E+22

    --
    Edit bug report at [url]http://bugs.php.net/?id=40633&edit=1[/url]
    --
    Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=40633&r=trysnapshot44[/url]
    Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=40633&r=trysnapshot52[/url]
    Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=40633&r=trysnapshot60[/url]
    Fixed in CVS: [url]http://bugs.php.net/fix.php?id=40633&r=fixedcvs[/url]
    Fixed in release: [url]http://bugs.php.net/fix.php?id=40633&r=alreadyfixed[/url]
    Need backtrace: [url]http://bugs.php.net/fix.php?id=40633&r=needtrace[/url]
    Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=40633&r=needscript[/url]
    Try newer version: [url]http://bugs.php.net/fix.php?id=40633&r=oldversion[/url]
    Not developer issue: [url]http://bugs.php.net/fix.php?id=40633&r=support[/url]
    Expected behavior: [url]http://bugs.php.net/fix.php?id=40633&r=notwrong[/url]
    Not enough info: [url]http://bugs.php.net/fix.php?id=40633&r=notenoughinfo[/url]
    Submitted twice: [url]http://bugs.php.net/fix.php?id=40633&r=submittedtwice[/url]
    register_globals: [url]http://bugs.php.net/fix.php?id=40633&r=globals[/url]
    PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=40633&r=php3[/url]
    Daylight Savings: [url]http://bugs.php.net/fix.php?id=40633&r=dst[/url]
    IIS Stability: [url]http://bugs.php.net/fix.php?id=40633&r=isapi[/url]
    Install GNU Sed: [url]http://bugs.php.net/fix.php?id=40633&r=gnused[/url]
    Floating point limitations: [url]http://bugs.php.net/fix.php?id=40633&r=float[/url]
    No Zend Extensions: [url]http://bugs.php.net/fix.php?id=40633&r=nozend[/url]
    MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=40633&r=mysqlcfg[/url]
    adam-phpbugs at adam dot gs Guest

  2. Similar Questions and Discussions

    1. How come the web service returns no result ?
      Hi everyone, If possible, please tell me how come the two trace statements return nothing. <mx:Script> <!]> </mx:Script> ...
    2. Calc returns garbled result
      What am I doing wrong here, it doesn't work? Field payment date is formatted 01/01/2001 Next Payment Due= DateToText(Date(Month(Payment Date)...
    3. how to get (free) space of a drive?
      How can I find out how much space the drive has got and how much free space is remaining on it? thx
    4. Looking into a recordset until it returns a result
      I currently connect to two servers. One is IIS, that runs my asp and sql server, and the other is an AS400, that also cranks out data. Sometimes I...
    5. How much free space left on ext. FW drive?
      In article <heronstone-5836B6.21001722062003@netnews.attbi.com>, heron stone <heronstone@attbi.com> wrote: 5% of their total size.
  3. #2

    Default #40633 [Opn->Fbk]: disk_free_space returns a bad result on filesystems with negative free space

    ID: 40633
    Updated by: [email]tony2001@php.net[/email]
    Reported By: adam-phpbugs at adam dot gs
    -Status: Open
    +Status: Feedback
    Bug Type: Filesystem function related
    Operating System: *BSD (at least)
    PHP Version: 5.2.1
    New Comment:

    What kind of BSD is that and don't you think that negative free space
    is a BSD bug?


    Previous Comments:
    ------------------------------------------------------------------------

    [2007-02-26 00:55:02] adam-phpbugs at adam dot gs

    Description:
    ------------
    on a filesystem with a negative amount of free space (this
    can happen on at least FreeBSD) disk_free_space returns
    unreasonable results.

    -=[/some/path]=- -=[Sun Feb 25]=- -=[19:51:55]=-
    [root@cube]# php -r 'print disk_free_space(".")."\n";'
    3.77789318629E+22
    -=[/some/path]=- -=[Sun Feb 25]=- -=[19:51:57]=-
    [root@cube]# df -h .
    Filesystem Size Used Avail Capacity Mounted on
    /dev/ad7 289G 289G -23G 109% /some/path
    -=[/some/path]=- -=[Sun Feb 25]=- -=[19:51:58]=-
    [root@cube]# df .
    Filesystem 1K-blocks Used Avail Capacity Mounted
    on
    /dev/ad7 302732078 302699550 -24186038 109% /some/
    path


    Reproduce code:
    ---------------
    php -r 'print disk_free_space(".")."\n";'

    Expected result:
    ----------------
    -24186038

    Actual result:
    --------------
    3.77789318629E+22


    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=40633&edit=1[/url]
    tony2001@php.net Guest

  4. #3

    Default #40633 [Fbk->Opn]: disk_free_space returns a bad result on filesystems with negative free space

    ID: 40633
    User updated by: adam-phpbugs at adam dot gs
    Reported By: adam-phpbugs at adam dot gs
    -Status: Feedback
    +Status: Open
    Bug Type: Filesystem function related
    Operating System: *BSD (at least)
    PHP Version: 5.2.1
    New Comment:

    This was FreeBSD

    if you look at the FreeBSD manpage for tunefs(8), this is
    the intended behaviour.

    [url]http://www.freebsd.org/cgi/man.cgi?[/url]
    query=tunefs&apropos=0&sektion=0&manpath=FreeBSD+6 .2-
    RELEASE&format=html


    Basically, in FreeBSD (under UFS2 at least) avaliable space
    is calculated as total minus used minus reserved. A small %
    (8 by default) is reserved.

    So, this is not really a bug, but actually an intended
    feature.


    Previous Comments:
    ------------------------------------------------------------------------

    [2007-02-26 09:33:41] [email]tony2001@php.net[/email]

    What kind of BSD is that and don't you think that negative free space
    is a BSD bug?

    ------------------------------------------------------------------------

    [2007-02-26 00:55:02] adam-phpbugs at adam dot gs

    Description:
    ------------
    on a filesystem with a negative amount of free space (this
    can happen on at least FreeBSD) disk_free_space returns
    unreasonable results.

    -=[/some/path]=- -=[Sun Feb 25]=- -=[19:51:55]=-
    [root@cube]# php -r 'print disk_free_space(".")."\n";'
    3.77789318629E+22
    -=[/some/path]=- -=[Sun Feb 25]=- -=[19:51:57]=-
    [root@cube]# df -h .
    Filesystem Size Used Avail Capacity Mounted on
    /dev/ad7 289G 289G -23G 109% /some/path
    -=[/some/path]=- -=[Sun Feb 25]=- -=[19:51:58]=-
    [root@cube]# df .
    Filesystem 1K-blocks Used Avail Capacity Mounted
    on
    /dev/ad7 302732078 302699550 -24186038 109% /some/
    path


    Reproduce code:
    ---------------
    php -r 'print disk_free_space(".")."\n";'

    Expected result:
    ----------------
    -24186038

    Actual result:
    --------------
    3.77789318629E+22


    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=40633&edit=1[/url]
    adam-phpbugs at adam dot gs Guest

  5. #4

    Default #40633 [Opn]: disk_free_space returns a bad result on filesystems with negative free space

    ID: 40633
    User updated by: adam-phpbugs at adam dot gs
    Reported By: adam-phpbugs at adam dot gs
    Status: Open
    Bug Type: Filesystem function related
    -Operating System: *BSD (at least)
    +Operating System: FreeBSD
    PHP Version: 5.2.1
    New Comment:

    changing OS to FreeBSD


    Previous Comments:
    ------------------------------------------------------------------------

    [2007-02-26 13:32:36] adam-phpbugs at adam dot gs

    This was FreeBSD

    if you look at the FreeBSD manpage for tunefs(8), this is
    the intended behaviour.

    [url]http://www.freebsd.org/cgi/man.cgi?[/url]
    query=tunefs&apropos=0&sektion=0&manpath=FreeBSD+6 .2-
    RELEASE&format=html


    Basically, in FreeBSD (under UFS2 at least) avaliable space
    is calculated as total minus used minus reserved. A small %
    (8 by default) is reserved.

    So, this is not really a bug, but actually an intended
    feature.

    ------------------------------------------------------------------------

    [2007-02-26 09:33:41] [email]tony2001@php.net[/email]

    What kind of BSD is that and don't you think that negative free space
    is a BSD bug?

    ------------------------------------------------------------------------

    [2007-02-26 00:55:02] adam-phpbugs at adam dot gs

    Description:
    ------------
    on a filesystem with a negative amount of free space (this
    can happen on at least FreeBSD) disk_free_space returns
    unreasonable results.

    -=[/some/path]=- -=[Sun Feb 25]=- -=[19:51:55]=-
    [root@cube]# php -r 'print disk_free_space(".")."\n";'
    3.77789318629E+22
    -=[/some/path]=- -=[Sun Feb 25]=- -=[19:51:57]=-
    [root@cube]# df -h .
    Filesystem Size Used Avail Capacity Mounted on
    /dev/ad7 289G 289G -23G 109% /some/path
    -=[/some/path]=- -=[Sun Feb 25]=- -=[19:51:58]=-
    [root@cube]# df .
    Filesystem 1K-blocks Used Avail Capacity Mounted
    on
    /dev/ad7 302732078 302699550 -24186038 109% /some/
    path


    Reproduce code:
    ---------------
    php -r 'print disk_free_space(".")."\n";'

    Expected result:
    ----------------
    -24186038

    Actual result:
    --------------
    3.77789318629E+22


    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=40633&edit=1[/url]
    adam-phpbugs at adam dot gs Guest

  6. #5

    Default #40633 [Opn->Fbk]: disk_free_space returns a bad result on filesystems with negative free space

    ID: 40633
    Updated by: [email]tony2001@php.net[/email]
    Reported By: adam-phpbugs at adam dot gs
    -Status: Open
    +Status: Feedback
    Bug Type: Filesystem function related
    Operating System: FreeBSD
    PHP Version: 5.2.1
    New Comment:

    Please provide an SSH account on a machine where I can reproduce it.


    Previous Comments:
    ------------------------------------------------------------------------

    [2007-02-26 13:33:03] adam-phpbugs at adam dot gs

    changing OS to FreeBSD

    ------------------------------------------------------------------------

    [2007-02-26 13:32:36] adam-phpbugs at adam dot gs

    This was FreeBSD

    if you look at the FreeBSD manpage for tunefs(8), this is
    the intended behaviour.

    [url]http://www.freebsd.org/cgi/man.cgi?[/url]
    query=tunefs&apropos=0&sektion=0&manpath=FreeBSD+6 .2-
    RELEASE&format=html


    Basically, in FreeBSD (under UFS2 at least) avaliable space
    is calculated as total minus used minus reserved. A small %
    (8 by default) is reserved.

    So, this is not really a bug, but actually an intended
    feature.

    ------------------------------------------------------------------------

    [2007-02-26 09:33:41] [email]tony2001@php.net[/email]

    What kind of BSD is that and don't you think that negative free space
    is a BSD bug?

    ------------------------------------------------------------------------

    [2007-02-26 00:55:02] adam-phpbugs at adam dot gs

    Description:
    ------------
    on a filesystem with a negative amount of free space (this
    can happen on at least FreeBSD) disk_free_space returns
    unreasonable results.

    -=[/some/path]=- -=[Sun Feb 25]=- -=[19:51:55]=-
    [root@cube]# php -r 'print disk_free_space(".")."\n";'
    3.77789318629E+22
    -=[/some/path]=- -=[Sun Feb 25]=- -=[19:51:57]=-
    [root@cube]# df -h .
    Filesystem Size Used Avail Capacity Mounted on
    /dev/ad7 289G 289G -23G 109% /some/path
    -=[/some/path]=- -=[Sun Feb 25]=- -=[19:51:58]=-
    [root@cube]# df .
    Filesystem 1K-blocks Used Avail Capacity Mounted
    on
    /dev/ad7 302732078 302699550 -24186038 109% /some/
    path


    Reproduce code:
    ---------------
    php -r 'print disk_free_space(".")."\n";'

    Expected result:
    ----------------
    -24186038

    Actual result:
    --------------
    3.77789318629E+22


    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=40633&edit=1[/url]
    tony2001@php.net Guest

  7. #6

    Default #40633 [Fbk->Ana]: disk_free_space returns a bad result on filesystems with negative free space

    ID: 40633
    Updated by: [email]tony2001@php.net[/email]
    Reported By: adam-phpbugs at adam dot gs
    -Status: Feedback
    +Status: Analyzed
    Bug Type: Filesystem function related
    Operating System: FreeBSD
    PHP Version: 5.2.1
    -Assigned To:
    +Assigned To: tony2001


    Previous Comments:
    ------------------------------------------------------------------------

    [2007-02-26 15:44:08] [email]tony2001@php.net[/email]

    Please provide an SSH account on a machine where I can reproduce it.

    ------------------------------------------------------------------------

    [2007-02-26 13:33:03] adam-phpbugs at adam dot gs

    changing OS to FreeBSD

    ------------------------------------------------------------------------

    [2007-02-26 13:32:36] adam-phpbugs at adam dot gs

    This was FreeBSD

    if you look at the FreeBSD manpage for tunefs(8), this is
    the intended behaviour.

    [url]http://www.freebsd.org/cgi/man.cgi?[/url]
    query=tunefs&apropos=0&sektion=0&manpath=FreeBSD+6 .2-
    RELEASE&format=html


    Basically, in FreeBSD (under UFS2 at least) avaliable space
    is calculated as total minus used minus reserved. A small %
    (8 by default) is reserved.

    So, this is not really a bug, but actually an intended
    feature.

    ------------------------------------------------------------------------

    [2007-02-26 09:33:41] [email]tony2001@php.net[/email]

    What kind of BSD is that and don't you think that negative free space
    is a BSD bug?

    ------------------------------------------------------------------------

    [2007-02-26 00:55:02] adam-phpbugs at adam dot gs

    Description:
    ------------
    on a filesystem with a negative amount of free space (this
    can happen on at least FreeBSD) disk_free_space returns
    unreasonable results.

    -=[/some/path]=- -=[Sun Feb 25]=- -=[19:51:55]=-
    [root@cube]# php -r 'print disk_free_space(".")."\n";'
    3.77789318629E+22
    -=[/some/path]=- -=[Sun Feb 25]=- -=[19:51:57]=-
    [root@cube]# df -h .
    Filesystem Size Used Avail Capacity Mounted on
    /dev/ad7 289G 289G -23G 109% /some/path
    -=[/some/path]=- -=[Sun Feb 25]=- -=[19:51:58]=-
    [root@cube]# df .
    Filesystem 1K-blocks Used Avail Capacity Mounted
    on
    /dev/ad7 302732078 302699550 -24186038 109% /some/
    path


    Reproduce code:
    ---------------
    php -r 'print disk_free_space(".")."\n";'

    Expected result:
    ----------------
    -24186038

    Actual result:
    --------------
    3.77789318629E+22


    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=40633&edit=1[/url]
    tony2001@php.net Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139