Comment 0 for bug 607099

Revision history for this message
Ralph Corderoy (ralph-inputplus) wrote :

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.