Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:29785 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28561 invoked by uid 1010); 26 May 2007 00:29:57 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 28546 invoked from network); 26 May 2007 00:29:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 May 2007 00:29:57 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 204.11.219.139 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 204.11.219.139 mail.lerdorf.com Received: from [204.11.219.139] ([204.11.219.139:51965] helo=mail.lerdorf.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5A/44-23498-38F77564 for ; Fri, 25 May 2007 20:29:57 -0400 Received: from trainburn-lm-corp-yahoo-com.local (032-278-099.area1.spcsdns.net [70.0.155.185]) (authenticated bits=0) by mail.lerdorf.com (8.14.1/8.14.1/Debian-4) with ESMTP id l4Q0Tl0h032562 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 25 May 2007 17:29:50 -0700 Message-ID: <46577F7A.6000200@lerdorf.com> Date: Fri, 25 May 2007 17:29:46 -0700 User-Agent: Thunderbird 2.0.0.0 (Macintosh/20070326) MIME-Version: 1.0 To: Oliver Block CC: internals@lists.php.net References: <4638E608.2090202@adaniels.nl> <200705252357.28302.lists@block-online.eu> <46576308.5070108@adaniels.nl> <200705260208.18082.lists@block-online.eu> In-Reply-To: <200705260208.18082.lists@block-online.eu> X-Enigmail-Version: 0.95.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.90.2/3302/Fri May 25 12:37:03 2007 on colo.lerdorf.com X-Virus-Status: Clean Subject: Re: [PHP-DEV] Re: Still having lstat trouble From: rasmus@lerdorf.com (Rasmus Lerdorf) 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