If the command is simply going to exit without doing any cleanup, then
an immediate exit(3) does not add any value and in-fact obscures that
the program was terminated by a signal.
Sponsored by: Klara, Inc.
Differential D50247
mail: remove the SIGHUP handler from lex.c kevans on May 7 2025, 7:49 PM. Authored by Tags None Referenced Files
Subscribers
Details
If the command is simply going to exit without doing any cleanup, then Sponsored by: Klara, Inc.
Diff Detail
Event TimelineComment Actions It flushesmore stdio output... Comment Actions I had considered that, but also... I don't know that we should care in SIGHUP in particular; it's not like SIGINT where I might have some more expectations about a relatively clean exit based on common decency more globally. If it were documented maybe it's be a little more clearly useful? Comment Actions I forgot to note that this is a conformance motivated change, but I might need to go reread the spec and see if maybe we should flush then re-raise instead Comment Actions POSIX has made it increasingly harder to link to their standards. If you navigate to the mailx utility in https://pubs.opengroup.org/onlinepubs/9799919799/, the ASYNCHRONOUS EVENTS section describes:
And only describes handling SIGINT Comment Actions that seems reasonable to me, but did you consider the other places it handles SIGHUP, e.g. collect.c? Comment Actions Yeah, I have a separate diff for that that I'll post when I get home- it does a reset + raise() instead Comment Actions Oh, wait, sighup? That's different... Comment Actions You had me really curious, so I went repodiving into the CSRG repo to see if it had answers. https://svnweb.freebsd.org/csrg/usr.bin/mail/lex.c?revision=33989&view=markup changed it to just be an exit, before that it actually tried to save messages into mbox on receipt -- seems like it could have just been removed at that point, but it was less invasive to just make it an exit(1) to be fair. |