Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 06 Jun 2019 12:57:06 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 238362] lang/php73: readdir in combination with unlink is missing files on NFS
Message-ID:  <bug-238362-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D238362

            Bug ID: 238362
           Summary: lang/php73: readdir in combination with unlink is
                    missing files on NFS
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: tz@freebsd.org
          Reporter: pascal.christen@hostpoint.ch
          Assignee: tz@freebsd.org
             Flags: maintainer-feedback?(tz@freebsd.org)

Hi

I'm facing a strange problem. It's easier to show an example than describing
it:

showfiles.php
<?php
function removeFiles($path)
{
        $handle =3D opendir($path);
        while (false !=3D=3D ($file =3D readdir($handle))) {
                if ($file =3D=3D=3D '.' || $file =3D=3D=3D '..') {
                        continue;
                }
                echo "PATH $path/$file\n";
                #unlink($path . '/' . $file);
        }
        closedir($handle);
}
$path =3D realpath('/home/christes/test/');
removeFiles($path);

So, I'm touching 200 new files in the directory /home/christes/test/
[christes@xxx:~/test] $ touch test{001..200}.test

Now if I run the PHP-script without the unlink (commented out) - it's all f=
ine:
[christes@xxx:~] $ php listdir.php | wc -l
     200

Now, if I remove the # in front of the ulink this happens:
[christes@xxx:~] $ php listdir.php | wc -l
     126
[christes@xxx:~] $ php listdir.php | wc -l
      74

On the first round, it only removes the first 126 files, if I rerun it agai=
n it
deletes the remaining files.

And it deletes less files if the filename is longer:
[christes@xxx:~/test] $ touch
testtesttesttesttesttesttesttesttesttesttest{001..200}.test
[christes@xxx:~] $ php listdir.php | wc -l
     111


And this only happens when my files are on a NFS share. Has it something to=
 do
with a buffer, because it "deletes" fewer files when the filename is longer=
? Or
is readdir just not thread safe?

Same problem with PHP5.6-7.3 running on FreeBSD 11.2

Thanks for helping!

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-238362-7788>