Hi!

> Is include supposed to take a LOCK_EX somehow? I can neither see that in php-
> src (5.4.9) nor APC-trunk, doing a cursory grepping.

I'm not sure how any lock would help, since locks are optional, meaning
you still can do the same thing without the locks.

> The prudent approach, which should avoid the problem altogether and not need 
> any LOCK_EX, dictates to ALWAYS write a temporary file (new inode), then 
> rename it when the write completely succeeds. Otherwise any reader, like 
> "include", runs the chance of seeing a partially written file, and even 
> without include using mmap internally, syntax errors would happen from time 
> to 
> time.

This looks like a very good advice, regardless of bus errors.

> So, my conclusion would be that it is the code snippet above, and not any 
> part 
> of PHP or the kernel, that is at fault.

We could probably add an option to skip mmaps, but since as you pointed
out that doesn't really fix the issue completely, better idea indeed is
to fix the code.

-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

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

Reply via email to