When you cat >> file and file has zero length in stat,
then the write happens at an offset of zero.
This is perhaps the only time that the stat size should
be used for a purpose other than returning from stat.

Synthetic file systems tend not to care about the
offset on writes anyway.

There is another difference between > and >> on Plan 9:
when the shell opens with > it includes OTRUNC;
when it opens with >> it does not.
This is enough of a hint for file systems that care.

On Linux apparently things happen the other way around:
O_TRUNC is never sent, but O_APPEND is sent for >> opens.
MacFUSE doesn't send either, which is another bug I've filed:
http://code.google.com/p/macfuse/issues/detail?id=132

MacFUSE also seems to employ some subterfuge where fds
do not map one-to-one with FUSE file handles.  Another bug I've filed:
http://code.google.com/p/macfuse/issues/detail?id=133

To be fair, these are the kinds of mistakes I would expect any
Unix-mindset implementation to make, and it surprised me quite
a bit that Linux FUSE got so much of this right from the start
(or at least from when I started using it).  I wonder how many
of these mistakes BSD FUSE makes.

Russ

Reply via email to