Re: [wmii] adding data to 9p files using wmiir

From: Martin Kraus <lists_mk_AT_wujiman.net>
Date: Thu, 19 Mar 2009 01:52:45 +0100

On Wed, Mar 18, 2009 at 07:30:01PM -0400, Kris Maglione wrote:
> On Thu, Mar 19, 2009 at 12:16:10AM +0100, Martin Kraus wrote:
>> Basicaly I'd expect this not to work, since wmiir is reading and at the same
>> time overwriting the data. It had worked as far as I've tried. Is it because
>> wmiir first reads all the data and then outputs it so that the other wmiir
>> write will just overwrite alread read data, or have I been lucky and reading
>> from the file was just always quicker then writing to it?
>>
>> Simply put, can I safely use the above syntax or should I read it into a
>> variable and then overwrite it?
>
> Well, you can safely use it as long as you have less than about 8K of
> colrules. It actually works because wmii truncates those files to the
> last byte written on every write, but wmiir doesn't write anything to the
> filesystem until it recieves something from stdin. Since it won't recieve
> anything until the first wmiir finishes its read, you're fine as long as
> the first read returns the whole file (which it will if it's under 8K).
>
> So, that was more than you asked for. How about this: I'll just add a -a
> flag to 'wmiir write'.

Thanks. I thought as much. I realised I can actually have a look at the source
since it is open:) Even with my rusty C knowledge it is quite obvious once I've
started using a bit of that thing of mine called brain. Sometimes I think I'm
getting too old.

thanks for the complete explanation.

mk
Received on Thu Mar 19 2009 - 00:52:45 UTC

This archive was generated by hypermail 2.2.0 : Thu Mar 19 2009 - 01:00:09 UTC