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
>>>
>>> [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