php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #38567 file operations make loads of lstat64() calls and making code ineffective
Submitted: 2006-08-23 15:03 UTC Modified: 2017-09-21 14:41 UTC
Votes:5
Avg. Score:4.4 ± 0.8
Reproduced:4 of 4 (100.0%)
Same Version:1 (25.0%)
Same OS:4 (100.0%)
From: glen at delfi dot ee Assigned:
Status: Open Package: *General Issues
PHP Version: 5.1.5 OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-08-23 15:03 UTC] glen at delfi dot ee
Description:
------------
$ strace php -r 'for ($i=0;$i<5;$i++) 
{$fp=fopen("/home/glen/tmp/php/long/test/dir/is/here/$i","w");fclose($fp);}' 
2>&1 |grep /home

this will call lstat64() each time on:
/home
/home/glen
/home/glen/tmp
/home/glen/tmp/php
/home/glen/tmp/php/long
/home/glen/tmp/php/long/test
/home/glen/tmp/php/long/test/dir
/home/glen/tmp/php/long/test/dir/is
/home/glen/tmp/php/long/test/dir/is/here

while it should either don't do them at all or at least 
cache the paths that haven't been altered (i only write to 
last dir)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-23 15:27 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip


 [2006-08-23 16:15 UTC] glen at delfi dot ee
no changes. tried php5.2-200608231430
 [2017-01-20 21:51 UTC] heiglandreas@php.net
-Status: Open +Status: Feedback -Package: Feature/Change Request +Package: *General Issues
 [2017-01-20 21:51 UTC] heiglandreas@php.net
Is this still relevant?
 [2017-01-21 08:36 UTC] requinix@php.net
Doesn't seem to be an issue using PHP 7.0.13 on Ubuntu. With /a/b/c/d/$i it stats /a/b/c/d/0 down to /a, then /a/b/c/d/1, 2, etc.
 [2017-01-21 08:48 UTC] requinix@php.net
Note this is subject to open_basedir: if enabled then PHP has to stat everything every time (in case it changed) but if not then PHP can reuse previous results.
 [2017-01-23 09:42 UTC] glen at delfi dot ee
-Status: Feedback +Status: Open
 [2017-01-23 09:42 UTC] glen at delfi dot ee
➔ php -r 'var_dump(ini_get("open_basedir"));'
Command line code:1:
string(0) ""
 [2017-01-23 09:43 UTC] glen at delfi dot ee
➔ php --version
PHP 5.6.27 (cli) (built: Nov 21 2016 23:08:15)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
    with Xdebug v2.4.1, Copyright (c) 2002-2016, by Derick Rethans

➔ php -r 'var_dump(ini_get("open_basedir"));'
Command line code:1:
string(0) ""

➔ strace php -r 'for ($i=0;$i<5;$i++) {$fp=fopen("/home/glen/tmp/php/long/test/dir/is/here/$i","w");fclose($fp);}'  2>&1 |grep /home 


