aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/mail
Commit message (Collapse)AuthorAgeFilesLines
* mail: tests: reset signal disposition before testingKyle Evans2025-05-291-0/+11
| | | | | | | | | | | | | | 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
* mail: don't rewrite buffer sizes as muchKyle Evans2025-05-293-11/+13
| | | | | | | | | | 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
* mail: Add test cases for SIGHUP.Dag-Erling Smørgrav2025-05-142-16/+44
| | | | | | | MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D50296
* mail: exit with the correct exit status on SIGHUP in send modeKyle Evans2025-05-141-2/+3
| | | | | | | | | | | | | | | | | | | 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
* mail: remove the SIGHUP handler from lex.cKyle Evans2025-05-142-14/+0
| | | | | | | | | | | | | | | | 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
* mail: Further refine the SIGINT test.Dag-Erling Smørgrav2025-05-061-10/+17
| | | | | | | | | | | | * 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
* mail: Exit non-zero on failure to collect mail.Dag-Erling Smørgrav2025-04-292-3/+6
| | | | | | | | | | 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
* mail: Don't trap signals we shouldn't.Dag-Erling Smørgrav2025-04-274-14/+178
| | | | | | | | | | 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
* Remove residual blank line at start of MakefileWarner Losh2024-07-151-1/+0
| | | | | | | 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
* mail: add volatile in grabh()Lexi Winter2024-01-051-1/+1
| | | | | | | | | | | | | 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 <christopher.davidson@gmail.com> MFC after: 2 weeks Pull Request: https://github.com/freebsd/freebsd-src/pull/993
* usr.bin: Automated cleanup of cdefs and other formattingWarner Losh2023-11-2722-66/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* Remove copyright strings ifdef'd outWarner Losh2023-11-271-9/+0
| | | | | | | | | | | We've ifdef'd out the copyright strings for some time now. Go ahead and remove the ifdefs. Plus whatever other detritis was left over from other recent removals. These copyright strings are present in the comments and are largely from CSRG's attempt at adding their copyright to every binary file (which modern interpretations of the license doesn't require). Sponsored by: Netflix
* usr.bin: Remove ancient SCCS tags.Warner Losh2023-11-2730-82/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* Remove $FreeBSD$: one-line nroff patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-162-2/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-1623-46/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-165-10/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* Update/fix Makefile.depend for userlandSimon J. Gerraty2023-04-191-1/+0
|
* mail: Use a C89 function pointer type for command functions.John Baldwin2023-04-1811-46/+52
| | | | | | | | | The command function is defined to always take a void *. Functions which accept a pointer to an array of pointers use a local temporary 'argv' assigned from the void *arg. Reviewed by: zlei Differential Revision: https://reviews.freebsd.org/D39527
* mail: fix build if TIOCSTI is not definedEd Maste2023-04-101-1/+6
| | | | Sponsored by: The FreeBSD Foundation
* mail: Fix mismatch in array bounds for isign().John Baldwin2022-09-281-1/+1
| | | | | | Reviewed by: imp, emaste Reported by: GCC -Warray-parameter Differential Revision: https://reviews.freebsd.org/D36761
* Replace literal uses of /usr/local in C sources with _PATH_LOCALBASEStefan Eßer2020-10-271-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Literal references to /usr/local exist in a large number of files in the FreeBSD base system. Many are in contributed software, in configuration files, or in the documentation, but 19 uses have been identified in C source files or headers outside the contrib and sys/contrib directories. This commit makes it possible to set _PATH_LOCALBASE in paths.h to use a different prefix for locally installed software. In order to avoid changes to openssh source files, LOCALBASE is passed to the build via Makefiles under src/secure. While _PATH_LOCALBASE could have been used here, there is precedent in the construction of the path used to a xauth program which depends on the LOCALBASE value passed on the compiler command line to select a non-default directory. This could be changed in a later commit to make the openssh build consistently use _PATH_LOCALBASE. It is considered out-of-scope for this commit. Reviewed by: imp MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D26942 Notes: svn path=/head/; revision=367075
* mail/gprof/tip: tap with the ugly stickKyle Evans2020-04-063-40/+85
| | | | | | | | | | | | | | | | | | The ugly stick here is this bit in the respective headers: #ifndef EXTERN #define EXTERN extern #endif with a follow-up #define EXTERN in a single .c file to push all of their definitions into one spot. A pass should be made over these three later to push these definitions into the correct files instead, but this will suffice for now and at a more leisurely pace. MFC after: 3 days Notes: svn path=/head/; revision=359680
* Move mail.rc install to usr.bin/mail.Brad Davis2018-09-181-0/+1
| | | | | | | | | | This leverages CONFS to do the install Approved by: re (blanket, pkgbase), bapt (mentor) Differential Revision: https://reviews.freebsd.org/D17216 Notes: svn path=/head/; revision=338757
* Switch the default pager for most commands to lessAlan Somers2018-08-083-4/+4
| | | | | | | | | | | | Finally, a pager for the nineties. MFC after: Never Relnotes: Yes Differential Revision: https://reviews.freebsd.org/D13465 Poll: https://reviews.freebsd.org/V7 Notes: svn path=/head/; revision=337497
* Replace send-mail with the more standarized sendmail, we do not createXin LI2017-12-271-1/+1
| | | | | | | | | links for send-mail in mailwrapper so it did not work anyway. MFC after: 2 weeks Notes: svn path=/head/; revision=327236
* Don't initialize lastlong before assigning it.Xin LI2017-12-271-1/+0
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=327235
* userland: Fix several typos and minor errorsEitan Adler2017-12-271-1/+1
| | | | | | | | | | | - duplicate words - typos - references to old versions of FreeBSD Reviewed by: imp, benno Notes: svn path=/head/; revision=327230
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-2028-26/+82
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* mailaddr(7): wave goodbyeEitan Adler2017-11-111-7/+0
| | | | | | | | | | | | | | | | The information here is somewhere between ancient to obsolete. It refers to a time in the internet's history when manual routing was still useful, talks about UUCP as if its modern, and refers to documents which I had trouble tracking down. It seems unlikely that a manual page in this form would be useful, so just remove it. Reviewed By: imp, tsoome, bdrewery(?) Differential Revision: https://reviews.freebsd.org/D12924 Notes: svn path=/head/; revision=325702
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* Renumber copyright clause 4Warner Losh2017-02-2829-29/+29
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* Remove useless Li macroBaptiste Daroussin2017-02-111-1/+1
| | | | | | | | Reported by: make manlint MFC after: 2 days Notes: svn path=/head/; revision=313672
* Don't reference NULL pointer.Xin LI2017-01-241-1/+3
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=312683
* Always initialize 'c'.Xin LI2017-01-231-1/+1
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=312664
* When creating record file, use umask 077 instead of the default.Xin LI2017-01-231-1/+6
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=312663
* mail(1): Minor declaration updates.Pedro F. Giffuni2016-07-151-1/+1
| | | | | | | Missing from r302903. Notes: svn path=/head/; revision=302914
* mail(1): Avoid closing negative file descriptors.Pedro F. Giffuni2016-07-152-2/+6
| | | | | | | | CID: 1008105, 1008106 MFC after: 1 week Notes: svn path=/head/; revision=302911
* mail(1): Update more prototypes.Pedro F. Giffuni2016-07-156-96/+123
| | | | | | | | | | Also rename delete and undelete_messages to deletecmd and undeletecmd respectively in an attempt to sync with other BSDs. Obtained from: OpenBSD Notes: svn path=/head/; revision=302903
* mail(1): check for out of memory conditions when calling calloc(3).Pedro F. Giffuni2016-07-141-1/+2
| | | | | | | X-MFC with: r302771 Notes: svn path=/head/; revision=302845
* mail(1): Bring some fixes from other BSDs.Pedro F. Giffuni2016-07-141-9/+18
| | | | | | | | | Fix missing forked job changes from r302776 in wait_child(). Obtained from: NetBSD Notes: svn path=/head/; revision=302799
* mail(1): Bring some fixes from other BSDs.Pedro F. Giffuni2016-07-138-69/+99
| | | | | | | | | | | | - Use varargs properly - Use pid_t - Better handling of error conditions on forked jobs. - Some prototype and warning cleanups. Obtained from: NetBSD (some originaly from OpenBSD) Notes: svn path=/head/; revision=302776
* mail(1): check for out of memory conditions when calling calloc(3).Pedro F. Giffuni2016-07-131-3/+6
| | | | | | | | Suggested by: oshogbo MFC after: 3 days Notes: svn path=/head/; revision=302771
* Use _PATH_DEVNULL instead of hardcoding.Xin LI2016-07-111-2/+2
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=302542
* mail(1): Fix a comment.Pedro F. Giffuni2016-07-111-1/+1
| | | | | | | Obtained from: NetBSD (CVS Rev 1.29) Notes: svn path=/head/; revision=302533
* mail(1): Invert calloc(3) argument order.Pedro F. Giffuni2016-07-102-3/+3
| | | | | | | | | calloc(3) is documented to have first a number and then a size. Obtained from: OpenBSD (through NetBSD) Notes: svn path=/head/; revision=302511
* Always return either a dynamically allocated string or NULL fromDon Lewis2016-05-131-2/+2
| | | | | | | | | | | | | expand(). Never return the name parameter, which could be a the buf[] buffer which is allocated on the stack by getdeadletter() and which would then be used after getdeadletter() has returned. Reported by: Coverity CID: 1199383 MFC after: 1 week Notes: svn path=/head/; revision=299591
* mail: Don't truncate mtime of mailbox to microseconds.Jilles Tjoelker2016-04-171-8/+8
| | | | Notes: svn path=/head/; revision=298157
* Fix naive use of ftell(3).Pedro F. Giffuni2016-02-161-1/+1
| | | | | | | Secure coding practices, FIO19-C. Notes: svn path=/head/; revision=295675
* Add META_MODE support.Simon J. Gerraty2015-06-131-0/+18
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Off by default, build behaves normally. WITH_META_MODE we get auto objdir creation, the ability to start build from anywhere in the tree. Still need to add real targets under targets/ to build packages. Differential Revision: D2796 Reviewed by: brooks imp Notes: svn path=/head/; revision=284345