]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
terminal-util: drop ECHOPRT flag from TTY settings when resetting
authorLennart Poettering <lennart@poettering.net>
Wed, 22 Nov 2023 12:10:16 +0000 (13:10 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 22 Nov 2023 12:27:53 +0000 (13:27 +0100)
Let's disable ECHOPRT for terminals we reset.

The feature only really makes sense for hardcopy terminals and we sure
as shit don't talk to one of those. It has the effect that when line
editing is on and you hit backspace it outputs "\" followed by the
removed character. This never makes sense on a TTY that can just erase
the character.

Hence turn of this flag.

We have carried this flag along for about forever, but it doesn't really
make sense. I guess we mostly tested the terminal reset stuff for output
only, not for input.

This change is in particular useful for tools such as
"systemd-firstboot" which interactively ask questions on the console,
and where line editing should really work.

src/basic/terminal-util.c

index c266fea8104e3da6ee1c694770858d70bf88c290..3355b749cc01c8af2b2bf3f557140570dc778a25 100644 (file)
@@ -273,7 +273,7 @@ int reset_terminal_fd(int fd, bool switch_to_text) {
         termios.c_iflag |= ICRNL | IMAXBEL | IUTF8;
         termios.c_oflag |= ONLCR | OPOST;
         termios.c_cflag |= CREAD;
-        termios.c_lflag = ISIG | ICANON | IEXTEN | ECHO | ECHOE | ECHOK | ECHOCTL | ECHOPRT | ECHOKE;
+        termios.c_lflag = ISIG | ICANON | IEXTEN | ECHO | ECHOE | ECHOK | ECHOCTL | ECHOKE;
 
         termios.c_cc[VINTR]    =   03;  /* ^C */
         termios.c_cc[VQUIT]    =  034;  /* ^\ */