On 2012-07-25 at 16:48 ADT, Jorgen Grahn <grahn+n
...@snipabacken.se> wrote:
> On Wed, 2012-07-25, blmblm myrealbox.com wrote:
>> I recently noticed an interesting(?) problem when I invoke mutt
>> from a shell script and then press control-Z to (try to!) suspend
>> both mutt and the script. The "suspend" part works fine and takes
>> me back to the bash prompt, but when I type "fg" to try to get
>> back to where I was, well ....
>> On *one* of the systems where I've tried it, it works fine; on
>> the others, mutt sort of starts up again (in that whatever it was
>> displaying shows up again), but then it doesn't respond correctly
>> to keyboard input -- it seems to basically ignore most keystrokes,
>> with the exception of <CR> and control-C, though I can exit with
>> "xx<CR>" and "qq<CR>" (which I discovered more or less by accident).
>> All the systems where I've tried this are running some sort of
>> RedHat-derived Linux, with bash versions ranging from 3.00.16(1)
>> to 4.1.7(1), and mutt versions ranging from 1.4.2.1i to 1.5.21.
>> The one where things work fine is of course the one with the oldest
>> version of both programs. ("Of course" because that's the most
>> annoying possibility. :-)? )
> [...]
> I can reproduce this on Debian stable, in an xterm. More specifically,
> my first 'fg' brings up the mutt display, but overlayed on it another
> shell prompt. Another 'fg' there, and I'm inside Mutt alright --
> except it's messed up like you describe.
> Really weird -- job control normally seems to Just Work.
> It's not the shell's fault because a zsh script behaves the same way
> (and I bet csh would too).
Yup, I just wrote a csh script and got the same issue.
This has annoyed me for a while (on a variety of Slackware systems)
when I use grepm (which uses grepmail to search through some mail
boxes, in case anyone here doesn't know about it).
I notice that (in some cases, not all, maybe there is some race
condition) that the tty modes are incorrect when "fg" doesn't work
properly.
My tty modes when shell is waiting for a command (note I use ^X for
suspend, not ^Z):
speed 38400 baud; rows 57; columns 80; line = 0;
intr = ^C; quit = <undef>; erase = ^?; kill = ^U; eof = ^Z; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = <undef>;
rprnt = ^R; werase = ^W; lnext = <undef>; flush = <undef>; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint ignpar -parmrk -inpck -istrip inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig -icanon iexten -echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke
My tty modes when mutt is running:
speed 38400 baud; rows 57; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^Z; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^X; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl ixon -ixoff
-iuclc -ixany imaxbel iutf8
opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig -icanon iexten -echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke
and finally, my tty modes when when I did "fg" but got an incorrectly
restarted mutt:
speed 38400 baud; rows 57; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^Z; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^X; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke
I wonder if mutt traps the SIGTSTP to restore the terminal modes, but
somehow the change of tty modes when starting back up this doesn't
always cooperate with the shell's setting of terminal modes (when mutt
is called from a shell script).
Any mutt maintainers / hackers listening? If so, any words of wisdom?
Cheers.
Jim