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