Hi Steffen,
> > 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
> > ^@␣
>
> I presume you have no*ignoreeof* and no*asksend* set.
$ cat ~/.mailrc
unset askcc
unset asksend
set encoding=8bit
set sendcharsets=utf-8
set dot
set sendwait
set line-editor-disable
set stealthmua=noagent
$
> I wonder whether you would be helped with a shell alias that sets
> *line-editor-disable* in addition, it would release the system from
> quite some unnecessary burdens in this case.
I see it is set.
> > 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.
>
> Yes, in raw terminal mode VEOF has no meaning actually.
Agreed. But as a user I shouldn't need to know that it's switched to
raw mode. mail(1) used to be happy taking the TTY's EOF.
> > The email that arrives has the null byte suggested by the ‘^@’.
>
> If you input a NUL byte we will not mangle you. Good.
I did not input a NUL. As I said above, it was `bar\n' and Ctrl-D. And
raw mode doesn't turn Ctrl-D into NUL. Here, I type `abc' Ctrl-D `def',
wait for the `.', then Enter and Ctrl-D.
$ (trap '' TTOU; old=`stty -g`; stty raw; sleep 3; stty $old; printf .) &
od -c
abc^Ddef.
0000000 a b c 004 d e f \n
0000010
$
The Ctrl-D correctly appears as EOT, as I'd expect in raw mode.
--
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy