Re: [PATCH/RFC] doc: document error handling functions and conventions (Re: [PATCH 03/14] copy_fd: pass error message back through a strbuf)

2015-02-17 Thread Junio C Hamano
Jeff King p...@peff.net writes: On Tue, Feb 17, 2015 at 08:03:00AM -0800, Junio C Hamano wrote: Whether or not we decide on a different error-handling convention in the future, it is a fact of life that a good bit of code already uses the strbuf convention documented by Jonathan's patch.

Re: [PATCH/RFC] doc: document error handling functions and conventions (Re: [PATCH 03/14] copy_fd: pass error message back through a strbuf)

2015-02-17 Thread Michael Haggerty
On 02/13/2015 12:08 AM, Junio C Hamano wrote: Junio C Hamano gits...@pobox.com writes: Jeff King p...@peff.net writes: On Fri, Dec 05, 2014 at 10:00:05AM -0800, Junio C Hamano wrote: I am more worried about variable length part pushing the information that is given later out to the right,

Re: [PATCH/RFC] doc: document error handling functions and conventions (Re: [PATCH 03/14] copy_fd: pass error message back through a strbuf)

2015-02-17 Thread Junio C Hamano
Michael Haggerty mhag...@alum.mit.edu writes: I think we all agree that the early part of the new documentation text is good, but the last section that proposes to store more detailed errors in caller supplied strbuf in textual form was controversial (and I have not convinced myself it is a

Re: [PATCH/RFC] doc: document error handling functions and conventions (Re: [PATCH 03/14] copy_fd: pass error message back through a strbuf)

2015-02-17 Thread Jeff King
On Tue, Feb 17, 2015 at 08:03:00AM -0800, Junio C Hamano wrote: Whether or not we decide on a different error-handling convention in the future, it is a fact of life that a good bit of code already uses the strbuf convention documented by Jonathan's patch. So I think it is OK to merge it

Re: [PATCH/RFC] doc: document error handling functions and conventions (Re: [PATCH 03/14] copy_fd: pass error message back through a strbuf)

2015-02-12 Thread Junio C Hamano
Junio C Hamano gits...@pobox.com writes: Jeff King p...@peff.net writes: On Fri, Dec 05, 2014 at 10:00:05AM -0800, Junio C Hamano wrote: I am more worried about variable length part pushing the information that is given later out to the right, e.g. error: missing file '%s' prevents us from

Re: [PATCH/RFC] doc: document error handling functions and conventions (Re: [PATCH 03/14] copy_fd: pass error message back through a strbuf)

2014-12-09 Thread Junio C Hamano
Jeff King p...@peff.net writes: On Fri, Dec 05, 2014 at 10:00:05AM -0800, Junio C Hamano wrote: I am more worried about variable length part pushing the information that is given later out to the right, e.g. error: missing file '%s' prevents us from doing X. Chomping to [1024] is not a good

Re: [PATCH/RFC] doc: document error handling functions and conventions (Re: [PATCH 03/14] copy_fd: pass error message back through a strbuf)

2014-12-09 Thread Jeff King
On Tue, Dec 09, 2014 at 10:43:52AM -0800, Junio C Hamano wrote: Unless we can do something clever with a set of global error strbufs or something (i.e., that expand as needed, but the caller does not have to free themselves, as they will get recycled eventually). That has its own corner

Re: [PATCH/RFC] doc: document error handling functions and conventions (Re: [PATCH 03/14] copy_fd: pass error message back through a strbuf)

2014-12-07 Thread Jeff King
On Fri, Dec 05, 2014 at 10:00:05AM -0800, Junio C Hamano wrote: Jeff King p...@peff.net writes: The only downside I can think of is that we may truncate the message in exceptional circumstances. But is it really any less helpful to say: error: unable to open file:

Re: [PATCH/RFC] doc: document error handling functions and conventions (Re: [PATCH 03/14] copy_fd: pass error message back through a strbuf)

2014-12-05 Thread Junio C Hamano
Jeff King p...@peff.net writes: The only downside I can think of is that we may truncate the message in exceptional circumstances. But is it really any less helpful to say: error: unable to open file: some-incredibly-long-filename-aa... than printing out an extra 100 lines of a? And I

Re: [PATCH/RFC] doc: document error handling functions and conventions (Re: [PATCH 03/14] copy_fd: pass error message back through a strbuf)

2014-12-04 Thread Junio C Hamano
Jonathan Nieder jrnie...@gmail.com writes: Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- Junio C Hamano wrote: Jonathan Nieder jrnie...@gmail.com writes: -extern int copy_fd(int ifd, int ofd); +extern int copy_fd(int ifd, int ofd, struct strbuf *err); It is not limited to this

Re: [PATCH/RFC] doc: document error handling functions and conventions (Re: [PATCH 03/14] copy_fd: pass error message back through a strbuf)

2014-12-04 Thread Jonathan Nieder
Hi, Junio C Hamano wrote: Jonathan Nieder jrnie...@gmail.com writes: Here's a draft for documentation on that. Thanks; looks reasonable; even if the discussion between you and Peff took us to a slightly different direction than what you described here, the earlier description of long

Re: [PATCH/RFC] doc: document error handling functions and conventions (Re: [PATCH 03/14] copy_fd: pass error message back through a strbuf)

2014-12-04 Thread Jonathan Nieder
Junio C Hamano wrote: Jonathan Nieder jrnie...@gmail.com writes: Here's a draft for documentation on that. Thanks; looks reasonable; even if the discussion between you and Peff took us to a slightly different direction than what you described here, the earlier description of long

Re: [PATCH/RFC] doc: document error handling functions and conventions (Re: [PATCH 03/14] copy_fd: pass error message back through a strbuf)

2014-12-04 Thread Jeff King
On Thu, Dec 04, 2014 at 03:41:47PM -0800, Jonathan Nieder wrote: Junio C Hamano wrote: Jonathan Nieder jrnie...@gmail.com writes: Here's a draft for documentation on that. Thanks; looks reasonable; even if the discussion between you and Peff took us to a slightly different direction

Re: [PATCH/RFC] doc: document error handling functions and conventions (Re: [PATCH 03/14] copy_fd: pass error message back through a strbuf)

2014-12-04 Thread Junio C Hamano
Yeah, that is what I meant. The earlier part will not go to waste no matter what happens to the discussion. I am not a fan of char[1024], if only because our error message may have to mention things whose length is not under our control, e.g. a filename in the working tree, but I do share your

Re: [PATCH/RFC] doc: document error handling functions and conventions (Re: [PATCH 03/14] copy_fd: pass error message back through a strbuf)

2014-12-04 Thread Jeff King
On Thu, Dec 04, 2014 at 03:52:45PM -0800, Junio C Hamano wrote: Yeah, that is what I meant. The earlier part will not go to waste no matter what happens to the discussion. I am not a fan of char[1024], if only because our error message may have to mention things whose length is not under

[PATCH/RFC] doc: document error handling functions and conventions (Re: [PATCH 03/14] copy_fd: pass error message back through a strbuf)

2014-12-03 Thread Jonathan Nieder
Signed-off-by: Jonathan Nieder jrnie...@gmail.com --- Junio C Hamano wrote: Jonathan Nieder jrnie...@gmail.com writes: -extern int copy_fd(int ifd, int ofd); +extern int copy_fd(int ifd, int ofd, struct strbuf *err); It is not limited to this single function, but what contract do we