Richard Hector wrote: > Some time between lenny and squeeze (and before lucid, but I haven't > searched further), mail changed its arguments. > > lenny: -e Don't send empty mails. If the body is empty skip the mail. > squeeze/lucid: -E Don't send messages with an empty body. > > .. and -e is gone. > > I looked in the (upstream) changelog, and it shows the addition of the > -E flag, with no reference to -e whatsoever :-(
Apparently -e was a Debian specific addition. You can see it in the patches for the package in the Lenny version here: http://ftp.de.debian.org/debian/pool/main/b/bsd-mailx/bsd-mailx_8.1.2-0.20071201cvs-3.diff.gz + case 'e': + /* + * Don't send empty mails. + * Set the variable "notempty" + */ + assign("notempty", ""); + break; It never existed in the OpenBSD source that Debian was using as upstream. And the option itself is non-portable. In the HP-UX version of mailx for example -e does something completely different. -e Test for presence of mail. mailx prints nothing and exits with a successful return code if there is mail to read. Sometimes used in login scripts such as $HOME/.profile to check for mail during login. Then in the OpenBSD the -E option was added. Although the functionality is similar the implementation (as you found) was slightly different. http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/mail/main.c?r1=1.21#rev1.21 http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/mail/main.c.diff?r1=1.20;r2=1.21;f=h case 'E': /* * Don't send messages with an empty body. */ assign("skipempty", ""); break; When that migrated into Debian it appears that Debian has dropped the Debian specific patch that added -e since -E is basically the same thing. No need for both. > This is really annoying, but must have been struck by other people - and > other scripts. Cases like this are why when people request that Debian make local patches that I usually think it is a bad idea. For the time that it is in Debian it is different here there elsewhere. And in most cases where the feature is worthwhile and eventually gets added upstream it often gets added differently. Then we have to go through the transition just like this. Better to make the feature upstream. > Any suggestions what the best answer is for a script that needs to be > deployed on both? I'm deploying it with a locally built debian package, > so I guess I could check the version in the postinst ... or just build > different packages with different dependencies, which is probably the > most reliable, but also the most work :-( Here are a few thoughts: I don't use -e because for me it is already non-portable across systems. I would run into problems on other systems that I need to support. And the addition of -E doesn't help me either. When I don't want to send mail I simply don't send mail. I guess it is a little bit more work but I have done it so many times that I don't even think about it anymore. I save the output to a temporary file and then check to see if the file is empty before sending it off in email. What are you trying to do? Perhaps there would be a suggestion from the group. Bob
signature.asc
Description: Digital signature