[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bash spews bracketed-paste escape sequences when handling signal.
From: |
Chet Ramey |
Subject: |
Re: Bash spews bracketed-paste escape sequences when handling signal. |
Date: |
Wed, 18 Dec 2024 09:58:11 -0500 |
User-agent: |
Mozilla Thunderbird |
On 12/15/24 2:16 AM, Kaz Kylheku wrote:
If you do not have "trap : ALRM" then this doesn't happen.
Because SIGALRM is a terminating signal that kills the shell.
But no; I mean the shell keeps running in that case. Try it:
$ kill -ALRM $$
$ # didn't die
Then something about the execution environment is weird. On a clean shell:
$ echo $BASH_VERSION
5.3.0(1)-beta
$ echo $$
28545
$ kill -ALRM $$
Alarm clock: 14
[shell terminates]. Thisa is also on macOS. The most likely cause is that
you're ignoring SIGALRM, and it was ignored when the shell started.
Furthermore, if the Bash trap for ALRM is not installed, then
the readline behavior in question (emission of terminal sequences)
doesn't occur.
More evidence that the signal is ignored; readline doesn't install a
handler if the calling application has the signal ignored.
Since "trap : ALRM" is a Bash feature and not a readline feature,
it's hard to escape the conclusion that Bash is somehow acting as an
enabler for the behavior.
The right fix may be to stay away from SIGALRM, since readline
clearly uses it for something.
It uses SIGALRM for timeouts if select/pselect are unavailable, but not
otherwise. However, since it's a fatal signal that applications commonly
use, readline catches it and cleans up the terminal.
Disabling bracketed paste is probably a bad workaround; what if
some Basta user wants that to work?
I meant as an individual choice.
With signals other than SIGALRM, the code has to be careful; if it
ever happens that the signal is delivered without the trap being
in place, Bash will die.
Same with SIGALRM, too.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
- Bash spews bracketed-paste escape sequences when handling signal., Kaz Kylheku, 2024/12/14
- Re: Bash spews bracketed-paste escape sequences when handling signal., Chet Ramey, 2024/12/14
- Re: Bash spews bracketed-paste escape sequences when handling signal., Kaz Kylheku, 2024/12/15
- Re: Bash spews bracketed-paste escape sequences when handling signal., Kaz Kylheku, 2024/12/15
- Re: Bash spews bracketed-paste escape sequences when handling signal.,
Chet Ramey <=
- Re: Bash spews bracketed-paste escape sequences when handling signal., Kaz Kylheku, 2024/12/18
- Re: Bash spews bracketed-paste escape sequences when handling signal., microsuxxor, 2024/12/18
- Re: Bash spews bracketed-paste escape sequences when handling signal., Kaz Kylheku, 2024/12/18
- Re: Bash spews bracketed-paste escape sequences when handling signal., microsuxxor, 2024/12/18
- Re: Bash spews bracketed-paste escape sequences when handling signal., Chet Ramey, 2024/12/18
- Re: Bash spews bracketed-paste escape sequences when handling signal., Kaz Kylheku, 2024/12/18
- Re: Bash spews bracketed-paste escape sequences when handling signal., microsuxxor, 2024/12/18
- Re: Bash spews bracketed-paste escape sequences when handling signal., Kaz Kylheku, 2024/12/18
- Re: Bash spews bracketed-paste escape sequences when handling signal., microsuxxor, 2024/12/18
- Re: Bash spews bracketed-paste escape sequences when handling signal., Chet Ramey, 2024/12/19