Re: Opinion needed (bug #45928)
| From: | Arnaud Le Blanc | Date: | Tue, 09 Sep 2008 15:59:39 +0000 |
| Subject: | Re: Opinion needed (bug #45928) | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-40415@lists.php.net to get a copy of this message | ||
Hi,
On Tuesday 09 September 2008 17:35:54 Christian Schneider wrote:
> Arnaud Le Blanc wrote:
> > 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
>
> Your patch:
> +#ifdef S_ISREG
> + if (!S_ISREG(buf.st_mode)) {
> + return 0;
> + }
> +#endif
> might prevent mmap-ing symbolically linked files, I'll do a quick test
> when I'm at home.
No, fstat() will resolve the link and stat the file the link points to. And I
believe script paths are fully resolved before being opened.
Anyway, given the fstat() Linux man page, its a bug to return st_size when the
file is not a regular file.
> Not sure if we should also check for symbolic links (and what they point
> to) or if that's overkill because the performance penalty is small
> enough anyway.
>
> Anyone from the core developers got an opinion here?
>
> - Chris
>
Regards,
Arnaud