[PATCH] Properly handle short writes in sigint handlers

2012-01-11 Thread Tomi Ollila
On Tue, 10 Jan 2012 07:13:50 -0400, David Bremner wrote: > On Fri, 23 Dec 2011 23:10:35 +0400, Dmitry Kurochkin gmail.com> wrote: > > Hi Austin. > > > > I think we should put the write loop into a separate function and reuse > > it. > > I could go either way on this, unless there is somewhere e

Re: [PATCH] Properly handle short writes in sigint handlers

2012-01-11 Thread Tomi Ollila
On Tue, 10 Jan 2012 07:13:50 -0400, David Bremner wrote: > On Fri, 23 Dec 2011 23:10:35 +0400, Dmitry Kurochkin > wrote: > > Hi Austin. > > > > I think we should put the write loop into a separate function and reuse > > it. > > I could go either way on this, unless there is somewhere else the

[PATCH] Properly handle short writes in sigint handlers

2012-01-10 Thread David Bremner
On Fri, 23 Dec 2011 23:10:35 +0400, Dmitry Kurochkin wrote: > Hi Austin. > > I think we should put the write loop into a separate function and reuse > it. I could go either way on this, unless there is somewhere else the code is actually needed at the moment. > > Also, does it make sense to ad

Re: [PATCH] Properly handle short writes in sigint handlers

2012-01-10 Thread David Bremner
On Fri, 23 Dec 2011 23:10:35 +0400, Dmitry Kurochkin wrote: > Hi Austin. > > I think we should put the write loop into a separate function and reuse > it. I could go either way on this, unless there is somewhere else the code is actually needed at the moment. > > Also, does it make sense to a

[PATCH] Properly handle short writes in sigint handlers

2011-12-24 Thread Austin Clements
Quoth Tomi Ollila on Dec 23 at 2:30 pm: > On Fri, 23 Dec 2011 08:10:33 +, David Edmondson wrote: > > Sorry for being slow. > > > > Can you describe the situation in which you expect a write to stderr to > > be a short write? (Without error.) > > In the following hypothetical case (correct m

[PATCH] Properly handle short writes in sigint handlers

2011-12-24 Thread Austin Clements
Quoth David Edmondson on Dec 23 at 8:10 am: > Sorry for being slow. > > Can you describe the situation in which you expect a write to stderr to > be a short write? (Without error.) If the PTY buffer is nearly full because, say, my terminal emulator is a little behind or my SSH session is slow, I

Re: [PATCH] Properly handle short writes in sigint handlers

2011-12-24 Thread Austin Clements
Quoth Tomi Ollila on Dec 23 at 2:30 pm: > On Fri, 23 Dec 2011 08:10:33 +, David Edmondson wrote: > > Sorry for being slow. > > > > Can you describe the situation in which you expect a write to stderr to > > be a short write? (Without error.) > > In the following hypothetical case (correct m

Re: [PATCH] Properly handle short writes in sigint handlers

2011-12-24 Thread Austin Clements
Quoth David Edmondson on Dec 23 at 8:10 am: > Sorry for being slow. > > Can you describe the situation in which you expect a write to stderr to > be a short write? (Without error.) If the PTY buffer is nearly full because, say, my terminal emulator is a little behind or my SSH session is slow, I

[PATCH] Properly handle short writes in sigint handlers

2011-12-23 Thread Dmitry Kurochkin
Hi Austin. On Thu, 22 Dec 2011 15:15:48 -0500, Austin Clements wrote: > Even if we don't care about errors from write(2), it's still necessary > to handle short writes in order to use write correctly. Some versions > of glibc even mark write as warn_unused_result because of this, so our > previo

[PATCH] Properly handle short writes in sigint handlers

2011-12-23 Thread Tomi Ollila
On Fri, 23 Dec 2011 08:10:33 +, David Edmondson wrote: > Sorry for being slow. > > Can you describe the situation in which you expect a write to stderr to > be a short write? (Without error.) In the following hypothetical case (correct me if I'm wrong :): * There is 4096 byte buffer in tty

Re: [PATCH] Properly handle short writes in sigint handlers

2011-12-23 Thread Dmitry Kurochkin
Hi Austin. On Thu, 22 Dec 2011 15:15:48 -0500, Austin Clements wrote: > Even if we don't care about errors from write(2), it's still necessary > to handle short writes in order to use write correctly. Some versions > of glibc even mark write as warn_unused_result because of this, so our > previo

[PATCH] Properly handle short writes in sigint handlers

2011-12-23 Thread David Edmondson
Sorry for being slow. Can you describe the situation in which you expect a write to stderr to be a short write? (Without error.) In that situation, what guarantee is there that the loop you've written will terminate? We're not talking about safeguarding a users' data here - this is a short messa

Re: [PATCH] Properly handle short writes in sigint handlers

2011-12-23 Thread Tomi Ollila
On Fri, 23 Dec 2011 08:10:33 +, David Edmondson wrote: > Sorry for being slow. > > Can you describe the situation in which you expect a write to stderr to > be a short write? (Without error.) In the following hypothetical case (correct me if I'm wrong :): * There is 4096 byte buffer in tty

Re: [PATCH] Properly handle short writes in sigint handlers

2011-12-23 Thread David Edmondson
Sorry for being slow. Can you describe the situation in which you expect a write to stderr to be a short write? (Without error.) In that situation, what guarantee is there that the loop you've written will terminate? We're not talking about safeguarding a users' data here - this is a short messa

[PATCH] Properly handle short writes in sigint handlers

2011-12-22 Thread Austin Clements
Even if we don't care about errors from write(2), it's still necessary to handle short writes in order to use write correctly. Some versions of glibc even mark write as warn_unused_result because of this, so our previous usage would trigger compiler warnings. --- notmuch-new.c |5 - notmu

[PATCH] Properly handle short writes in sigint handlers

2011-12-22 Thread Austin Clements
Even if we don't care about errors from write(2), it's still necessary to handle short writes in order to use write correctly. Some versions of glibc even mark write as warn_unused_result because of this, so our previous usage would trigger compiler warnings. --- notmuch-new.c |5 - notmu