Re: Re: Still having lstat trouble

From: Date: Fri, 25 May 2007 22:30:36 +0000
Subject: Re: Re: Still having lstat trouble
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-29782@lists.php.net to get a copy of this message
Hi again, I've used strace and after simplifying the test and looking at it more closely, I did see something strange. The apache process does an lstat, reads the link and then does an lstat on real file. Perhaps this was already recognized by others, but I didn't see a confirmation of this in any of the e-mails. If I need to run gdb please let me know, though it might be a bit to complicated for me a php internals newbie (I can make my own simple extensions, but the knowledge ends there). <?php echo getmypid(); flush(); sleep(10); /* This should output link */ echo filetype('/tmp/test-php-bug-simple-link'), "\n"; ?> When I run the code in the command line (strace php simple.php 2> /tmp/php-bug.cli.trace): .... read(3, "<?php\n echo getmypid();\n f"..., 8192) = 153 read(3, "", 4096) = 0 read(3, "", 8192) = 0 close(3) = 0 munmap(0xb7590000, 4096) = 0 write(1, "9469", 4) = 4 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0 rt_sigaction(SIGCHLD, NULL, {SIG_DFL}, 8) = 0 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 nanosleep({10, 0}, {10, 0}) = 0 lstat64("/tmp/test-php-bug-simple-link", {st_mode=S_IFLNK|0777, st_size=19, ...}) = 0 write(1, "link", 4) = 4 write(1, "\n", 1) = 1 close(2) = 0 close(1) = 0 close(0) = 0 setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={0, 0}}, NULL) = 0 exit_group(0) = ? Process 9469 detached But when I run the same code in Apache (strace -p8753 2> /tmp/php-bug.apache2.trace): Process 8753 attached - interrupt to quit restart_syscall(<... resuming interrupted call ...>) = 0 time(NULL) = 1180130951 lstat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=1160, ...}) = 0 lstat64("/tmp/test-php-bug-simple-link", {st_mode=S_IFLNK|0777, st_size=19, ...}) = 0 readlink("/tmp/test-php-bug-simple-link", "test-php-bug-simple", 4096) = 19 lstat64("/tmp/test-php-bug-simple", {st_mode=S_IFREG|0644, st_size=12, ...}) = 0 lstat64("/tmp/test-php-bug-simple", {st_mode=S_IFREG|0644, st_size=12, ...}) = 0 time(NULL) = 1180130951 stat64("/", {st_mode=S_IFDIR|0755, st_size=600, ...}) = 0 setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={0, 0}}, NULL) = 0 writev(22, [{"5\r\n", 3}, {"file\n", 5}, {"\r\n", 2}, {"0\r\n\r\n", 5}], 4) = 15 read(22, "", 8000) = 0 write(14, "127.0.0.1 - - [26/May/2007:00:09"..., 181) = 181 gettimeofday({1180130951, 718114}, NULL) = 0 shutdown(22, 1 /* send */) = 0 poll([{fd=22, events=POLLIN, revents=POLLIN|POLLHUP}], 1, 2000) = 1 read(22, "", 512) = 0 close(22) = 0 read(4, 0xbff61af7, 1) = -1 EAGAIN (Resource temporarily unavailable) accept(3, <unfinished ...> Process 8753 detached Best regards, Arnold Oliver Block wrote: > 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. >>>> >>>> arnold@arnold-laptop:~$ mount >>>> /dev/sda3 on / type reiserfs (rw,notail) >>>> ..... >>>> >>>> Best regards, >>>> Arnold >>>> >>>> Rasmus Lerdorf wrote: >>>> >>>>> Tijnema wrote: >>>>> >>>>>> On 5/24/07, Rasmus Lerdorf <rasmus@lerdorf.com> 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 msdos&vfat 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 >>> > >

« previous php.internals (#29782) next »