Am Sun, 19 Mar 2017 10:17:02 +0100
schrieb Matthias Hanft <m...@hanft.de>:

> Kai Krakow wrote:
> > 
> > After ctrl+c'ing out of programs like tailf, SSH password prompts,
> > in the middle of a shell scripts, the shell echo is not restored  
> 
> Not here, but something similar: Immediately after ctrl+c'ing, no
> shell prompt is displayed (in fact, *nothing* is displayed) - but
> it's just the display; I can enter a shell command (with echo, too)
> which will be executed properly. Or just press the RETURN key on the
> empty line to get the shell prompt again.
> 
> This happens just on a single of my Gentoo systems (and not always,
> but very often).
> 
> Any idea?

Yes, this can sneak upon you if you ctrl+c a program with child
processes, and part of the teardown is that a child displays a line
after control has already been returned to the shell.

What happens now is: Your shell displays the prompt, the child process
echos a carriage return and echos text, overwriting your prompt,
and putting a newline, child now also exits. If your prompt was long
enough, you may still see the rest of it. You end up with a sole
blinking cursor on an empty line. Hitting enter produces a new shell
prompt.

There's no way to work around it except by maybe putting a sleep inside
the PS1 variable. But I'm sure you don't want that. ;-)

Tho, thinking about this, your case may have the same underlying bug in
common: delayed termination of child processes.

-- 
Regards,
Kai

Replies to list-only preferred.


Reply via email to