lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, 2005-05-23 at 13:26 +0100, David Given wrote:
> On Monday 23 May 2005 03:33, William Trenker wrote:
> [...]
> >     int ok = (pclose(f) != -1) || (fclose(f) == 0);     // <<<---
> > PROBLEM IS HERE
> 
> Yes, this is a known problem (it fails on my platform, too). It's actually a 
> Posix violation, but just happens to work on most platforms.
> 
> The problem is that fixing would require some pretty hefty rewriting of the 
> way files are managed (because you need to store whether the FILE* came from 
> popen() or fopen(), which means you need another word of storage, which means 
> you can't store the FILE* in a lightuserdata), and, well, no-one's got around 
> to doing it yet.
> 
> But it's good to know that it fails on uclibc as well as my wacky OS.

We've had it explode on Linux/glibc.  And boy, did it take ages to track
down.  There's been dicussion on this before: 

http://lua-users.org/lists/lua-l/2004-07/msg00430.html

Although I seem to recall that somebody pointed out an issue with
Daniel's solution.  (It didn't work on some other OSes.)

-- 
Rob Kendrick, Pepperfish Ltd.         +44 (0)845 226 4146  www.pepperfish.net
PGP signed or encrypted mail welcome                         Key ID: 3651D17A