Re: tmux loadb and fifos

2010-02-19 Thread Nicholas Marriott
Hi On Fri, Feb 19, 2010 at 06:21:30AM +0100, Fulvio Ciriaco wrote: > Yes, this is quite a more linear patch. > It has one defect, in my opinion, i.e. that it does > buffer-size reallocations, usually this is avoided > by increasing the buffer by a factor 2 rather than increasing > it by 1 byte. Th

Re: tmux loadb and fifos

2010-02-19 Thread Fulvio Ciriaco
Hallo, attached find a very conservative patch against your patched cmd-load-buffer.c which brings the number of calls to realloc() from n=(final buffer size) to n tmux.diff Description: Binary data At Thu, 18 Feb 2010 23:20:19 +, Nicholas Marriott wrote: > > Hi > > Thanks for the diff. >

Re: tmux loadb and fifos

2010-02-18 Thread Fulvio Ciriaco
Yes, this is quite a more linear patch. It has one defect, in my opinion, i.e. that it does buffer-size reallocations, usually this is avoided by increasing the buffer by a factor 2 rather than increasing it by 1 byte. That amounts to changing --

Re: tmux loadb and fifos

2010-02-18 Thread Nicholas Marriott
Hi Thanks for the diff. Tiago Cunha who originally wrote the load-buffer command sent me an update to do this as well which is quite similar to yours but a bit simpler, so we will probably use it. I've attached it below as well if you want to take a look. You can't just use stdin because the loa

Re: tmux loadb and fifos

2010-02-18 Thread Fulvio Ciriaco
Hallo, please find enclosed a patch to tmux cmd-load-buffer.c which reads the buffer from undecidable size streams up to EOF. I put a predefined limit on the final buffer size. This, I checked on my currently available machines: netBSD and Linux and works fine. Also, I wrote code to read from pipe

Re: tmux loadb and fifos

2010-02-17 Thread Nicholas Marriott
I can't see a reason why it shouldn't, I'll add it to the todo list, if you want to send me some code to do it it would be great ;-). On Wed, Feb 17, 2010 at 05:37:14PM +0100, Fulvio Ciriaco wrote: > I cannot really imagine that any size returned by fstat for a fifo, > might have any sense. > Any

Re: tmux loadb and fifos

2010-02-17 Thread Fulvio Ciriaco
I cannot really imagine that any size returned by fstat for a fifo, might have any sense. Anyhow, both on NetBSD and Linux, sb.st_size for FIFOs returns 0. Is there any reason why tmux should not read to EOF? There is nothing particularly terrible in having to write to a file on disk but it is not

Re: tmux loadb and fifos

2010-02-17 Thread Nicholas Marriott
cat reads the file until EOF, tmux checks the file size and then reads that amount. Check what fstat() is returning for the size in cmd-load-buffer.c and see if it matches what you expect. On Wed, Feb 17, 2010 at 01:57:54AM +0100, Fulvio Ciriaco wrote: > Please would you explain it better to me?

Re: tmux loadb and fifos

2010-02-16 Thread Fulvio Ciriaco
Please would you explain it better to me? a. does this work on openbsd? b. (mkfifo fifo; echo est > fifo; cat fifo) gives the obvious result and no side effect, how is (tmux loadb fifo) different? Also, these are quite busy machines, some have more recent software and some older, and

Re: tmux loadb and fifos

2010-02-16 Thread Nicholas Marriott
Dunno. Perhaps fstat doesn't return a sane size for FIFOs. You'd have to add some debugging to find out what is going on. On Tue, Feb 16, 2010 at 09:06:05PM +0100, Fulvio Ciriaco wrote: > Hallo, > I tried the following on different OSes: > #tmux setb "echo 1" > #mkfifo test > #echo echo 2 > test &

tmux loadb and fifos

2010-02-16 Thread Fulvio Ciriaco
Hallo, I tried the following on different OSes: #tmux setb "echo 1" #mkfifo test #echo echo 2 > test & #tmux loadb test On NetBSD: does nothing #tmux showb echo 1 On Linux: empties buffer and creates all sorts of problems (broken pipe, killed shell) tmux showb My questions: Why does it not wo