Subject: Re: bug#51877: 27.2; term: error in process filter

From: Eli Zaretskii <[email-masked]>
Date: Mon, 15 Nov 2021 21:19:54 +0200

> From: Christopher Howard <[email-masked]>
> Date: Mon, 15 Nov 2021 10:10:38 -0900
> 
> Conditions: Computer with a /dev/ttyUSB0 character source which
> generates
> garbage output characters in the form of a long list of \371 bytes. In
> my case, was connected via sterm to an ESP8266 microcontroller.
> 
> 1) M-x term (leave it in char mode)
> 2) sterm -n /dev/ttyUSB0 -s 115200
> 3) cause the garbage output to be generated
> 4) while the cursor is still at the end of the garbage line, try to
> type
> in a normal character.
> 
> The character will get sent to sterm, but the echoed back character
> will
> not appear in the emacs terminal, and an error will appear containing
> the character (see below).
> 
> Pressing enter to begin a new line will clear the error.
> 
> Perhaps this error could be duplicated by those not having my
> microcontroller setup, but filling a file with some \371 or other
> garbage characters, and cat'ing that file into the emacs terminal. The
> issue is that garbage characters somehow confuses the process filter,
> whatever that is.

What is the value of process-coding-system in this case?  If a process
generates binary garbage, its output should be decoded as raw-text,
whereas the Emacs defaults are set for a program which sends
human-readable text.  So Emacs tries to decode your garbage as if it
were UTF-8, and chokes.

IOW, I think this is a cockpit error.