bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bash spews bracketed-paste escape sequences when handling signal.


From: Kaz Kylheku
Subject: Re: Bash spews bracketed-paste escape sequences when handling signal.
Date: Wed, 18 Dec 2024 13:56:48 -0800
User-agent: Roundcube Webmail/1.4.15

On 2024-12-18 13:46, microsuxxor wrote:
> try 
> 
> p=$$ ; while sleep 1 ; do kill -USR1 "$p" ; done & 

That's not necessary; my existing repro steps successfully show
a difference between two signals, that being the only
difference between them.

The $$ parameter is expanded to a decimal numeric word
*before* the while command is executed, so the background process
is referencing the correct PID of the parent. There is no need to
smuggle the PID through a variable. $$ in the while command will not
refer to the child process'

(That would be an issue if we had used eval:

 eval 'command ... $$ ...' &

now we backgrounded the eval, which then in the background
process parses the shell syntax and does all the expanding.
Now $$ is the PID of the background process, not that of
the shell which launched it.)

> try also trap - USR1 in the new process ( the while loop ) 

We don't want that at all. The new process is just a helper
to generate the signal to our main process. It doesn't
receive the signal itself. 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]