<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/usr.bin/mail, branch main</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src/atom?h=main</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/'/>
<updated>2025-05-29T20:08:50Z</updated>
<entry>
<title>mail: tests: reset signal disposition before testing</title>
<updated>2025-05-29T20:08:50Z</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2025-05-29T20:08:50Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=d5e5e24179f4a98efaadea2b3c43006b322d7f15'/>
<id>urn:sha1:d5e5e24179f4a98efaadea2b3c43006b322d7f15</id>
<content type='text'>
As a good citizen of the OS, mail(1) won't try to catch signals that
were ignored when it started and it won't reconfigure its signal mask
unless it's going to try and handle a signal.  The test should start
mail(1) off in a well-known state for the signal that it's trying to
test in order to get the behavior that's desired.

No functional change, just improves the resilience of the test.

Reviewed by:	des
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D50599
</content>
</entry>
<entry>
<title>mail: don't rewrite buffer sizes as much</title>
<updated>2025-05-29T20:08:49Z</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2025-05-29T20:08:49Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=2e47009079fc01ca05c9779d85616e1df037693c'/>
<id>urn:sha1:2e47009079fc01ca05c9779d85616e1df037693c</id>
<content type='text'>
Thes buffers are arrays with a known size, just use sizeof() rather than
rewriting their sizes -- no functional change, slightly more resilient
against future possible errors.

Reviewed by:	markj
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D50582
</content>
</entry>
<entry>
<title>mail: Add test cases for SIGHUP.</title>
<updated>2025-05-14T19:31:47Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-05-14T19:31:47Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=a6bac0a9efa15275ada0f0b0ef784837929fb5c6'/>
<id>urn:sha1:a6bac0a9efa15275ada0f0b0ef784837929fb5c6</id>
<content type='text'>
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D50296
</content>
</entry>
<entry>
<title>mail: exit with the correct exit status on SIGHUP in send mode</title>
<updated>2025-05-14T19:20:35Z</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2025-05-14T19:20:16Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=964557fe9807d473ad11182a332b0d1da4f54ef0'/>
<id>urn:sha1:964557fe9807d473ad11182a332b0d1da4f54ef0</id>
<content type='text'>
Motivated by POSIX conformance requirements: mailx(1) is expected to
take the default action for every signal except SIGINT in interactive
mode.  We still handle other signals that we shouldn't based on the
spec (e.g., SIGTSTP), but conforming there is not as straightforward as
we do more than just cleanup in response.

Note that when the spec says that we must take the default action, it
does not mean so strictly.  Namely, we *can* do some sensible cleanup
if we'd like, but we enter into nonconformant territory if we don't
reflect the termination via signal in our exit status.  That is why
this change doesn't actually remove the handler; we're still conformant
as long as the end result is the same as if we took the default action.

Reviewed by:	des
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D50251
</content>
</entry>
<entry>
<title>mail: remove the SIGHUP handler from lex.c</title>
<updated>2025-05-14T19:20:34Z</updated>
<author>
<name>Kyle Evans</name>
<email>kevans@FreeBSD.org</email>
</author>
<published>2025-05-14T19:20:16Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=df16cbdcf1927200eb910c1874faee6f3d8b9a97'/>
<id>urn:sha1:df16cbdcf1927200eb910c1874faee6f3d8b9a97</id>
<content type='text'>
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.

This is motivated by POSIX conformance requirements, but it's also a
little bit of a tidy-up.  Some investigation into the history of mail(1)
shows that, at one point, hangup() would attempt to save messages into
mbox before exiting.  It was later transformed into a simple exit() and
likely could have been GC'd at that point.

Reviewed by:	des, emaste, ivy
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D50247
</content>
</entry>
<entry>
<title>mail: Further refine the SIGINT test.</title>
<updated>2025-05-06T07:49:45Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-05-06T07:49:45Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=42fd47ef81138ae53ba77add5a400f67af8e6263'/>
<id>urn:sha1:42fd47ef81138ae53ba77add5a400f67af8e6263</id>
<content type='text'>
* Wait at least 1-2 s before sending the second SIGINT.
* If the child is still running after 15 s, send a SIGKILL.
* Improve the exit status checks.

Fixes:		59597032c948
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D50092
</content>
</entry>
<entry>
<title>mail: Exit non-zero on failure to collect mail.</title>
<updated>2025-04-29T15:12:30Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-04-29T15:12:17Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=09bc6a5d5b3333bc91e5f9fdf1e7bb282c4aea5a'/>
<id>urn:sha1:09bc6a5d5b3333bc91e5f9fdf1e7bb282c4aea5a</id>
<content type='text'>
While here, avoid non-portable `pipe2()` in the regression test.

Fixes:		59597032c948
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D50069
</content>
</entry>
<entry>
<title>mail: Don't trap signals we shouldn't.</title>
<updated>2025-04-27T06:29:32Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-04-27T06:29:20Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=59597032c948586257f123f57bbcfbad02a2cd1b'/>
<id>urn:sha1:59597032c948586257f123f57bbcfbad02a2cd1b</id>
<content type='text'>
When in interactive mode, trap SIGINT, SIGHUP, and tty-related signals.
Otherwise, leave signals untouched as required by POSIX.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D50011
</content>
</entry>
<entry>
<title>Remove residual blank line at start of Makefile</title>
<updated>2024-07-15T22:43:39Z</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2024-07-15T04:46:32Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=e9ac41698b2f322d55ccf9da50a3596edb2c1800'/>
<id>urn:sha1:e9ac41698b2f322d55ccf9da50a3596edb2c1800</id>
<content type='text'>
This is a residual of the $FreeBSD$ removal.

MFC After: 3 days (though I'll just run the command on the branches)
Sponsored by: Netflix
</content>
</entry>
<entry>
<title>mail: add volatile in grabh()</title>
<updated>2024-01-05T02:40:53Z</updated>
<author>
<name>Lexi Winter</name>
<email>lexi@le-Fay.ORG</email>
</author>
<published>2024-01-04T22:34:58Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=6c951b37170f1fb2ae8b4827070743e61b6eaed2'/>
<id>urn:sha1:6c951b37170f1fb2ae8b4827070743e61b6eaed2</id>
<content type='text'>
setjmp() requires that any stack variables modified between the setjmp
call and the longjmp() must be volatile.  This means that 'saveint' in
grabh() must be volatile, since it's modified after the setjmp().
Otherwise, the signal handler is not properly restored, resulting in a
crash (SIGBUS) if ^C is typed twice while composing.

PR:		276119
Reported by:	Christopher Davidson &lt;christopher.davidson@gmail.com&gt;
MFC after:	2 weeks
Pull Request:	https://github.com/freebsd/freebsd-src/pull/993
</content>
</entry>
</feed>