open("/home/glen/.config/ImageMagick/log.xml", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/glen/.magick/log.xml", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/glen/.config/ImageMagick/policy.xml", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/glen/.magick/policy.xml", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/glen/.krb5/config", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/home/glen/.snmp", 0x7ffcda428cf0) = -1 ENOENT (No such file or directory)
stat("/home/glen/.snmp", 0x7ffcda428cf0) = -1 ENOENT (No such file or directory)
stat("/home/glen/.snmp/tls/ca-certs", 0x7ffcda426870) = -1 ENOENT (No such file or directory)
stat("/home/glen/.snmp/tls/certs", 0x7ffcda426870) = -1 ENOENT (No such file or directory)
stat("/home/glen/.snmp/tls/private", 0x7ffcda426870) = -1 ENOENT (No such file or directory)
open("/home/glen/.snmp/mibs", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/home/glen/.snmp", 0x7ffcda428d00) = -1 ENOENT (No such file or directory)
stat("/home/glen/.snmp", 0x7ffcda428d00) = -1 ENOENT (No such file or directory)

lstat("/home/glen/tmp/php/long/test/dir/is/here/0", 0x7ffcda426c80) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir/is/here", 0x7ffcda426ae0) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir/is", 0x7ffcda426940) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir", 0x7ffcda4267a0) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test", 0x7ffcda426610) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long", 0x7ffcda426480) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php", 0x7ffcda4262f0) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
lstat("/home/glen", {st_mode=S_IFDIR|0775, st_size=12288, ...}) = 0
lstat("/home", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/home/glen/tmp/php/long/test/dir/is/here/0", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1 ENOENT (No such file or directory)
write(2, "PHP Warning:  fopen(/home/glen/t"..., 145PHP Warning:  fopen(/home/glen/tmp/php/long/test/dir/is/here/0): failed to open stream: No such file or directory in Command line code on line 1
lstat("/home/glen/tmp/php/long/test/dir/is/here/1", 0x7ffcda426c80) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir/is/here", 0x7ffcda426ae0) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir/is", 0x7ffcda426940) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir", 0x7ffcda4267a0) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test", 0x7ffcda426610) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long", 0x7ffcda426480) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php", 0x7ffcda4262f0) = -1 ENOENT (No such file or directory)
open("/home/glen/tmp/php/long/test/dir/is/here/1", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1 ENOENT (No such file or directory)
write(2, "PHP Warning:  fopen(/home/glen/t"..., 145PHP Warning:  fopen(/home/glen/tmp/php/long/test/dir/is/here/1): failed to open stream: No such file or directory in Command line code on line 1
lstat("/home/glen/tmp/php/long/test/dir/is/here/2", 0x7ffcda426c80) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir/is/here", 0x7ffcda426ae0) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir/is", 0x7ffcda426940) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir", 0x7ffcda4267a0) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test", 0x7ffcda426610) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long", 0x7ffcda426480) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php", 0x7ffcda4262f0) = -1 ENOENT (No such file or directory)
open("/home/glen/tmp/php/long/test/dir/is/here/2", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1 ENOENT (No such file or directory)
write(2, "PHP Warning:  fopen(/home/glen/t"..., 145PHP Warning:  fopen(/home/glen/tmp/php/long/test/dir/is/here/2): failed to open stream: No such file or directory in Command line code on line 1
lstat("/home/glen/tmp/php/long/test/dir/is/here/3", 0x7ffcda426c80) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir/is/here", 0x7ffcda426ae0) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir/is", 0x7ffcda426940) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir", 0x7ffcda4267a0) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test", 0x7ffcda426610) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long", 0x7ffcda426480) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php", 0x7ffcda4262f0) = -1 ENOENT (No such file or directory)
open("/home/glen/tmp/php/long/test/dir/is/here/3", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1 ENOENT (No such file or directory)
write(2, "PHP Warning:  fopen(/home/glen/t"..., 145PHP Warning:  fopen(/home/glen/tmp/php/long/test/dir/is/here/3): failed to open stream: No such file or directory in Command line code on line 1
lstat("/home/glen/tmp/php/long/test/dir/is/here/4", 0x7ffcda426c80) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir/is/here", 0x7ffcda426ae0) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir/is", 0x7ffcda426940) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir", 0x7ffcda4267a0) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test", 0x7ffcda426610) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long", 0x7ffcda426480) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php", 0x7ffcda4262f0) = -1 ENOENT (No such file or directory)
open("/home/glen/tmp/php/long/test/dir/is/here/4", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1 ENOENT (No such file or directory)
write(2, "PHP Warning:  fopen(/home/glen/t"..., 145PHP Warning:  fopen(/home/glen/tmp/php/long/test/dir/is/here/4): failed to open stream: No such file or directory in Command line code on line 1
 [2017-09-21 11:06 UTC] cmb@php.net
That appears to be related to the ini directive realpath_cache_size[1], which
defaults to only 16k before PHP 7.0.16. Try to increase the setting to 4096k,
for instance.

[1] <http://www.php.net/manual/en/ini.core.php#ini.realpath-cache-size>
 [2017-09-21 11:56 UTC] glen at delfi dot ee
-Operating System: PLD Linux +Operating System:
 [2017-09-21 11:56 UTC] glen at delfi dot ee
i do not see any improvement, no matter what php version or cache size is.
post your result proving otherwise, maybe there's something hidden in plain sight.


➔ php70 -i|grep realpath_cache_size
realpath_cache_size => 4096K => 4096K

➔ php70 -d realpath_cache_size=128000k -i|grep realpath_cache_size
realpath_cache_size => 128000k => 128000k

➔ php70 -d realpath_cache_size=128000k --version
PHP 7.0.18 (cli) (built: Apr 24 2017 20:13:36) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies


➔ strace php70 -d realpath_cache_size=128000k -r 'for ($i=0;$i<5;$i++) {$fp=fopen("/home/glen/tmp/php/long/test/dir/is/here/$i","w");fclose($fp);}'  2>&1 |grep /home


lstat("/home/glen/.local/npm/bin/php70", 0x7fff98552520) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir/is/here/0", 0x7fff98551160) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir/is/here", 0x7fff98550fc0) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir/is", 0x7fff98550e20) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir", 0x7fff98550c80) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test", 0x7fff98550af0) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long", 0x7fff98550960) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php", 0x7fff985507d0) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
lstat("/home/glen", {st_mode=S_IFDIR|0775, st_size=12288, ...}) = 0
lstat("/home", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/home/glen/tmp/php/long/test/dir/is/here/0", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1 ENOENT (No such file or directory)
write(2, "PHP Warning:  fopen(/home/glen/t"..., 145PHP Warning:  fopen(/home/glen/tmp/php/long/test/dir/is/here/0): failed to open stream: No such file or directory in Command line code on line 1
lstat("/home/glen/tmp/php/long/test/dir/is/here/1", 0x7fff98551160) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir/is/here", 0x7fff98550fc0) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir/is", 0x7fff98550e20) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir", 0x7fff98550c80) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test", 0x7fff98550af0) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long", 0x7fff98550960) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php", 0x7fff985507d0) = -1 ENOENT (No such file or directory)
open("/home/glen/tmp/php/long/test/dir/is/here/1", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1 ENOENT (No such file or directory)
write(2, "PHP Warning:  fopen(/home/glen/t"..., 145PHP Warning:  fopen(/home/glen/tmp/php/long/test/dir/is/here/1): failed to open stream: No such file or directory in Command line code on line 1
lstat("/home/glen/tmp/php/long/test/dir/is/here/2", 0x7fff98551160) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir/is/here", 0x7fff98550fc0) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir/is", 0x7fff98550e20) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir", 0x7fff98550c80) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test", 0x7fff98550af0) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long", 0x7fff98550960) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php", 0x7fff985507d0) = -1 ENOENT (No such file or directory)
open("/home/glen/tmp/php/long/test/dir/is/here/2", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1 ENOENT (No such file or directory)
write(2, "PHP Warning:  fopen(/home/glen/t"..., 145PHP Warning:  fopen(/home/glen/tmp/php/long/test/dir/is/here/2): failed to open stream: No such file or directory in Command line code on line 1
lstat("/home/glen/tmp/php/long/test/dir/is/here/3", 0x7fff98551160) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir/is/here", 0x7fff98550fc0) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir/is", 0x7fff98550e20) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir", 0x7fff98550c80) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test", 0x7fff98550af0) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long", 0x7fff98550960) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php", 0x7fff985507d0) = -1 ENOENT (No such file or directory)
open("/home/glen/tmp/php/long/test/dir/is/here/3", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1 ENOENT (No such file or directory)
write(2, "PHP Warning:  fopen(/home/glen/t"..., 145PHP Warning:  fopen(/home/glen/tmp/php/long/test/dir/is/here/3): failed to open stream: No such file or directory in Command line code on line 1
lstat("/home/glen/tmp/php/long/test/dir/is/here/4", 0x7fff98551160) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir/is/here", 0x7fff98550fc0) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir/is", 0x7fff98550e20) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test/dir", 0x7fff98550c80) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long/test", 0x7fff98550af0) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php/long", 0x7fff98550960) = -1 ENOENT (No such file or directory)
lstat("/home/glen/tmp/php", 0x7fff985507d0) = -1 ENOENT (No such file or directory)
open("/home/glen/tmp/php/long/test/dir/is/here/4", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1 ENOENT (No such file or directory)
write(2, "PHP Warning:  fopen(/home/glen/t"..., 145PHP Warning:  fopen(/home/glen/tmp/php/long/test/dir/is/here/4): failed to open stream: No such file or directory in Command line code on line 1

➔
 [2017-09-21 12:03 UTC] spam2 at rhsoft dot net
see https://bugs.php.net/bug.php?id=73888

increase it only wastes more memory for each worker which has it's on isolated view of the cache and as requests are spreaded over workers you won't have cachehits most of the time until all workers have everything cached

well, and in the real world workers are restarted after handling a few thousand requests and then it needs to start caching from scratch again
 [2017-09-21 12:24 UTC] nikic@php.net
@rhsoft: That's not relevant to this issue.

From the strace it looks like we're still stat'ing all path components, even though the full path is already not found. That does seem rather fishy.
 [2017-09-21 12:57 UTC] cmb@php.net
> i do not see any improvement, no matter what php version or cache size is.

Ah, I should have looked more carefully. Sorry! The issue is that if a dirent
does not exists (ENOENT), the realpath cache doesn't cache this info, because
the dirent may be created before the next lookup.

> From the strace it looks like we're still stat'ing all path components, even
> though the full path is already not found.

Apparently, we're stat'ting from bottom to top for whatever reason:

    strace sapi/cli/php -r 'for ($i=0;$i<5;$i++) {$fp=fopen("/home/vagrant/$i","w");fclose($fp);}' 2>&1 |grep /vagrant

prints

lstat("/home/vagrant/0", 0x7ffe7a4f6f90) = -1 ENOENT (No such file or directory)
lstat("/home/vagrant", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/home/vagrant/0", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
lstat("/home/vagrant/1", 0x7ffe7a4f6f90) = -1 ENOENT (No such file or directory)
open("/home/vagrant/1", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
lstat("/home/vagrant/2", 0x7ffe7a4f6f90) = -1 ENOENT (No such file or directory)
open("/home/vagrant/2", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
lstat("/home/vagrant/3", 0x7ffe7a4f6f90) = -1 ENOENT (No such file or directory)
open("/home/vagrant/3", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
lstat("/home/vagrant/4", 0x7ffe7a4f6f90) = -1 ENOENT (No such file or directory)
open("/home/vagrant/4", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
 [2017-09-21 14:41 UTC] cmb@php.net
> Apparently, we're stat'ting from bottom to top for whatever reason:

The reason is that we have to resolve links first.

Anyhow, I don't see a real problem here. If a nested directory structure is
accessed where parents don't exist, there are superfluous stat() calls. However,
accessing such a structure doesn't make sense in the first place, and appears to
be a programming error. If all parent directories already exist, there are no
superfluous stat() calls. Consider:

$ ls /home/vagrant
$ strace sapi/cli/php -r 'for ($i=0;$i<5;$i++) {$fp=fopen("/home/vagrant/foo/bar/baz/$i","w");fclose($fp);}' 2>&1 | grep 'lstat("/home/vagrant'
lstat("/home/vagrant/foo/bar/baz/0", 0x7ffc13cd4560) = -1 ENOENT (No such file or directory)
lstat("/home/vagrant/foo/bar/baz", 0x7ffc13cd4450) = -1 ENOENT (No such file or directory)
lstat("/home/vagrant/foo/bar", 0x7ffc13cd4340) = -1 ENOENT (No such file or directory)
lstat("/home/vagrant/foo", 0x7ffc13cd4230) = -1 ENOENT (No such file or directory)
lstat("/home/vagrant", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/home/vagrant/foo/bar/baz/1", 0x7ffc13cd4560) = -1 ENOENT (No such file or directory)
lstat("/home/vagrant/foo/bar/baz", 0x7ffc13cd4450) = -1 ENOENT (No such file or directory)
lstat("/home/vagrant/foo/bar", 0x7ffc13cd4340) = -1 ENOENT (No such file or directory)
lstat("/home/vagrant/foo", 0x7ffc13cd4230) = -1 ENOENT (No such file or directory)
lstat("/home/vagrant/foo/bar/baz/2", 0x7ffc13cd4560) = -1 ENOENT (No such file or directory)
lstat("/home/vagrant/foo/bar/baz", 0x7ffc13cd4450) = -1 ENOENT (No such file or directory)
lstat("/home/vagrant/foo/bar", 0x7ffc13cd4340) = -1 ENOENT (No such file or directory)
lstat("/home/vagrant/foo", 0x7ffc13cd4230) = -1 ENOENT (No such file or directory)
lstat("/home/vagrant/foo/bar/baz/3", 0x7ffc13cd4560) = -1 ENOENT (No such file or directory)
lstat("/home/vagrant/foo/bar/baz", 0x7ffc13cd4450) = -1 ENOENT (No such file or directory)
lstat("/home/vagrant/foo/bar", 0x7ffc13cd4340) = -1 ENOENT (No such file or directory)
lstat("/home/vagrant/foo", 0x7ffc13cd4230) = -1 ENOENT (No such file or directory)
lstat("/home/vagrant/foo/bar/baz/4", 0x7ffc13cd4560) = -1 ENOENT (No such file or directory)
lstat("/home/vagrant/foo/bar/baz", 0x7ffc13cd4450) = -1 ENOENT (No such file or directory)
lstat("/home/vagrant/foo/bar", 0x7ffc13cd4340) = -1 ENOENT (No such file or directory)
lstat("/home/vagrant/foo", 0x7ffc13cd4230) = -1 ENOENT (No such file or directory)
$ mkdir -p /home/vagrant/foo/bar/baz
$ strace sapi/cli/php -r 'for ($i=0;$i<5;$i++) {$fp=fopen("/home/vagrant/foo/bar/baz/$i","w");fclose($fp);}' 2>&1 | grep 'lstat("/home/vagrant'
lstat("/home/vagrant/foo/bar/baz/0", 0x7fffa350ccf0) = -1 ENOENT (No such file or directory)
lstat("/home/vagrant/foo/bar/baz", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/home/vagrant/foo/bar", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/home/vagrant/foo", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/home/vagrant", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/home/vagrant/foo/bar/baz/1", 0x7fffa350ccf0) = -1 ENOENT (No such file or directory)
lstat("/home/vagrant/foo/bar/baz/2", 0x7fffa350ccf0) = -1 ENOENT (No such file or directory)
lstat("/home/vagrant/foo/bar/baz/3", 0x7fffa350ccf0) = -1 ENOENT (No such file or directory)
lstat("/home/vagrant/foo/bar/baz/4", 0x7fffa350ccf0) = -1 ENOENT (No such file or directory)
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC