Re: [PHP-DEV] Re: Still having lstat trouble
Ok, I think I found the problem, as Oliver pointed me on something in the thread titled virtual_file_ex/filetype. When PHP is build with --enable-maintainer-zts mode, then this lstat, and some others too, is broken. I have build 2 PHP installations(PHP-5.2.3RC1), Both with the same configuration options, except that I build the first without --enable-maintainer-zts, and the second one with. The first one does execute the code as expected, while the second code doesn't. It returns the same for all filesystems that were actually allowing symlinks, no matter which options used: file not a link same So, thank Oliver! Tijnema -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: Still having lstat trouble
I found my problem as well. I am running apache2 prefork, but the headers for apache2-mpm ware installed instead. I guess Ubuntu messed up with the distro update. Thanks for all your help, Arnold Tijnema wrote: Ok, I think I found the problem, as Oliver pointed me on something in the thread titled virtual_file_ex/filetype. When PHP is build with --enable-maintainer-zts mode, then this lstat, and some others too, is broken. I have build 2 PHP installations(PHP-5.2.3RC1), Both with the same configuration options, except that I build the first without --enable-maintainer-zts, and the second one with. The first one does execute the code as expected, while the second code doesn't. It returns the same for all filesystems that were actually allowing symlinks, no matter which options used: file not a link same So, thank Oliver! Tijnema -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: Still having lstat trouble
Arnold Daniels wrote: I found my problem as well. I am running apache2 prefork, but the headers for apache2-mpm ware installed instead. I guess Ubuntu messed up with the distro update. This explains it all. Our Apache 2 servers uses worker mpm. Gentoo builds the cli with zts too. That is why our cli and apache 2 returned wrong data. So, it this a bug in ZTS? Or do we have to live with this? -- Brian Moon Senior Developer -- http://dealnews.com/ It's good to be cheap =) -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: Still having lstat trouble
Hi, Sorry I didn't react sooner. I was out of the office. I'm running ReiserFS as well. [EMAIL PROTECTED]:~$ mount /dev/sda3 on / type reiserfs (rw,notail) proc on /proc type proc (rw,noexec,nosuid,nodev) /sys on /sys type sysfs (rw,noexec,nosuid,nodev) varrun on /var/run type tmpfs (rw,noexec,nosuid,nodev,mode=0755) varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777) procbususb on /proc/bus/usb type usbfs (rw) udev on /dev type tmpfs (rw,mode=0755) devshm on /dev/shm type tmpfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) lrm on /lib/modules/2.6.20-15-generic/volatile type tmpfs (rw) /dev/sda5 on /home type reiserfs (rw) /dev/sda6 on /xen-images type reiserfs (rw) nfsd on /proc/fs/nfsd type nfsd (rw) rpc_pipefs on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw) binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) [EMAIL PROTECTED]:~$ apache2 -v Server version: Apache/2.2.3 Server built: Jan 15 2007 18:14:50 If I need to send anything else, please let me know. Best regards, Arnold Brian Moon wrote: Rasmus Lerdorf wrote: Which filesystems is /tmp on on the various boxes? tmpfs related perhaps? On all my systems, /tmp is just part of / which is ReiserFS. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: Still having lstat trouble
On 5/24/07, Rasmus Lerdorf [EMAIL PROTECTED] wrote: Which filesystems is /tmp on on the various boxes? tmpfs related perhaps? -Rasmus Nice idea, but I don't think it's a problem there, I think it's a configuration problem. I've build my own linux, and so I have all configuration like I want. I'm running php-5.2.3RC1 as Apache 2.2.3 module. I've split up my USB stick in a few file systems, and they worked all for me, except for msdosvfat file systems, as they don't support symlinks. Test results here: http://86.86.80.41/fs_test.php and source for the test is here: http://86.86.80.41/fs_test.phps Tijnema Brian Moon wrote: Works as expected on my Mac (no strace on my Mac). On my Gentoo 64-bit server, I get the wrong data from Apache2 and CLI. On my 32-bit Gentoo server, without Apache 2, I get the correct answer from apache and cli. On my 32-bit Gentoo server with Apache 2 I get a wrong answer from Apache and cli. We build our PHP on these servers with the same options via emerge. The only difference is Apache 2. What the hell? # uname -a Linux proxy1 2.6.18-gentoo-r6 #1 SMP Thu Feb 8 07:32:31 EST 2007 x86_64 Dual-Core AMD Opteron(tm) Processor 2210 AuthenticAMD GNU/Linux # php foobar.php dir not a link same lstat(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 access(/tmp/pear, F_OK) = 0 lstat(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat(/tmp/link-test, {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0 readlink(/tmp/link-test, /tmp/pear, 4096) = 9 lstat(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 access(/tmp/pear, F_OK) = 0 unlink(/tmp/link-test)= 0 lstat(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat(/tmp/link-test, 0x7fff3f48fb70) = -1 ENOENT (No such file or directory) lstat(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 symlink(/tmp/pear, /tmp/link-test) = 0 lstat(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat(/tmp/link-test, {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0 readlink(/tmp/link-test, /tmp/pear, 4096) = 9 lstat(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 lstat(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b906b634000 write(1, dir, 3dir) = 3 write(1, \n, 1 ) = 1 write(1, not a link, 10not a link) = 10 write(1, \n, 1 ) = 1 lstat(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 stat(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 write(1, same, 4same) = 4 32-bit Gentoo however acts as expected. $ uname -a Linux deadpool 2.6.11-gentoo-r6 #1 SMP Thu Apr 14 07:52:09 EDT 2005 i686 Intel(R) Xeon(TM) CPU 3.20GHz GenuineIntel GNU/Linux php test.php link link differ access(/tmp/pear, F_OK) = 0 access(/tmp/link-test, F_OK) = 0 unlink(/tmp/link-test)= 0 time(NULL) = 1179959743 lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=14416, ...}) = 0 lstat64(/tmp/link-test, 0xbfff5e4c) = -1 ENOENT (No such file or directory) time(NULL) = 1179959743 lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=14416, ...}) = 0 lstat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=72, ...}) = 0 symlink(/tmp/pear, /tmp/link-test) = 0 lstat64(/tmp/link-test, {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0 fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb78b1000 write(1, link, 4link) = 4 write(1, \n, 1 ) = 1 write(1, link, 4link) = 4 write(1, \n, 1 ) = 1 stat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=72, ...}) = 0 write(1, differ, 6differ) = 6 Rasmus Lerdorf wrote: lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/link-test, 0xbff229ec) = -1 ENOENT (No such file or directory) lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 symlink(/tmp/pear, /tmp/link-test) = 0 lstat64(/tmp/link-test, {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0 write(1, link, 4link) = 4 write(1, \n, 1 ) = 1 write(1, link, 4link)
Re: [PHP-DEV] Re: Still having lstat trouble
Tijnema wrote: On 5/24/07, Rasmus Lerdorf [EMAIL PROTECTED] wrote: Which filesystems is /tmp on on the various boxes? tmpfs related perhaps? -Rasmus Nice idea, but I don't think it's a problem there, I think it's a configuration problem. I've build my own linux, and so I have all configuration like I want. I'm running php-5.2.3RC1 as Apache 2.2.3 module. I've split up my USB stick in a few file systems, and they worked all for me, except for msdosvfat file systems, as they don't support symlinks. Test results here: http://86.86.80.41/fs_test.php and source for the test is here: http://86.86.80.41/fs_test.phps Mount options then perhaps? There is a nosymlink mount option which would certainly cause this. -Rasmus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: Still having lstat trouble
Hi, how about gdb php Regards, Oliver Am Freitag, 25. Mai 2007 19:50 schrieb Arnold Daniels: Hi again, No, the symlinks work fine in the shell and with all other applications. Also I haven't mounted with any options other than 'notail'. Please have a look at the e-mail I've send a few hours ago. [EMAIL PROTECTED]:~$ mount /dev/sda3 on / type reiserfs (rw,notail) . Best regards, Arnold Rasmus Lerdorf wrote: Tijnema wrote: On 5/24/07, Rasmus Lerdorf [EMAIL PROTECTED] wrote: Which filesystems is /tmp on on the various boxes? tmpfs related perhaps? -Rasmus Nice idea, but I don't think it's a problem there, I think it's a configuration problem. I've build my own linux, and so I have all configuration like I want. I'm running php-5.2.3RC1 as Apache 2.2.3 module. I've split up my USB stick in a few file systems, and they worked all for me, except for msdosvfat file systems, as they don't support symlinks. Test results here: http://86.86.80.41/fs_test.php and source for the test is here: http://86.86.80.41/fs_test.phps Mount options then perhaps? There is a nosymlink mount option which would certainly cause this. -Rasmus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: Still having lstat trouble
On 5/25/07, Oliver Block [EMAIL PROTECTED] wrote: Hi, how about gdb php Regards, Oliver He said that the problem only occured with the Apache 2 SAPI, so the gdb is for the PHP CLI. Tijnema Am Freitag, 25. Mai 2007 19:50 schrieb Arnold Daniels: Hi again, No, the symlinks work fine in the shell and with all other applications. Also I haven't mounted with any options other than 'notail'. Please have a look at the e-mail I've send a few hours ago. [EMAIL PROTECTED]:~$ mount /dev/sda3 on / type reiserfs (rw,notail) . Best regards, Arnold Rasmus Lerdorf wrote: Tijnema wrote: On 5/24/07, Rasmus Lerdorf [EMAIL PROTECTED] wrote: Which filesystems is /tmp on on the various boxes? tmpfs related perhaps? -Rasmus Nice idea, but I don't think it's a problem there, I think it's a configuration problem. I've build my own linux, and so I have all configuration like I want. I'm running php-5.2.3RC1 as Apache 2.2.3 module. I've split up my USB stick in a few file systems, and they worked all for me, except for msdosvfat file systems, as they don't support symlinks. Test results here: http://86.86.80.41/fs_test.php and source for the test is here: http://86.86.80.41/fs_test.phps Mount options then perhaps? There is a nosymlink mount option which would certainly cause this. -Rasmus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: Still having lstat trouble
Am Freitag, 25. Mai 2007 20:30 schrieben Sie: He said that the problem only occured with the Apache 2 SAPI, so the gdb is for the PHP CLI. You can also use it with apache2 sapi. But then you need to do (Debian) gdb /usr/sbin/apache2 and then run -k start If you set a break to zif_... that should work. Regards, Oliver Tijnema Am Freitag, 25. Mai 2007 19:50 schrieb Arnold Daniels: Hi again, No, the symlinks work fine in the shell and with all other applications. Also I haven't mounted with any options other than 'notail'. Please have a look at the e-mail I've send a few hours ago. [EMAIL PROTECTED]:~$ mount /dev/sda3 on / type reiserfs (rw,notail) . Best regards, Arnold Rasmus Lerdorf wrote: Tijnema wrote: On 5/24/07, Rasmus Lerdorf [EMAIL PROTECTED] wrote: Which filesystems is /tmp on on the various boxes? tmpfs related perhaps? -Rasmus Nice idea, but I don't think it's a problem there, I think it's a configuration problem. I've build my own linux, and so I have all configuration like I want. I'm running php-5.2.3RC1 as Apache 2.2.3 module. I've split up my USB stick in a few file systems, and they worked all for me, except for msdosvfat file systems, as they don't support symlinks. Test results here: http://86.86.80.41/fs_test.php and source for the test is here: http://86.86.80.41/fs_test.phps Mount options then perhaps? There is a nosymlink mount option which would certainly cause this. -Rasmus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: Still having lstat trouble
Oliver Block wrote: Hi Arnold, Am Samstag, 26. Mai 2007 00:28 schrieben Sie: If I need to run gdb please let me know, I did a gdb and on my system (debian, CLI). filetype returns 'dir' as well. my code was php -r 'filetype(/tmp/link-test);' Where /tmp/link-test is a link to a directory /tmp/pear. This is some of the output: I set a breakpoint to php_stat. You can see the parameters passed to it. Breakpoint 1, php_stat (filename=0xb78f4584 /tmp/link-test, filename_length=14, type=8, return_value=0xb78f5044, tsrm_ls=0x87b8018) at /usr/local/src/php-5.2.2/ext/standard/filestat.c:730 Some of the steps beginning at line 851 (standard/filestat.c, php_stat()) 851 switch (type) { (gdb) 881 if (S_ISLNK(ssb.sb.st_mode)) { (gdb) 884 switch(ssb.sb.st_mode S_IFMT) { (gdb) 887 case S_IFDIR: RETURN_STRING(dir, 1); (gdb) 981 } Right, so the (ssb.sb.st_mode S_IFMT) is S_IFDIR which is basically the OS telling us that it is a directory. I don't see what we can do if the OS is not telling us the right thing. The filestat code is a bit convoluted trying to deal with lots of strange operating systems, but this part of it seems pretty clear. -Rasmus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: Still having lstat trouble
Am Samstag, 26. Mai 2007 02:29 schrieben Sie: Right, so the (ssb.sb.st_mode S_IFMT) is S_IFDIR which is basically the OS telling us that it is a directory. I don't see what we can do if the OS is not telling us the right thing. The filestat code is a bit convoluted trying to deal with lots of strange operating systems, but this part of it seems pretty clear. OK. But let me mention (without knowing the source code of stat) that stat --format=%F /tmp/link-test returns 'symbolic link' So there must be different methods to find out!? Regards, Oliver -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: Still having lstat trouble
I'm currently running linux kernel v2.6.20. So to test if that might be causing trouble, I re-installed and booted with kernel v2.6.17, which I was using under Ubuntu edgy (6.10). But it gave exactly the same results. Also, if the problem was in the OS, wouldn't there be a single lstat call? The strace (I've just send) shows that there is an lstat, readlink and than another lstat call. Running it in the command line, only shows 1 lstat. Best regards, Arnold Oliver Block wrote: Am Samstag, 26. Mai 2007 02:29 schrieben Sie: Right, so the (ssb.sb.st_mode S_IFMT) is S_IFDIR which is basically the OS telling us that it is a directory. I don't see what we can do if the OS is not telling us the right thing. The filestat code is a bit convoluted trying to deal with lots of strange operating systems, but this part of it seems pretty clear. OK. But let me mention (without knowing the source code of stat) that stat --format=%F /tmp/link-test returns 'symbolic link' So there must be different methods to find out!? Regards, Oliver
[PHP-DEV] Re: Still having lstat trouble
I'm getting similar results from a RHEL 4 box we have here, its running 5.2.3-dev. [EMAIL PROTECTED] [/tmp] # cat /etc/redhat-release Red Hat Enterprise Linux ES release 4 (Nahant Update 4) [EMAIL PROTECTED] [~] # uname -a Linux scarlet 2.6.9-42.0.2.ELsmp #1 SMP Thu Aug 17 18:00:32 EDT 2006 i686 i686 i386 GNU/Linux [EMAIL PROTECTED] [/tmp] # php test.php dir not a link same strace for the during execution is. lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/link-test, {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0 readlink(/tmp/link-test, /tmp/pear, 4096) = 9 lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 lstat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 write(1, dir, 3dir) = 3 write(1, \n, 1) = 1 write(1, not a link, 10not a link) = 10 write(1, \n, 1) = 1 time(NULL) = 1179958429 lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 stat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 write(1, same, 4same) = 4 Scott Arnold Daniels wrote: Hi, I've posted this problem some time ago, but never got a real answer and it is still bothering me a lot. My problem is that PHP does not recognize a symlink as a symlink. It seems to be dereferenced by functions like 'lstat', 'is_link' and 'filetype'. And that isn't supposed to happen. The bug http://bugs.php.net/bug.php?id=17128 describes my problem exactly, but is marked as bogus. Well this problem sure isn't bogus for me. I'm having this problem, since I've updated from Ubuntu Edgy to Feisty. Before that all worked fine. Please note that I've not installed PHP from a repository, but I build the latest CVS version of PHP 5 regularly myself. Also this problem only occurs in the Apache 2 SAPI, not in the CLI version. Let me give an example, to make the problem clear. ? $symlink = '/tmp/link-test'; $target = '/tmp/pear'; if (!file_exists($target)) trigger_error(Target '$target' does not exist, E_USER_ERROR); if (file_exists($symlink) !unlink($symlink)) trigger_error(Could not delete '$symlink', E_USER_ERROR); symlink($target, $symlink); clearstatcache(); /* This should output 'link' */ echo filetype($symlink), \n; /* This should output 'link' */ echo is_link($symlink) ? 'link' : 'not a link', \n; /* This should output 'differ' */ echo lstat($symlink) === stat($target) ? 'same' : 'differ'; ? Expected: link link differ Actual: dir not a link same I understand that if I post this as a bug, it is tested, can't be reproduced and marked as bogus. Therefore, I could appreciate it if someone could please point me towards a way to pinpoint the problem. I've run a strace already, but can't notice anything weird. Thanks for any help, Arnold -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: Still having lstat trouble
lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/link-test, 0xbff229ec) = -1 ENOENT (No such file or directory) lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 symlink(/tmp/pear, /tmp/link-test) = 0 lstat64(/tmp/link-test, {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0 write(1, link, 4link) = 4 write(1, \n, 1 ) = 1 write(1, link, 4link) = 4 write(1, \n, 1 ) = 1 stat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 write(1, differ, 6differ) = 6 Scott MacVicar wrote: I'm getting similar results from a RHEL 4 box we have here, its running 5.2.3-dev. [EMAIL PROTECTED] [/tmp] # cat /etc/redhat-release Red Hat Enterprise Linux ES release 4 (Nahant Update 4) [EMAIL PROTECTED] [~] # uname -a Linux scarlet 2.6.9-42.0.2.ELsmp #1 SMP Thu Aug 17 18:00:32 EDT 2006 i686 i686 i386 GNU/Linux [EMAIL PROTECTED] [/tmp] # php test.php dir not a link same strace for the during execution is. lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/link-test, {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0 That means /tmp/link-test exists already, otherwise lstat returns -1. Here is what I see if the link already exists when I run my script: access(/tmp/pear, F_OK) = 0 access(/tmp/link-test, F_OK) = 0 unlink(/tmp/link-test)= 0 lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/link-test, 0xbff229ec) = -1 ENOENT (No such file or directory) lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 symlink(/tmp/pear, /tmp/link-test) = 0 lstat64(/tmp/link-test, {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0 write(1, link, 4link) = 4 write(1, \n, 1 ) = 1 write(1, link, 4link) = 4 write(1, \n, 1 ) = 1 stat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 write(1, differ, 6differ) = 6 So did you leave out those access() calls, and did they fail, or did the unlink() fail perhaps? -Rasmus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: Still having lstat trouble
Miscopied, a full strace is: lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 access(/tmp/pear, F_OK) = 0 time(NULL) = 1179959483 lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/link-test, {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0 readlink(/tmp/link-test, /tmp/pear, 4096) = 9 lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 access(/tmp/pear, F_OK) = 0 unlink(/tmp/link-test)= 0 time(NULL) = 1179959483 lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/link-test, 0xbff2137c) = -1 ENOENT (No such file or directory) time(NULL) = 1179959483 lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 symlink(/tmp/pear, /tmp/link-test) = 0 time(NULL) = 1179959483 lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/link-test, {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0 readlink(/tmp/link-test, /tmp/pear, 4096) = 9 lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 lstat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 write(1, dir, 3dir) = 3 write(1, \n, 1 ) = 1 write(1, not a link, 10not a link) = 10 write(1, \n, 1 ) = 1 time(NULL) = 1179959483 lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 stat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 write(1, same, 4same) = 4 SELinux is disabled on the box. Scott Rasmus Lerdorf wrote: lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/link-test, 0xbff229ec) = -1 ENOENT (No such file or directory) lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 symlink(/tmp/pear, /tmp/link-test) = 0 lstat64(/tmp/link-test, {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0 write(1, link, 4link) = 4 write(1, \n, 1 ) = 1 write(1, link, 4link) = 4 write(1, \n, 1 ) = 1 stat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 write(1, differ, 6differ) = 6 Scott MacVicar wrote: I'm getting similar results from a RHEL 4 box we have here, its running 5.2.3-dev. [EMAIL PROTECTED] [/tmp] # cat /etc/redhat-release Red Hat Enterprise Linux ES release 4 (Nahant Update 4) [EMAIL PROTECTED] [~] # uname -a Linux scarlet 2.6.9-42.0.2.ELsmp #1 SMP Thu Aug 17 18:00:32 EDT 2006 i686 i686 i386 GNU/Linux [EMAIL PROTECTED] [/tmp] # php test.php dir not a link same strace for the during execution is. lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/link-test, {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0 That means /tmp/link-test exists already, otherwise lstat returns -1. Here is what I see if the link already exists when I run my script: access(/tmp/pear, F_OK) = 0 access(/tmp/link-test, F_OK) = 0 unlink(/tmp/link-test)= 0 lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/link-test, 0xbff229ec) = -1 ENOENT (No such file or directory) lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 symlink(/tmp/pear, /tmp/link-test) = 0 lstat64(/tmp/link-test, {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0 write(1, link, 4link) = 4 write(1, \n, 1 ) = 1 write(1, link, 4link) = 4 write(1, \n, 1 ) = 1 stat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 write(1, differ, 6differ) = 6 So did you leave out those access() calls, and did they fail, or did the unlink() fail perhaps? -Rasmus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: Still having lstat trouble
Works as expected on my Mac (no strace on my Mac). On my Gentoo 64-bit server, I get the wrong data from Apache2 and CLI. On my 32-bit Gentoo server, without Apache 2, I get the correct answer from apache and cli. On my 32-bit Gentoo server with Apache 2 I get a wrong answer from Apache and cli. We build our PHP on these servers with the same options via emerge. The only difference is Apache 2. What the hell? # uname -a Linux proxy1 2.6.18-gentoo-r6 #1 SMP Thu Feb 8 07:32:31 EST 2007 x86_64 Dual-Core AMD Opteron(tm) Processor 2210 AuthenticAMD GNU/Linux # php foobar.php dir not a link same lstat(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 access(/tmp/pear, F_OK) = 0 lstat(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat(/tmp/link-test, {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0 readlink(/tmp/link-test, /tmp/pear, 4096) = 9 lstat(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 access(/tmp/pear, F_OK) = 0 unlink(/tmp/link-test)= 0 lstat(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat(/tmp/link-test, 0x7fff3f48fb70) = -1 ENOENT (No such file or directory) lstat(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 symlink(/tmp/pear, /tmp/link-test) = 0 lstat(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat(/tmp/link-test, {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0 readlink(/tmp/link-test, /tmp/pear, 4096) = 9 lstat(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 lstat(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b906b634000 write(1, dir, 3dir) = 3 write(1, \n, 1 ) = 1 write(1, not a link, 10not a link) = 10 write(1, \n, 1 ) = 1 lstat(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 stat(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 write(1, same, 4same) = 4 32-bit Gentoo however acts as expected. $ uname -a Linux deadpool 2.6.11-gentoo-r6 #1 SMP Thu Apr 14 07:52:09 EDT 2005 i686 Intel(R) Xeon(TM) CPU 3.20GHz GenuineIntel GNU/Linux php test.php link link differ access(/tmp/pear, F_OK) = 0 access(/tmp/link-test, F_OK) = 0 unlink(/tmp/link-test)= 0 time(NULL) = 1179959743 lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=14416, ...}) = 0 lstat64(/tmp/link-test, 0xbfff5e4c) = -1 ENOENT (No such file or directory) time(NULL) = 1179959743 lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=14416, ...}) = 0 lstat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=72, ...}) = 0 symlink(/tmp/pear, /tmp/link-test) = 0 lstat64(/tmp/link-test, {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0 fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb78b1000 write(1, link, 4link) = 4 write(1, \n, 1 ) = 1 write(1, link, 4link) = 4 write(1, \n, 1 ) = 1 stat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=72, ...}) = 0 write(1, differ, 6differ) = 6 Rasmus Lerdorf wrote: lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/link-test, 0xbff229ec) = -1 ENOENT (No such file or directory) lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 symlink(/tmp/pear, /tmp/link-test) = 0 lstat64(/tmp/link-test, {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0 write(1, link, 4link) = 4 write(1, \n, 1 ) = 1 write(1, link, 4link) = 4 write(1, \n, 1 ) = 1 stat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 write(1, differ, 6differ) = 6 Scott MacVicar wrote: I'm getting similar results from a RHEL 4 box we have here, its running 5.2.3-dev. [EMAIL PROTECTED] [/tmp] # cat /etc/redhat-release Red Hat Enterprise Linux ES release 4 (Nahant Update 4) [EMAIL PROTECTED] [~] # uname -a Linux scarlet 2.6.9-42.0.2.ELsmp #1 SMP Thu Aug 17 18:00:32 EDT 2006 i686 i686 i386 GNU/Linux [EMAIL PROTECTED] [/tmp] # php test.php dir not a link same strace for the during execution is. lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/link-test,
Re: [PHP-DEV] Re: Still having lstat trouble
Which filesystems is /tmp on on the various boxes? tmpfs related perhaps? -Rasmus Brian Moon wrote: Works as expected on my Mac (no strace on my Mac). On my Gentoo 64-bit server, I get the wrong data from Apache2 and CLI. On my 32-bit Gentoo server, without Apache 2, I get the correct answer from apache and cli. On my 32-bit Gentoo server with Apache 2 I get a wrong answer from Apache and cli. We build our PHP on these servers with the same options via emerge. The only difference is Apache 2. What the hell? # uname -a Linux proxy1 2.6.18-gentoo-r6 #1 SMP Thu Feb 8 07:32:31 EST 2007 x86_64 Dual-Core AMD Opteron(tm) Processor 2210 AuthenticAMD GNU/Linux # php foobar.php dir not a link same lstat(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 access(/tmp/pear, F_OK) = 0 lstat(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat(/tmp/link-test, {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0 readlink(/tmp/link-test, /tmp/pear, 4096) = 9 lstat(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 access(/tmp/pear, F_OK) = 0 unlink(/tmp/link-test)= 0 lstat(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat(/tmp/link-test, 0x7fff3f48fb70) = -1 ENOENT (No such file or directory) lstat(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 symlink(/tmp/pear, /tmp/link-test) = 0 lstat(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat(/tmp/link-test, {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0 readlink(/tmp/link-test, /tmp/pear, 4096) = 9 lstat(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 lstat(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b906b634000 write(1, dir, 3dir) = 3 write(1, \n, 1 ) = 1 write(1, not a link, 10not a link) = 10 write(1, \n, 1 ) = 1 lstat(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 stat(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 write(1, same, 4same) = 4 32-bit Gentoo however acts as expected. $ uname -a Linux deadpool 2.6.11-gentoo-r6 #1 SMP Thu Apr 14 07:52:09 EDT 2005 i686 Intel(R) Xeon(TM) CPU 3.20GHz GenuineIntel GNU/Linux php test.php link link differ access(/tmp/pear, F_OK) = 0 access(/tmp/link-test, F_OK) = 0 unlink(/tmp/link-test)= 0 time(NULL) = 1179959743 lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=14416, ...}) = 0 lstat64(/tmp/link-test, 0xbfff5e4c) = -1 ENOENT (No such file or directory) time(NULL) = 1179959743 lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=14416, ...}) = 0 lstat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=72, ...}) = 0 symlink(/tmp/pear, /tmp/link-test) = 0 lstat64(/tmp/link-test, {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0 fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb78b1000 write(1, link, 4link) = 4 write(1, \n, 1 ) = 1 write(1, link, 4link) = 4 write(1, \n, 1 ) = 1 stat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=72, ...}) = 0 write(1, differ, 6differ) = 6 Rasmus Lerdorf wrote: lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/link-test, 0xbff229ec) = -1 ENOENT (No such file or directory) lstat64(/tmp, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 lstat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 symlink(/tmp/pear, /tmp/link-test) = 0 lstat64(/tmp/link-test, {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0 write(1, link, 4link) = 4 write(1, \n, 1 ) = 1 write(1, link, 4link) = 4 write(1, \n, 1 ) = 1 stat64(/tmp/pear, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 write(1, differ, 6differ) = 6 Scott MacVicar wrote: I'm getting similar results from a RHEL 4 box we have here, its running 5.2.3-dev. [EMAIL PROTECTED] [/tmp] # cat /etc/redhat-release Red Hat Enterprise Linux ES release 4 (Nahant Update 4) [EMAIL PROTECTED] [~] # uname -a Linux scarlet 2.6.9-42.0.2.ELsmp #1 SMP Thu Aug 17 18:00:32 EDT 2006 i686 i686 i386 GNU/Linux
Re: [PHP-DEV] Re: Still having lstat trouble
Rasmus Lerdorf wrote: Which filesystems is /tmp on on the various boxes? tmpfs related perhaps? On all my systems, /tmp is just part of / which is ReiserFS. -- Brian Moon Senior Developer -- http://dealnews.com/ It's good to be cheap =) -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php