bsd-mailx's mail(1) has been patched to treat an empty line as an empty body

Bug #607099 reported by Ralph Corderoy
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
bsd-mailx (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: bsd-mailx

bsd-mailx 8.1.2-0.20090911cvs-2ubuntu1 on 10.04 treats a mail body
that's a single empty line as a empty body. This causes a warning on
stdout that's impossible to silence through any option, and is broken
behaviour compared to the long-existing mail(1) program on different
Unixes over the years.

    $ mail -s test ralph </dev/null
    Null message body; hope that's ok
    $ echo | mail -s test ralph
    Null message body; hope that's ok
    $ echo | hd
    00000000 0a |.|
    00000001
    $

The first diagnostic is correct, there was no message body. The second
is wrong, there was a message body, an empty line.

The upstream bsd-mailx does not have this fault. It has been introduced
by the fix to http://bugs.debian.org/355545. I, like commentator Thue
Janus Kristensen, think the bug should have been rejected as it wasn't a
bug but a misunderstanding by the originator. Instead,
bsd-mailx_8.1.2-0.20090911cvs-2ubuntu1.diff.gz on 10.04 includes

    +/* check if file is empty or contains only a new line */
    +/* Debian Bug#355545 */
    +static int fisempty(FILE *mtf)
    +{
    + off_t size;
    + char c;
    + if ((size = fsize(mtf)) == 0) return 1;
    + if (size > 1) return 0;
    + fseek(mtf, 0, SEEK_SET);
    + c = fgetc(mtf);
    + fseek(mtf, 0, SEEK_SET);
    + return (c == '\n');
    +}

This needs removing and the call to it reverting to the pre-patch

    if (fsize(mtf) == 0) {

As it stands, long-term scripts that do `echo | mail ...' in order to
avoid the warning on stdout now fail. It is not them in the wrong, as
is confirmed by package heirloom-mailx's mail(1), and mail(1) on other
Unixes.

Please drop this Debian change.

Nathan Baum (nbaum)
description: updated
Nathan Baum (nbaum)
Changed in bsd-mailx (Ubuntu):
status: New → Confirmed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package bsd-mailx - 8.1.2-0.20131005cvs-1

---------------
bsd-mailx (8.1.2-0.20131005cvs-1) unstable; urgency=low

  * New upstream version from OpenBSD CVS repository.
  * Remove 23-Treat-new-line-only-messages-as-empty-ones.patch, introduced
    in 1:8.1.2-0.20071017cvs-1 so that bsd-mailx will behave like other mailx
    implementations and will not treat messages containing a single new line
    only as an empty ones (LP: #607099, reopens #355545).
  * Extend description of this package to mention the fact that bsd-mailx lacks
    many features that may be found in other packages like heirloom-mailx
    or mailutils (closes: #508303).
  * Add 26-Fix-confusing-error.patch to make a message given when -b is used
    without -t less confusing (closes: #327809).
  * Fix 00-Makefile.patch not to override CC and pass CPPFLAGS while compiling.
  * debian/rules:
    + apply patch from Ubuntu to respect DEB_HOST_GNU_TYPE when selecting CC
      for cross-compiling;
    + do not try to run make clean on unpatched Makefile.
  * Bump Standards-Version to 3.9.4 (no changes).

 -- Robert Luberda <email address hidden> Sun, 06 Oct 2013 11:58:42 +0200

Changed in bsd-mailx (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.