Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Signal propagation problem with 3.1.4 on Digital UNIX



On Aug 28, 10:09am, Paul Lew wrote:
} Subject: Signal propagation problem with 3.1.4 on Digital UNIX
}
} When I run ode (an OSF source code control system), it starts zsh.
} Under this zsh, if a line is partically composed and I press the
} interrupt key (^c in my setup).  I got into following state:
} 
} (0)ezdzit lew src>>> jadfal                               kzasa
}  Interrupt signal 2
} (0)ezdzit lew src>> 
} (0)ezdzit lew src>>>                                      kzasa
} 
} The parent shell (zsh too) is trying to read command from stdin.  The
} zsh exec'ed by ode is also trying to read command from stdin.  Has
} anyone experience this before?  How easy to fix it?  Thanks in
} advance...

I suspect this is a problem with ode rather than with zsh, but it's hard
to tell.

The first zsh believes that the process it started (originally ode) has
exited.  One question is, is the second zsh the same process (same PID)
as ode was, or is it a new process?

Here's what I *think* is happening (PIDs invented for the example):

	Process		PID	PPID	Action
	-------		---	----    ------
	zsh		10	n/a	fork+exec ode
	ode		11	10	fork+exec zsh
	zsh		12	11	fork+exec jadfal
	jadfal		13	12	n/a

(PID 13 is the "bad luck" process. :-)

You can verify this by running a "ps l" from the second zsh next time you
fire up ode; see if ode is still running, and trace the PID/PPID back to
your first zsh.

When you type ctrl-C, all four processes get the SIGINT.  Each of the zsh
catch it and don't exit, but both ode and jadfal are interrupted and exit.
zsh 10 has no way of knowing that it's child 11 has started zsh 12, so 10
goes back to reading commands.

The bug is that the SIGINT should -not- have caused ode to exit. Either
ode should have exec'd zsh without forking, so the second zsh inherits
PID 11, or it should be catching or ignoring tty-generated signals, or
it should have been taken out of the tty process group.

I'm a little confused as to why that last didn't happen automatically.
I would have thought that zsh 12 would force jadfal to be the tty group
leader, thus preventing the signals from reaching ode.  That certainly
seems to happen on my linux machine (using "perl -e 'system zsh'" in
place of ode, and "sleep 10" in place of jadfal).  So the bug may be
more insidious than one of interrupt handling in ode.

You didn't say what operating system you're using.  It's possible that
zsh is not doing tty pgrp management correctly.  Do you happen to have
the config.h file that was generated when zsh was built?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



Messages sorted by: Reverse Date, Date, Thread, Author