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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King <peff@xxxxxxxx> 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
>> strategy for that kind of message; abbreviating %s to /path/name/...
>> (again, with literally "...") would be.
>
> True. Unfortunately I do not think there is an easy way to truncate the
> expanded strings used by placeholders...
> ...
> 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 cases, though.

I do share your concern that "strbuf"-approach calls for more
boilerplate leading to unmaintainable code, but I offhand do not
have a magic silver bullet for it.  globals are indeed tempting, but
I'd have to say that what Jonathan has may probably be the least bad
of the possibilities.

Chomping also has complications when we have to deal with user
payload (e.g. pathname in UTF-8), which we may want avoid having to
worry about.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]