[GRASS5] Changes between 5.0.1 release and current CVS head
glynn.clements at virgin.net
Tue Feb 4 17:23:27 EST 2003
Markus Neteler wrote:
> > > > > src/general/init/grass.src
> > > > > Trap signals
> > > >
> > > > Don't know.
> > >
> > > I have added this to avoid that GRASS continues when the user
> > > hits CTRL-C while defining a new location. I never liked that
> > > GRASS continues and generates a broken new location, when
> > > I try to stop the create-location procedure.
> > >
> > > So, IMHO yes.
> > Doesn't this belong in Init.sh, then? That's where the code in
> > question is.
> Maybe. But it already works. So probably we should add is additionally
> to Init.sh?
Actually, I can't see how this is meant to work. A "trap" command only
affects the signal handling of the shell itself; signal handlers are
reset when spawning a child process.
BTW, bash seems to have some "magic" in the way that it handles
terminal signals. When you press (by default) Ctrl-C, the terminal
driver sends SIGINT to all processes in the foreground process group
(this will consist of grass5, Init.sh, and anything called from
Init.sh). If a child process traps the signal and returns normally,
bash ignores the signal; OTOH, if the child process dies on the
signal, bash allows the signal to be processed (i.e. calling the
handler specified by "trap", or dying if no handler was installed).
OTOH, ash doesn't do this, and it's quite possible that other shells
won't. The way in which bash behaves isn't necessarily a good
indicator of how Bourne shells behave generally.
More generally, the grass5 script should probably be reduced to just:
exec "$GISBASE/etc/Init.sh" "$@"
with everything else moved to Init.sh. This would allow for invoking
grass5 with an argument which contains spaces (this won't work at
present, due to the way in which Init.sh is invoked). It also uses one
There's also the issue that, even if Init.sh handles set_data being
killed, set_data will still leave a broken location behind. That can't
be fixed in Init.sh; it would have to be fixed in set_data.
Glynn Clements <glynn.clements at virgin.net>
More information about the grass-dev