[OpenAFS-devel] Why does default_com_err_proc() spit out a carriage return?

Jeffrey Hutzelman jhutz@cmu.edu
Thu, 04 Nov 2010 16:38:35 -0400


--On Thursday, November 04, 2010 03:49:32 PM -0400 Jeffrey Altman 
<jaltman@secure-endpoints.com> wrote:

> On 11/4/2010 3:30 PM, Phillip Moore wrote:
>> Does anyone know why, in src/comerr/com_err.c,
>> in default_com_err_proc(), the code does the following:
>>
>>     putc('\n', stderr);
>>     /* should do this only on a tty in raw mode */
>>     putc('\r', stderr);
>>     fflush(stderr);
>>
>
> This should be:
>
>         /* should do this only on a tty in raw mode */
>         putc('\r', stderr);
>         putc('\n', stderr);
>         fflush(stderr);
>
> since the CR always is before the LF.  MIT fixed this in their code base
> more than a decade ago.   OpenAFS inherited the brokenness.
>
> Whether OpenAFS wishes to output as CR-LF at all is a separate matter.
> I suspect the answer should be 'no'.

In fact, the answer should be to do so only when stderr is a tty in raw 
mode, like the comment says.