According to the POSIX definitions for mail(1), the (s)ave command should save to "mbox" if the file is not specified > Save the specified messages in the file named > by the pathname file, or the mbox if the file > argument is omitted https://pubs.opengroup.org/onlinepubs/9699919799/utilities/mailx.html#tag_20_75_13_33 > s[file] > Save the message in the named file > (mbox is default). https://pubs.opengroup.org/onlinepubs/7908799/xcu/mail.html#tag_001_014_1339 However, when exercising this functionality, mail(1) on FreeBSD (also tested on OpenBSD where the same issue manifests) doesn't support this: demo$ echo test | mail -s test $USER demo$ mail Mail version 8.1 6/6/93. Type ? for help. "/var/mail/demo": 1 message 1 new >N 1 demo@localhost.my.do Thu Dec 15 19:34 19/775 "test" & s No file specified. While I'm not positive on the solution, I think it involves tweaking the save1() function in src/usr.bin/mail/cmd2.c such that instead of failing if it can't snarf(), it should set `file` to "mbox" or "&" so that expand() points to the mbox as required by POSIX.
Created attachment 238836 [details] Patch from Mark Jamsek on bugs@openbsd to fix issue Reporting this over on the bugs@openbsd mailing list, Mark Jamsek created a quick patch that should update the documentation & behavior to be in line with POSIX requirements: https://marc.info/?l=openbsd-bugs&m=167119629423839&w=2