Re: [PATCH v2 1/3] Introduce die_errno() that appends strerror(errno) to die()

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

 



2009/6/8 Jeff King <peff@xxxxxxxx>:
> On Sun, Jun 07, 2009 at 09:57:04AM -0700, Junio C Hamano wrote:
>
>> > This breaks theoretical usage of custom format string in custom die
>> > routines:
>> >         1. A custom die routine might not support %s.
>> >         2. If the die routine adds a custom format specifier, vsnprintf
>> >                 will fail.
>>
>> I do not think that flies even as a theory.  The "custom" 39a3f5ea talks
>> about is more about "Instead of sending it to stderr, let's pop up an info
>> window and give the message there" kind of customization.
>>
>> Existing die() that prints errno does so by giving strerror() to "%s", so
>> no matter how custom your die routine is, you must support '%s' for its
>> output to make sense to humans.  If you "not support %s", then you will
>> ignore (or choke at) such strerror() result without this patch anyway.
>
> More than that, you must support arbitrary printf format strings,
> because the die routine is passed whatever goes to die() (a quick grep
> revealed that we use at least %u and %c at various points). So it is an
> undocumented requirement that the die routine process its parameters as
> if it were from the printf family.

Your last statement is not quite true. A custom die routine may
support all printf specifiers and some additional ones, but Thomas'
die_errno passes the format string (and arguments list) to vsnprintf
anyway, so the additional specifiers would be lost.

>
> I think what Thomas posted is fine.
>
> -Peff
>
--
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]