Hi,

s-nail 14.9.11-1 on Arch Linux.

On running this command, I type the four characters ‘bar\n’, and then
Ctrl-D, my TTY's EOF character, before the three seconds have elapsed.
It appears thus, with ‘␣’ being the cursor.

    $ sleep 3; mail -s foo $LOGNAME
    bar
    ␣

As mail runs, it changes to

    $ sleep 3; mail -s foo $LOGNAME
    bar
    bar
    ^@␣

Despite my EOF, no shell prompt appears so I type another EOF.  And then
two more.  Only then does mail exit and my $PS1 appear.

    $ sleep 3; mail -s foo $LOGNAME
    bar
    bar
    ^@$ 

In total, one EOF before mail runs, three after.

The email that arrives has the null byte suggested by the ‘^@’.

    $ sed -n \$p `mhpath .`
    YmFyCgA=
    $ sed -n \$p `mhpath .` | base64 -d | od -c
    0000000   b   a   r  \n  \0
    0000005
    $

Type-ahead in the TTY has long been a Unix advantage.  mail's notions of
line-editing is getting in the way.

-- 
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy

Reply via email to