Bug#31521: dpkg: dpkg dying in eterm
>>"Jules" == Jules Bean <jmlb2@hermes.cam.ac.uk> writes:
Jules> On 1 Mar 1999, Manoj Srivastava wrote:
Jules> So every single program should start with a long set of
Jules> signal(___,SIG_DFL)?
Long set? Fortunately for us programmer types, someone
invented a construct called the loop.
#include <signal.h>
int i = 0;
for (i=1;i<=32;i++) signal (i, SIG_DFL);
See? Then ignore what you want to. But this should not be
required, anyway, for most signals.
Jules> And reset all environment variables to some useful default?
If you crash and burn depending on the status of these
variables, hell, yes. Have a reasonable default, and test within your
code.
Jules> The way I see this, is that the parent process *may* have
Jules> reset the signals for some bona fide reason (debuggers play
Jules> this kind of trickery, I believe).
True enough. When a program is _exec_ed the status of all
signals is either default or ignore. Normally, all signals are set to
their default action, *unless the process that calls _exec_ is
ignoring the signal*". However, if setting some signal handlers to
SIG_IGN makes you crash; test and reset that handler.
Jules> However, the gnome-* packages have *no* valid reason to reset
Jules> SIGPIPE for child processes. So it's a bug if they do.
"Set SIG_PIPE for child processes"? That's a strange way of
looking at it. No, noone sets signals for child processes. One sets
handlers for oneself. However, there are numerous other properties of
the parent that are inherited by the child -- signal masks and
dispositions are affected, for one thing.
Jules> If I destroy PATH and IFS, I can expect subprocesses to break.
Jules> I don't file bugs against them for not checking.. (unless
Jules> they're suid root, of course :)
A system level program, very critical to the machine, should
not be coded so amateurishly. I fully expect critical code to have a
decent set of defaults, especially once a flag is raised about
problems. The flag is so raised for dpkg now.
manoj
--
"And it should be the law: If you use the word `paradigm' without
knowing what the dictionary says it means, you go to jail. No
exceptions." David Jones @ Megatest Corporation
Manoj Srivastava <srivasta@acm.org> <http://www.golden-gryphon.com/>
Key C7261095 fingerprint = CB D9 F4 12 68 07 E4 05 CC 2D 27 12 1D F5 E8 6E
Reply to: