php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52078 fileinode overflow test ext/standard/tests/file/fileinode_variation3.phpt
Submitted: 2010-06-13 23:29 UTC Modified: 2012-03-30 20:31 UTC
From: glen at delfi dot ee Assigned: tyrael (profile)
Status: Closed Package: Filesystem function related
PHP Version: 5.3.2 OS: PLD Linux
Private report: No CVE-ID: None
 [2010-06-13 23:29 UTC] glen at delfi dot ee
Description:
------------
fileinode overflows on filesystem where inode count is huge.

it is mentioned in comment of manual as well:
http://php.net/manual/en/function.fileinode.php


Test script:
---------------
$ (t=`mktemp -d`; cd $t; php -r 'var_dump(fileinode("."));'; echo $t; ls -ldi $t)
int(-2051936757)

/home/users/glen/tmp/tmp.zLdoithBR0

2243030539 drwx------ 2 glen users 6 Jun 14 00:26 /home/users/glen/tmp/tmp.zLdoithBR0/


Expected result:
----------------
test must be fixed to expect %i instead of %d.


Patches

fileinode.patch (last revision 2010-06-13 21:30 UTC by glen at delfi dot ee)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-13 23:38 UTC] glen at delfi dot ee
-Package: *General Issues +Package: Filesystem function related
 [2010-06-13 23:38 UTC] glen at delfi dot ee
fix package
 [2010-12-12 21:31 UTC] glen at delfi dot ee
i've kept it somewhat updated here:

http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/php/bug-52078-fileinode.patch
 [2010-12-12 21:32 UTC] glen at delfi dot ee
as you maybe have noted, one chunk takes different approach:

if (PHP_INT_SIZE == 4) die("skip this test is for >32bit platform only (inodes 
overflow there)");

maybe should rather skip overflowing tests there?
 [2011-11-05 20:49 UTC] glen at delfi dot ee
any interest of getting it fixed?

i could supply patches, if i see any interest at all on this topic from upstream
 [2012-01-17 10:18 UTC] tyrael@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: tyrael
 [2012-01-17 10:18 UTC] tyrael@php.net
I will look into merging this, thanks for the patch and the heads up.
 [2012-01-19 19:09 UTC] tyrael@php.net
I commited the %d->%i changes to trunk and 5.3, waiting for approval to commit it 
to 5.4 as well, I will keep the ticket open until.

http://svn.php.net/viewvc?view=revision&revision=322460
 [2012-01-20 23:56 UTC] glen at delfi dot ee
please note that the patch provided in bug was not complete (there are more tests 
suffering the same deficiency), because did not get any feedback to decide to 
proceed further.

"find -name '*.phpt' | xargs grep fileinode" in source tree should give ideas 
what more to patch (and of course all inode related functions: getmyinode, stat, 
...)
 [2012-02-06 22:47 UTC] tyrael@php.net
Automatic comment from SVN on behalf of tyrael
Revision: http://svn.php.net/viewvc/?view=revision&revision=323100
Log: merging the patch from bug #52078, fixes the test on disk with huge inode size(fileinode() can overflow and return negative values there).
 [2012-02-06 22:50 UTC] tyrael@php.net
applied the original patch to the 5.4 branch also.
if you can come up with patches for the other tests I can also apply then soon, if 
not I will try to go through the affected tests, but that will take longer.
 [2012-02-06 23:51 UTC] glen at delfi dot ee
i could supply the patches, if i get answer WHICH WAY TO GO!

a) %i in formats like in initial patch?
b) PHP_INT_SIZE check, like asked in comment #3?
c) something else???
 [2012-02-07 21:10 UTC] tyrael@php.net
I would prefer the a (%i) solution, there is no reason to skip tests (and miss 
regression) on 32bit only because the values (whom excat values we don't really 
care) can overflow on some configurations.
 [2012-03-30 20:31 UTC] tyrael@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

thank you for the contribution, if you come up with the other patches, please open 
another ticket.
 [2012-03-30 20:31 UTC] tyrael@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 07:01:28 2024 UTC