Subject: Re: RFC: error codes on exit

From: Junio C Hamano <[email-masked]>
Date: Sat, 22 May 2021 17:49:09 +0900

"H. Peter Anvin" <[email-masked]> writes:

> On 5/21/21 9:53 AM, Alex Henrie wrote:
>> On Wed, May 19, 2021 at 6:40 PM Felipe Contreras
>> <[email-masked]> wrote:
>>>
>>> It's good to not include many initial codes, but I would start with at
>>> least three:
>>>
>>>    OK = 0,
>>>    UNKNOWN = 1,
>>>    NORMAL = 2,
>> If you go that route, could you please pick a word other than
>> "normal"
>> to describe errors that are not entirely unexpected? I'm worried that
>> someone will see "normal" and use it instead of "OK" to indicate
>> success.
>> 
>
> <sysexits.h>

Is the value assignment standardized across systems?

We want human-readable names in the source to help developers while
we want platform neutral output in the log so that log collectors
can do some "intelligent" things about the output.  If EX_USAGE is
always 64 everywhere, that is great---we can emit "64" in the log
and log collectors can take it as if they saw "EX_USAGE".  But if
the value assignment is platform-dependent, it does not help all
that much.

    Side note.  We had a similar discussion on <errno.h> and
    strerror(); the numbers do not help without knowing which
    platform the error came from, and strerror() output is localized
    and not suitable for machine consumption.

In a sense, it is worse than we keep a central mapping between names
programmers use to give to the new fatal() helper function and the
string the tracing machinery will emit for these names.

Thanks.