Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:40410 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74609 invoked from network); 9 Sep 2008 14:52:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Sep 2008 14:52:03 -0000 Authentication-Results: pb1.pair.com header.from=arnaud.lb@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=arnaud.lb@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 72.14.220.154 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: arnaud.lb@gmail.com X-Host-Fingerprint: 72.14.220.154 fg-out-1718.google.com Received: from [72.14.220.154] ([72.14.220.154:17121] helo=fg-out-1718.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C5/11-23799-29D86C84 for ; Tue, 09 Sep 2008 10:52:02 -0400 Received: by fg-out-1718.google.com with SMTP id 16so1858587fgg.23 for ; Tue, 09 Sep 2008 07:51:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date :user-agent:cc:references:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:message-id; bh=Tsz4yggqeVLfPcH47kHls5Ou0DvBb10B0NPUoeUFufY=; b=jz4flj8YuPoqpNDu/i3bDFRUFk1ROVETvqUdzGifyJNeS9d3xlHQdljHzoPiFWOKfF O2Msw1jL5jfoW/0FZdcB24w8DDm+LzrCIzIp4CIl0VbztxMMvpNOzfFYCtwrSMRSOP8a X9wykP3PzePQWjcrtg3GmgoQYuJ+9qG4gINoc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:cc:references:in-reply-to :mime-version:content-type:content-transfer-encoding :content-disposition:message-id; b=SQqLvQiAMqu4dqeuTAIKTBzkSXldovdpte90D1oZpHMjvW7Ff6GV3O/JX49xP3HSYM ZoxJFc7Uk0ghMxZ55AAc0f7zeN63aNx1tTJIOE72kc2NxamXbFfnXcPaneny5ELhOatD 9mICIBTcgqow1dPcySyj3Ciot/wX1YwXl4wB0= Received: by 10.180.223.8 with SMTP id v8mr1126631bkg.53.1220971919213; Tue, 09 Sep 2008 07:51:59 -0700 (PDT) Received: from 207-177-41-213.getmyip.com ( [213.41.177.207]) by mx.google.com with ESMTPS id g28sm5255086fkg.8.2008.09.09.07.51.57 (version=SSLv3 cipher=RC4-MD5); Tue, 09 Sep 2008 07:51:58 -0700 (PDT) To: internals@lists.php.net Date: Tue, 9 Sep 2008 16:51:54 +0200 User-Agent: KMail/1.10.0 (Linux/2.6.26-1-amd64; KDE/4.1.0; x86_64; ; ) Cc: "Alexey Zakhlestin" , "Christian Schneider" References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <200809091651.55770.arnaud.lb@gmail.com> Subject: Re: [PHP-DEV] Opinion needed (bug #45928) From: arnaud.lb@gmail.com (Arnaud Le Blanc) Hi, On Tuesday 09 September 2008 14:39:05 Alexey Zakhlestin wrote: > http://bugs.php.net/bug.php?id=45928 > > Christian Schneider wrote: > > > I had a quick look at this bug and found the problem to be in > > Zend/zend_stream.c function zend_stream_fsize(): It uses fstat() to > > determine the filesize which on MacOS X for pipes returns either 0 (my > > interpretation: no data from the pipe ready yet) or a number up to 16384 > > (my interpretation: data from the pipe ready but the maximum buffer size > > is 16k). > > > > I see several solutions but I'm not sure which is the desired one: > > - return 0 (size unknown) if the file is a pipe (or socket, ...) > > - return 0 if the file is not a regular file (or symlink, dir?) > > - look into a way of determining EOF reached > > > > As a quick test I changed > > return buf.st_size; > > in function zend_stream_fsize() to > > return 0; > > and cat 30k.php | php worked after that. > > It seems to be a good solution. zend_stream seems to already rely on size == 0 for non-regular files and falls back to something like "while (!feof){ read }" in that case. The following may (no MacOS X to test) fix the problem by returning 0 from zend_stream_fsize() when the file descriptor is not a regular file: http://arnaud.lb.s3.amazonaws.com/45928.patch Regards, Arnaud