[Top][All Lists]

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

Re: EXIT trap is not executed after an exec failure in a non-interactive

From: Alex fxmbsw7 Ratchev
Subject: Re: EXIT trap is not executed after an exec failure in a non-interactive shell
Date: Sun, 10 Oct 2021 14:06:31 +0200

maybe the same way to implent here a fix may do IPC between bashes ?
a meta database of stuff used in scripts, then if exec reset meta'ly
to none ( undo em maybe .. i have to figure such for my bashlinker
project too ) and if that fails restore em back
the same meta db can be used in IPC somehowly.. important feature, i
bet in 20 - 40 years there wont be bash without IPC, too bad it takes
so long..

is it cause posix isnt so far specifying everything for you ?

On Fri, Oct 8, 2021 at 8:34 PM Mark March <march@systempad.org> wrote:
> >I'll look at changing that
> Thank you. I agree, making traps behave the same after an exec failure as 
> after any other failed builtin is a better course of action. It will make the 
> trap facility stronger. execve failures are not that uncommon, and are hard 
> to predict in advance. execve(2) man page lists 24 failure conditions! Since 
> they can't predict exec failures, scripts that use traps and must handle exec 
> failures will have to save the traps before pretty much every call to exec 
> that takes a command name. This is quite a bit of work to put on bash users. 
> On the other hand, not doing this will lead to subtle bugs where cleanup code 
> will suddenly not run, or processes unexpectedly catch signals that have been 
> previously blocked.
> -Mark
> On Friday, October 8, 2021, 08:02:31 AM PDT, Chet Ramey <chet.ramey@case.edu> 
> wrote:
> On 10/1/21 2:16 PM, Mark March wrote:
> > Ok, thank you for clarifying. There is nothing in the documentation about 
> > this behavior as far as I can tell. I would suggest adding a line about 
> > traps getting reset after a failed exec to the paragraph on 'execfail'.
> I think it will be a cleaner fix, and more intuitive, to make sure the
> traps are preserved across a failed `exec'. I'll look at changing that
> behavior.
> Chet
> --
> ``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/

reply via email to

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