Hi,

I've got a bug with is_link and lstats. Any symlinks not created in the current session, will not be read. This only occurs in the Apache 2 SAPI version, not in the CLI version.

Script:
/<?
   $symlink = '/tmp/link-test';
   if (file_exists($symlink)) unlink($symlink);
   symlink('/tmp/pear', $symlink);
echo (file_exists($symlink) ? is_link($symlink) ? "Correct" : "ERROR" : "Couldn't create the link"), "<br/>\n";

   $symlink = '/tmp/link-persist';
   if (!file_exists($symlink)) symlink('/tmp/pear', $symlink);
echo (file_exists($symlink) ? is_link($symlink) ? "Correct" : "ERROR" : "Couldn't create the link"), "<br/>\n";
?>/

First run:
/    Correct
   Correct
/
Second run:
/    Correct
   ERROR/

Next runs:
/    Correct
   ERROR

/I've recently start using the daily snapshots op PHP, but I also tried it on version 5.2.1, which shows the same result. It used to work just fine, so I'm sure this isn't the expected result. I've recently upgraded from Ubuntu Edgy (6.10) to Feisty (7.04), with kernel and apache update, so I believe that the problem is related to that.

I've straced the process (see attachment), but I can't pinpoint the problem. This is a big issue for me, can anyone point me in the right direction to find the source of this problem.

Thanks,
Arnold
Process 1190 attached - interrupt to quit
restart_syscall(<... resuming interrupted call ...>) = 0
time(NULL)                              = 1178133076
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=808, ...}) = 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=808, ...}) = 0
lstat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=72, ...}) = 0
access("/tmp/pear", F_OK)               = 0
unlink("/tmp/link-test")                = 0
time(NULL)                              = 1178133076
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=776, ...}) = 0
lstat64("/tmp/link-test", 0xbf989bfc)   = -1 ENOENT (No such file or directory)
time(NULL)                              = 1178133076
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=776, ...}) = 0
lstat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=72, ...}) = 0
symlink("/tmp/pear", "/tmp/link-test")  = 0
time(NULL)                              = 1178133076
access("/tmp/link-test", F_OK)          = 0
time(NULL)                              = 1178133076
lstat64("/tmp/link-test", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0
time(NULL)                              = 1178133076
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=808, ...}) = 0
lstat64("/tmp/link-persist", {st_mode=S_IFLNK|0777, st_size=9, ...}) = 0
readlink("/tmp/link-persist", "/tmp/pear", 4096) = 9
lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=808, ...}) = 0
lstat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=72, ...}) = 0
access("/tmp/pear", F_OK)               = 0
time(NULL)                              = 1178133076
access("/tmp/pear", F_OK)               = 0
time(NULL)                              = 1178133076
lstat64("/tmp/pear", {st_mode=S_IFDIR|0755, st_size=72, ...}) = 0
time(NULL)                              = 1178133076
stat64("/", {st_mode=S_IFDIR|0755, st_size=720, ...}) = 0
setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={0, 0}}, NULL) = 0
writev(16, [{"18\r\n", 4}, {"Correct<br/>\nERROR<br/>\n", 24}, {"\r\n", 2}, 
{"0\r\n\r\n", 5}], 4) = 35
read(16, "", 8000)                      = 0
gettimeofday({1178133076, 170817}, NULL) = 0
write(13, "127.0.0.1 - - [02/May/2007:21:10"..., 181) = 181
gettimeofday({1178133076, 171007}, NULL) = 0
times({tms_utime=905, tms_stime=2096, tms_cutime=0, tms_cstime=0}) = 1746189524
gettimeofday({1178133076, 171152}, NULL) = 0
gettimeofday({1178133076, 171224}, NULL) = 0
gettimeofday({1178133076, 171283}, NULL) = 0
shutdown(16, 1 /* send */)              = 0
poll([{fd=16, events=POLLIN, revents=POLLIN|POLLHUP}], 1, 2000) = 1
read(16, "", 512)                       = 0
close(16)                               = 0
read(4, 0xbf991507, 1)                  = -1 EAGAIN (Resource temporarily 
unavailable)
gettimeofday({1178133076, 171700}, NULL) = 0
accept(3,  <unfinished ...>
Process 1190 detached

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to