Page MenuHomeFreeBSD

mail: remove the SIGHUP handler from lex.c
ClosedPublic

Authored by kevans on May 7 2025, 7:49 PM.
Tags
None
Referenced Files
F126741687: D50247.id155086.diff
Sat, Aug 23, 9:27 AM
Unknown Object (File)
Sun, Aug 17, 4:53 PM
Unknown Object (File)
Sat, Aug 16, 3:43 AM
Unknown Object (File)
Fri, Aug 15, 5:32 AM
Unknown Object (File)
Fri, Aug 15, 5:31 AM
Unknown Object (File)
Thu, Aug 14, 10:44 AM
Unknown Object (File)
Mon, Aug 4, 2:44 AM
Unknown Object (File)
Thu, Jul 31, 2:03 AM
Subscribers

Details

Summary

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.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 64001
Build 60885: arc lint + arc unit

Event Timeline

kevans requested review of this revision.May 7 2025, 7:49 PM

It flushesmore stdio output...
But i don't think that matters these days...
Back in the 80s it helped with debugging lex bugs iirc

In D50247#1146012, @imp wrote:

It flushesmore stdio output...
But i don't think that matters these days...
Back in the 80s it helped with debugging lex bugs iirc

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?

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

I forgot to note that this is a conformance motivated change

can you please link the relevant standard?

In D50247#1146023, @ivy wrote:

I forgot to note that this is a conformance motivated change

can you please link the relevant standard?

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:

The mailx utility shall take the standard action for all other signals.

And only describes handling SIGINT

that seems reasonable to me, but did you consider the other places it handles SIGHUP, e.g. collect.c?

In D50247#1146048, @ivy wrote:

that seems reasonable to me, but did you consider the other places it handles SIGHUP, e.g. collect.c?

Yeah, I have a separate diff for that that I'll post when I get home- it does a reset + raise() instead

okay, in that case POSIX gives me no other option than to approve this change

This revision is now accepted and ready to land.May 7 2025, 9:25 PM

Oh, wait, sighup? That's different...
I think that's there so mail doesn't go into an infinite loop. But that maybe obsolete since the tty driver is now sane

In D50247#1146172, @imp wrote:

Oh, wait, sighup? That's different...
I think that's there so mail doesn't go into an infinite loop. But that maybe obsolete since the tty driver is now sane

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.

This revision was automatically updated to reflect the committed changes.