It is possible to remove the readonly attribute from {BASH, SHELL}OPTS

2024-01-24 Thread Emanuele Torre
I recently discovered that it is possible to set attributes on readonly variables $ declare -p PPID declare -ir PPID="759437" $ declare -l PPID $ declare -p PPID declare -irl PPID="759437" I noticed SHELLOPTS and BASHOPTS among the default readonly variables set by bash. They are modifi

Re: wait -n misses signaled subprocess

2024-01-24 Thread Oğuz
On Mon, Jan 22, 2024 at 8:13 PM Steven Pelley wrote: > > Hello, > I've encountered what I believe is a bug in bash's "wait -n". wait -n > fails to return for processes that terminate due to a signal prior to > calling wait -n. Instead, it returns 127 with an error that the > process id cannot be

Re: wait -n misses signaled subprocess

2024-01-24 Thread Steven Pelley
Apologies for a quick double post, strace is fairly straightforward and confirms that bash is properly reaping the killed processes. This isn't a matter of the wait syscall failing to return the signaled child process. Running the test from my original post and producing: TEST: KILL PRIOR TO wait

Re: wait -n misses signaled subprocess

2024-01-24 Thread Steven Pelley
> In the first case, if the subprocess N has terminated, its report is > still queued and "wait" retrieves it. In the second case, if the > subprocess N has terminated, it doesn't exist and as the manual page > says "If id specifies a non-existent process or job, the return status > is 127." > > W

Re: wait -n misses signaled subprocess

2024-01-24 Thread Dale R. Worley
Steven Pelley writes: > wait -n > fails to return for processes that terminate due to a signal prior to > calling wait -n. Instead, it returns 127 with an error that the > process id cannot be found. Calling wait (without -n) then > returns its exit code (e.g., 143). My understanding is that t