ANSI Escape sequence unexpected output

Johnathan Mantey johnathanx.mantey at intel.com
Wed Feb 24 03:23:17 AEDT 2021



On 2/23/21 12:12 AM, David Wang (王振宇) wrote:
> I don't think this is a problem of dropping charecters.
> The error seems to occur only at the first time after boot.

The issue only happens for me the first time the BMC boots.
If I logout, and log back in, the ESC sequence does not happen.

>
>> This motivated me to mess with this again.
>> FWIW, The DSR command is present when I run Kermit from within a TMux frame.
>> This code, [[40;162R, is present when I run without TMux, and just use
>> Konsole.
>> Both sequences are emitted AFTER the password has been input, and accepted.
>> Password:
>> Last login: Thu Feb 18 19:45:28 UTC 2021 on ttyS4
>> ^[[39;81Rroot at intel-obmc
>> Using "set terminal type dumb" did not impact the emission of the ESC
>> sequence.
>> I haven't found the "turn responding off" control yet.
> I think this is not like a terminal problem, but the escape charecter is not read correctly and the remaining string is output to stdout. Please correct me if there is an error.
> I have found similar codes under linux:
> https://github.com/openbmc/linux/blob/599d7f997930829f13e05d332e3e7fccd89d340d/drivers/tty/vt/vt.c#L1829
> But I tried to insert the debug code to verify but found that they don’t seem to be the culprit.

I don't believe my issue is dropped characters either. Some program 
during the boot sequence is sending the ESC sequence (It is printed in 
full in the capture above), and there isn't a consumer of the value, so 
it eventually lands in the BASH command line buffer.
I find it interesting that I can have Expect run any number of commands 
to the terminal until I tell Expect to hand control to me via the 
"interact" command. Once Expect has given me control of the IO stream, 
the trailing edge of the ESC sequence (i.e. the portion from the ";" and 
after) is pending input to the BASH interpreter. Something in the whole 
process ate the "ESC [39" portion of the sequence, and left the ";\d+R" 
portion alone. This email trail encouraged me to investigate a bit more. 
I have "solved" this issue for myself by having the "interact" command 
clear any sequence that has the ";\d+R" signature. This is not ideal. At 
the same time it solves an outstanding irritation.

-- 
Johnathan Mantey
Senior Software Engineer
*azad te**chnology partners*
Contributing to Technology Innovation since 1992
Phone: (503) 712-6764
Email: johnathanx.mantey at intel.com <mailto:johnathanx.mantey at intel.com>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20210223/3953b87e/attachment.sig>


More information about the openbmc mailing list