Mailing List Archive

Question about stderr output containing carriage return External
Hi all,

I have recently only discovered that openssh prints lines to stderr
separated by CLRF pairs, and am trying to understand where this
behavior comes from.

This behavior can be seen here:
--snip--
$ ssh u@u 2>&1 | sed -n l
ssh: Could not resolve hostname u: Name or service not known\r$
--snip--

I have seen section 11.3 from rfc4253, but am unsure whether that is
the origin of this behavior. Is a "Debug Message"(SSH_MSG_DEBUG)
considered anything that is logged on stderr?

Any insights welcome!

Cheers,
Josh
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: Question about stderr output containing carriage return External [ In reply to ]
Hi Josh,

it's been around for a while:

https://github.com/openbsd/src/commit/8747197a4a479407167d01f46017ddb99cc3cae2

Though the commit doesn't say why it needs the \r.

Cheers,
Marian

On 11/11/23 00:38, Joshua Rogers wrote:
> Hi all,
>
> I have recently only discovered that openssh prints lines to stderr
> separated by CLRF pairs, and am trying to understand where this
> behavior comes from.
>
> This behavior can be seen here:
> --snip--
> $ ssh u@u 2>&1 | sed -n l
> ssh: Could not resolve hostname u: Name or service not known\r$
> --snip--
>
> I have seen section 11.3 from rfc4253, but am unsure whether that is
> the origin of this behavior. Is a "Debug Message"(SSH_MSG_DEBUG)
> considered anything that is logged on stderr?
>
> Any insights welcome!
>
> Cheers,
> Josh
> _______________________________________________
> openssh-unix-dev mailing list
> openssh-unix-dev@mindrot.org
> https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: Question about stderr output containing carriage return External [ In reply to ]
On Sat, 11 Nov 2023, Marian Beermann wrote:

> Though the commit doesn't say why it needs the \r.

When the terminal is in raw mode, \n is not the line separator
but \x0D\x0A is: \x0D moves the cursor to the beginning of the
line and \x0A moves it to one line below but does not change
the horizontal position.

So it’s a requirement when in raw mode and doesn’t hurt in
cooked mode.

bye,
//mirabilos
--
Infrastrukturexperte • Qvest Digital AG
Am Dickobskreuz 10, D-53121 Bonn • https://www.qvest-digital.com/
Telephon +49 228 54881-393 • Fax: +49 228 54881-235
HRB AG Bonn 18196 • USt-ID (VAT): DE274355441
Vorstand: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg
Vorsitzender Aufsichtsrat: Peter Nöthen
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: Question about stderr output containing carriage return External [ In reply to ]
Hi Thorsten,

Thank you for the clarification.

Cheers,
Josh

On Sat, Nov 11, 2023 at 1:57?AM Thorsten Glaser <t.glaser@tarent.de> wrote:
>
> On Sat, 11 Nov 2023, Marian Beermann wrote:
>
> > Though the commit doesn't say why it needs the \r.
>
> When the terminal is in raw mode, \n is not the line separator
> but \x0D\x0A is: \x0D moves the cursor to the beginning of the
> line and \x0A moves it to one line below but does not change
> the horizontal position.
>
> So it’s a requirement when in raw mode and doesn’t hurt in
> cooked mode.
>
> bye,
> //mirabilos
> --
> Infrastrukturexperte • Qvest Digital AG
> Am Dickobskreuz 10, D-53121 Bonn • https://www.qvest-digital.com/
> Telephon +49 228 54881-393 • Fax: +49 228 54881-235
> HRB AG Bonn 18196 • USt-ID (VAT): DE274355441
> Vorstand: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg
> Vorsitzender Aufsichtsrat: Peter Nöthen
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev