Austin Group Defect Tracker

Aardvark Mark IV

Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0001367 [1003.1(2016/18)/Issue7+TC2] Shell and Utilities Editorial Enhancement Request 2020-07-08 22:55 2020-07-09 13:25
Reporter steffen View Status public  
Assigned To
Priority normal Resolution Open  
Status New  
Name Steffen Nurpmeso
User Reference
Section Vol. 3: Shell and Utilities, mailx
Page Number 2943, 2944
Line Number 97431, 97471 ff.
Interp Status ---
Final Accepted Text
Summary 0001367: mailx: add -E option to discard (not send) empty messages
Description The mailx variants of Apple, NetBSD, OpenBSD as well as other Open Source incarnations, support a command line option -E that rejects sending empty messages, successfully.

This is very helpful in scripted use cases since possible error notifications will only be send out if necessary.

The backing value ("INTERNAL VARIABLE") is different (skipemptybody, dontsendempty, skipempty, to name a few), but the behaviour of the -E option itself is identical.

The only known mailx incarnation which does not support -E is Solaris (OpenIndiana inspected), but the implementation is simplicistic since mailx warns on empty messages, the code change would need to turn

  if (fsize(mtf) == 0 && hp->h_subject == NOSTR) {
    printf(gettext("No message !?!\n"));
    goto out;


  if (fsize(mtf) == 0) {
    if (value("dontsendempty") != NOSTR)
      goto jout;
    if (hp->h_subject == NOSTR) {
      printf(gettext("No message !?!\n"));
      goto out;
Desired Action On page 2943, line 97431, change

  mailx [−s subject] address...


  mailx [-E] [−s subject] address...

On page 2944, insert after line 97471

  -E Discard messages with an empty message body, successfully.
Tags No tags attached.
Attached Files

- Relationships
related to 0001368New Unworldly use of redirection and mailx(1) in at(1) and batch(1) examples. 

-  Notes
geoffclare (manager)
2020-07-09 08:01
edited on: 2020-07-09 08:01

Line 98259 in EXIT STATUS also needs to change. I suggest changing:
Successful completion; note that this status implies that all messages were sent, ...
Successful completion; note that this status implies that all messages were sent, or successfully discarded (see -E), ...

steffen (reporter)
2020-07-09 13:25

..and the Solaris / OpenIndiana should allow all-empty messages by default, nothing is wrong with them, they are the shortest possible mail-based notification ("ping"), which in practice is nice since in practice the MTA / LDA (Mail-Transfer-Agent, Local-Delivery-Agent) adds at least a so-called From_, but especially the former also a From: line, for example

  #?0|kent:steffen$ </dev/null mailx -:/ root
  mailx: No message, no subject; hope that's ok
  #?0|kent:steffen$ tail -n 13 /var/spool/mail/steffen

  From steffen@localhost Thu Jul 9 15:22:56 2020
  Received: from steffen (uid 1000)
          (envelope-from steffen@localhost)
          id a791
          by kent (DragonFly Mail Agent v0.13);
          Thu, 09 Jul 2020 15:22:56 +0200
  Date: Thu, 09 Jul 2020 15:22:56 +0200
  To: root
  User-Agent: mailx v14.9.19
  Message-Id: <5f071a30.a791.1071c30e@kent>
  From: <steffen@localhost>


The BSD based code does

        if (fsize(mtf) == 0) {
                if (value("skipempty") != NULL)
                        goto out;
                if (hp->h_subject == NULL || *hp->h_subject == '\0')
                        puts("No message, no subject; hope that's ok");
                        puts("Null message body; hope that's ok");

Which, finally, and as an off-topic note, makes me think the root of the related issue 0001368 was caused by experiences with SysV based mail.

- Issue History
Date Modified Username Field Change
2020-07-08 22:55 steffen New Issue
2020-07-08 22:55 steffen Name => Steffen Nurpmeso
2020-07-08 22:55 steffen Section => Vol. 3: Shell and Utilities, mailx
2020-07-08 22:55 steffen Page Number => 2943, 2944
2020-07-08 22:55 steffen Line Number => 97431, 97471 ff.
2020-07-09 08:01 geoffclare Note Added: 0004895
2020-07-09 08:01 geoffclare Note Edited: 0004895
2020-07-09 08:02 geoffclare Relationship added related to 0001368
2020-07-09 13:25 steffen Note Added: 0004896

Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker