Bug 495276 - Konsole unnecessarily sets IXOFF stty option
Summary: Konsole unnecessarily sets IXOFF stty option
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: emulation (show other bugs)
Version: master
Platform: Arch Linux Linux
: NOR minor
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-10-24 00:08 UTC by Jay Berry
Modified: 2024-10-30 00:26 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jay Berry 2024-10-24 00:08:24 UTC
SUMMARY
Looking at the output of running `$ stty` in a shell using Konsole as its terminal emulator (and looking at the source code of `src/Pty.cpp`) Konsole unnecessarily sets the IXOFF tty ioctl flag, which is completely ignored by PTYs, and is only relevant to physical hardware terminals eg a terminal connected via an RS232 cable. This is probably due to the at-first confusing documentation of IXON and IXOFF in `$ man 1 stty`.

The output of `$ stty` for me is
```
[jb2170@WD:~]$ stty
speed 38400 baud; line = 0;
-brkint ixoff -imaxbel iutf8
```

Other terminal emulators such as Zutty, Alacritty, Kitty, Mate-Terminal do not have `ixoff` in their output. It's completely harmless to have `ixoff` there, it doesn't do anything for ptys, but it would be nice to have one less loose end, one less non-default string in the output of stty as all other terminal emulators seem to do.

IXON is whether the pty driver / tty driver should process ^S and ^Q. This is implemented correctly by Konsole.
IXOFF is whether a tty driver connected to a physical dumb-terminal (eg over a RS232) should send electrical signals down the RTS/CTS etc lines to tell the terminal 'slow down on the keyboard, the program hasn't read all your data yet'. Since a pty resides in the kernel and the kernel has possession of both the master side and ancillary side there is no IXOFF control for ptys. Konsole incorrectly / unnecessarily sets the IXOFF termios flag.

My guess is that in the development of Konsole one looked at the documentation for IXON in `man stty` reading "enable XON/XOFF flow control" and thought to implement both IXON and IXOFF, with IXON corresponding to ^Q and IXOFF corresponding to ^S, or some other incorrect behaviour, but only due to the cryptic documentation of ancient tty settings lol.

This is a 10 second fix of removing the `IXOFF` flag from the body of `setFlowControlEnabled` in `src/Pty.cpp` and maybe adding a comment, plus renaming `Pty`'s member variable `_xonXoff` to `_ixon` for clarity.

STEPS TO REPRODUCE
1. Open Konsole
2. Run `stty`

OBSERVED RESULT
ixoff is present in the output

EXPECTED RESULT
ixoff should not be present

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux, KDE Konsole 24.08.2-1 via "pacman -Qi konsole"
Comment 1 Jay Berry 2024-10-24 00:11:15 UTC
(This should also be changed for the Dolphin terminal pane too if it's a different codebase, as ixoff appears in `$ stty` there too)
Comment 2 Bug Janitor Service 2024-10-24 01:07:39 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/konsole/-/merge_requests/1043