[Haskell-cafe] Re: How Can Haskell Be Saved?

Erik de Castro Lopo mle+hs at mega-nerd.com
Sun Dec 13 21:44:22 EST 2009

Richard O'Keefe wrote:

> I also pointed out that Windows NT had a fully compliant
> POSIX subsystem, by design, and that Microsoft cared at least enough
> about POSIX support to buy the company that made what is now SUA.

How does that explain things like fstat() and stat() returning different
values for the same file:


That bug exists in windows XP, Vista and 7.

> For that matter, no version of Linux, no version of BSD, and no version
> of OpenSolaris is certified POSIX-compliant (open source projects change
> too fast for certification to be cheap).

For the last decade I have been the main author of libsndfile:


a library that requires nothing of POSIX other than file I/O but
needs to run on windows and *nix.

You would think that Microsoft's much touted POSIX support would mean
that the POSIX calls I used on *nix would JustWork(tm) on windows.
Unfortunately, due to bugs in Microsoft's POSIX implementation this is
not the case. Bugs include:

   - fstat() (64 bit file length aware version) returning the wrong file
     length after a write (win9x).
   - lseek() (64 bit file length aware version) to SEEK_END not actually
     going to the end of the file (win2000 and win2003).
   - fstat() and stat() returning different results on the same file (XP,
     Vista and 7).

Because testing for and working around these bugs is simply too difficult,
I have been forced to maintain tow versions of the file I/O code, one
POSIX (that works on *nix including Mac OS X) and for windows, the native
windows file I/O API.

I suspect that authors of other open source projects that started on Linux
and were then ported to windows would have similar stories of egregious
unfixed bugs in Microsoft's POSIX implementation.

Erik de Castro Lopo

More information about the Haskell-Cafe mailing list