[progress Communities] [progress Openedge Abl] Forum Post: Re: How To Trap The Signals Sent...

  • Thread starter Thread starter ske
  • Start date Start date
Status
Not open for further replies.
S

ske

Guest
I can confirm that bash behaves differently (than what I said) for me too. This was a bit unexpected, because "man bash" clearly states the following things about changing and inheriting ignored signals: (Far down under the command "trap") | ... Signals ignored upon entry to the shell cannot be trapped or reset. ... (Second half of the section COMMAND EXECUTION ENVIRONMENT) | When a simple command other than a builtin or shell function is to be | executed, it is invoked in a separate execution environment that consists | of the following. Unless otherwise noted, the values are inherited from the | shell. ... | o traps caught by the shell are reset to the values inherited from | the shell's parent, and traps ignored by the shell are ignored It seems to me that either bash or its man page are broken/incorrect. (And have been so for a very long time, many versions back.) Anyway, it is correct that there is some variation between different shells how they handle inheritance of ignored signals. I guess some just want to do their own things with many or most of the signals, like Progress, and/or didn't care to follow previous patterns for this from the earliest Unix shells (like Bourne and Korn shell). And I guess original Bourne is not available in Linux. Availability of Korn shell appears to vary in different Linuxes. csh & tcsh inherit ignored signals from their parent, but don't have the trap command, for changing them. You can try some other shells for yourself too, and see what you find in Linux. Check out /bin/*sh or /usr/bin/*sh. I see that when POSIX standardized Unix, they did not require their version of the shell to always inherit ignored signals, or prevent a new trap to be set for an inherited ignored signal. Apparently they only require that for non-interactive shells (scripts). But for those, both of these ARE requirements for POSIX-compliant shells. An interactive shell "may" allow changes to ignored signals. (But doesn't have to.) See e.g http://www.unix.com/man-page/POSIX/1posix/trap/ (Of course, all shells don't need to be POSIX compliant.) So it might be interesting to redo our tests with scripts in stead of interactive shells, to see if they behave differently. When I tried that with a script in bash, it DID ignore my attempt to set a new trap for a signal ignored by the parent shell. When run from an interactive sub-shell of this parent (e.g the same script through the command "source"), it did execute my new trap when signaled. But I don't think this will be of any help with Progress, still.

Continue reading...
 
Status
Not open for further replies.
Back
Top