Deutsch   English   Français   Italiano  
<v1l5k7$1c28l$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com>
Newsgroups: comp.unix.shell
Subject: Re: Cleaning up background processes
Date: Fri, 10 May 2024 14:57:41 +0200
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <v1l5k7$1c28l$1@dont-email.me>
References: <slrnv3fm5e.jrj.naddy@lorvorc.mips.inka.de>
 <20240505214609.114@kylheku.com> <v1ah87$l0a8$1@news.xmission.com>
 <v1gpdq$3me9$1@dont-email.me> <v1h0hk$7rkr$1@dont-email.me>
 <ptg1hk-7n3.ln1@ID-313840.user.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 10 May 2024 14:57:43 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="8e215132bebbb178b4a51becbbd1e44b";
	logging-data="1444117"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19Nr4RBZLgFCeB6jhhYXxRv"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
Cancel-Lock: sha1:VG+wJCffIG9fYMdK/Nz1h6VSykc=
X-Enigmail-Draft-Status: N1110
In-Reply-To: <ptg1hk-7n3.ln1@ID-313840.user.individual.net>
Bytes: 2732

On 10.05.2024 14:35, Geoff Clare wrote:
> Janis Papanagnou wrote:
> 
>> But the pseudo-signal 'EXIT' is non-standard (to my knowledge), so you
>> cannot generally rely on it, depending on your environment, and the OP
>> asked for a "standard POSIX shell idiom".
> 
> Quoting POSIX.2-1992, 3.14.13:
> 
>     The condition can be EXIT; 0 (equivalent to EXIT); or a signal
>     specified using a symbolic name, without the SIG prefix, as listed
>     in Required Signals and Job Control Signals (Table 3-1 and Table 3-2
>     in POSIX.1 {8}). (For example: HUP, INT, QUIT, TERM). Setting a
>     trap for SIGKILL or SIGSTOP produces undefined results.
> 
> It has hardly changed in the current standard (POSIX.1-2017):
> 
>     The condition can be EXIT, 0 (equivalent to EXIT), or a signal
>     specified using a symbolic name, without the SIG prefix, as listed
>     in the tables of signal names in the <signal.h> header defined in
>     XBD Chapter 13; for example, HUP, INT, QUIT, TERM. Implementations
>     may permit names with the SIG prefix or ignore case in signal
>     names as an extension. Setting a trap for SIGKILL or SIGSTOP
>     produces undefined results.
> 

That's good. (And I was obviously misremembering.) Thanks!

BTW, I'm astonished about the "undefined results" for KILL/STOP. Yes,
on OS-level they cannot be caught but why undefined behavior on shell
level; what is the reason or practical rationale for that?

Janis