On Fri, 21 Jul 2023, 03:31 Wiley Young, <wyeth2...@gmail.com> wrote:

> The first time I saw this bug, tty3 crashed and isn't available any more
> in /dev/pts . Partially reproducing the bug, ttys have crashed but they
> become available for use again when I press Ctrl-Shift-t from
> xfce4-terminal.
>

Point of order, this is NOT a crash.

It's important to understand that the terminal emulator and the Shell are
separate processes that know very little about each other.

>
A ptx/pty pair is what connects them, as a pair of pseudo serial devices in
the kernel. If that crashed your whole machine would panic and reboot.

A terminal emulator will normally close its ptx connection automatically
when there are no processes still connected to the corresponding pty. In
Linux this triggers the kernel to destroy the pty entirely. Some terminal
emulators can be configured not to close immediately, but it's not the
default.

You also mentioned /dev/tty3, which is the Linux VT (console) #3. It
doesn't do anything when its connected process goes away, BUT the system
init process will notice when your Shell terminates, and run a new login
process, and THAT will often send a request to clear the screen.

But of course, I forgot the second single quote! Press [Ctrl-d].
>

Without the quote, the Shell is still waiting for the closing quote; it
never actually runs git.

So when you press ctrl-D to signal end of input, that's sent to the shell.

This has the same meaning as reaching the end of an actual file (containing
a script): there is nothing more for the Shell to do, so it exits.

For an interactive Shell this can be prevented by setting IGNOREEOF=5 (e.g.
in ~/.bashrc), however there's a known issue that this can be unreliable
when the Shell is looking for a quote mark or other closing token, meaning
that it may still exit immediately despite that setting.

(The number assigned to IGNOREEOF indicates how many times you have to type
ctrl-D to cause the Shell to exit. Numbers in the range 3-15 can be useful)

-Martin

Reply via email to