Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Bash regularly stops echoing to terminal
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
kentnl
n00b
n00b


Joined: 17 Mar 2015
Posts: 4

PostPosted: Tue Mar 17, 2015 3:14 am    Post subject: Bash regularly stops echoing to terminal Reply with quote

I've had a longish term problem ( I started noticing it it shortly after the new bash-completion system rolled out ) which has been pestering me profusely and I've had difficulty boiling it down to something, especially reproducible.

The general symptoms are that bash randomly stops echoing to the terminal, and there's no way to get the terminal to return to
normal without invoking Ncurses reset ( /usr/bin/reset ) to restore TTY echos.

And the occurrence of blocking occurs practically for any command I might run.

The following (non-exhaustive list) commands have triggered it, but none of them trigger it repeatedly, the problem will happen whenever it feels like, and then will promptly cease happening for an hour or more.

  • ls
  • find
  • gvim
  • scite
  • git

The problem is not terminal specific either, and has been observed in Yakuake, Urxvt, and Xterm, both inside and outside of tmux.

And it happens on both of my machines, and as both root and user accounts.

I've tried setting PS1 and PROMPT_COMMAND to dummy values has had no observable benefit.

The only thing that appears to have been useful so far is

Code:
shopt -u progcomp


Which entirely disables programmable tab completion, and makes using Linux entirely frustrating.

I've tried aggressively strace-ing and ltrace-ing bash to see where it may be invoking problems that trip into terminal setting/ncurses functions. Couldn't find anything relevant.

Tried scraping my system to find any residual files that may have pertained to legacy bash installations that may have been introducing conflicts, nothing can be found.

I'm open to the possibility one of my bash completions I have installed ( and the latest bash-completion system obviously automagically uses ) is possibly triggering bad behaviour somehow, but with well over 700 of them all automatically enabled by default, I'm at a bit of a loss to start working out which ones it might be.


Useful contexts:

# Machine 0 # qfile -e -C -q /usr/share/bash-completion | sort
Code:

app-admin/eselect-1.4.4
app-editors/gvim-7.4.622
app-editors/vim-7.4.622
app-editors/vim-core-7.4.622
app-emulation/docker-1.3.1
app-emulation/lxc-1.1.0-r3
app-misc/tmux-1.9a
app-portage/eix-0.30.4
app-shells/bash-completion-2.1_p20141224
app-shells/gentoo-bashcomp-20140911
dev-lang/R-3.1.2
dev-lang/ghc-7.8.4
dev-libs/appstream-glib-0.3.4
dev-libs/dbus-glib-0.102
dev-libs/glib-2.42.2
dev-python/pygments-2.0.2
dev-ruby/rake-10.4.2
dev-tex/latexmk-441
dev-util/cmake-3.1.0
dev-util/ninja-1.5.3
dev-util/source-highlight-3.1.7-r2
dev-vcs/bzr-2.6.0
dev-vcs/git-2.3.1
dev-vcs/mercurial-3.3
dev-vcs/subversion-1.8.11
gnome-base/dconf-0.22.0
gnome-base/gvfs-1.22.3
media-gfx/scrot-0.8_p13
media-sound/pulseaudio-5.0-r7
net-misc/aria2-1.18.9
net-misc/networkmanager-1.0.0
net-misc/youtube-dl-2015.02.20
sys-apps/kmod-20
sys-apps/paludis-2.2.0
sys-apps/systemd-219-r2
sys-apps/util-linux-2.26
sys-boot/grub-2.02_beta2-r7
sys-fs/udisks-1.0.5-r1
sys-fs/udisks-2.1.4
sys-kernel/dracut-041
x11-misc/colord-1.2.9
x11-wm/herbstluftwm-0.6.2-r1


# Machine 1 # qfile -e -C -q /usr/share/bash-completion | sort
Code:

app-admin/eselect-1.4.3
app-crypt/shash-0.2.6-r2
app-editors/gvim-7.4.542
app-editors/vim-7.4.542
app-editors/vim-core-7.4.542
app-i18n/ibus-1.5.3
app-misc/tmux-1.9a
app-portage/eix-0.30.4
app-portage/genlop-0.30.10
app-shells/bash-completion-2.1-r93
app-shells/gentoo-bashcomp-20140911
app-text/tree-1.7.0
dev-lang/ghc-7.6.3-r1
dev-libs/dbus-glib-0.100.2
dev-libs/glib-2.42.2
dev-ruby/rake-10.4.2
dev-util/cmake-3.0.2
dev-util/source-highlight-3.1.7-r2
dev-vcs/git-2.2.1
dev-vcs/mercurial-3.2.2
dev-vcs/subversion-1.8.11
gnome-base/dconf-0.16.1
media-sound/boodler-2.0.4-r1
media-sound/pulseaudio-5.0-r6
net-misc/aria2-1.18.7
net-misc/networkmanager-1.0.0
net-misc/youtube-dl-2014.12.17.2
sys-apps/kmod-19
sys-apps/paludis-2.2.0
sys-apps/util-linux-2.26
sys-boot/grub-2.02_beta2-r6
sys-fs/udev-218
sys-fs/udisks-2.1.4
sys-fs/zfs-0.6.3-r2
sys-kernel/dracut-041


# Common packages
Code:

app-admin/eselect
app-editors/gvim
app-editors/vim
app-editors/vim-core
app-misc/tmux
app-portage/eix
app-shells/bash-completion
app-shells/gentoo-bashcomp
dev-lang/ghc
dev-libs/dbus-glib
dev-libs/glib
dev-ruby/rake
dev-util/cmake
dev-util/source-highlight
dev-vcs/git
dev-vcs/mercurial
dev-vcs/subversion
gnome-base/dconf
media-sound/pulseaudio
net-misc/aria2
net-misc/networkmanager
net-misc/youtube-dl
sys-apps/kmod
sys-apps/paludis
sys-apps/util-linux
sys-boot/grub
sys-fs/udisks
sys-kernel/dracut
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6921

PostPosted: Tue Mar 17, 2015 6:04 am    Post subject: Reply with quote

Same here on at least 4 machines, it's been broken a few months. Seems to be exacerbated if I ctrl+c commands (even simple ones that don't mess with the term).
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6399

PostPosted: Tue Mar 17, 2015 6:18 am    Post subject: Reply with quote

I cannot confirm, but I am a zsh user. Maybe you can try whether it breaks with zsh, too. (I would recommend to use zsh as an interactive shell, anyway, but that's a different story.)

With Ubuntu, I had on several machines a similar issue, but it might be different: The terminal just does not get updated. However, just pressing "enter" sometimes(!) solves it. However, I think on Ubuntu it is a graphics driver issue (although it happens only in terminal...)
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Tue Mar 17, 2015 6:42 am    Post subject: Reply with quote

I'd ask in #bash on IRC: chat.freenode.net.

Sorry, don't use completion myself, but plenty of people in there do, as you might imagine; and they have the expertise to help you resolve it in about half an hour.
Back to top
View user's profile Send private message
kentnl
n00b
n00b


Joined: 17 Mar 2015
Posts: 4

PostPosted: Tue Mar 17, 2015 4:42 pm    Post subject: Reply with quote

Ant P. wrote:
Same here on at least 4 machines, it's been broken a few months. Seems to be exacerbated if I ctrl+c commands (even simple ones that don't mess with the term).


I felt a similar experience, but I dismissed it due to the frequency it also happened after simple process exits, and figured ctrl+c was just a perceptual glitch in my brain due. =)

Something else I feel related:

Its propensity to happen is *higher* on terminals that have been left disused for a bit prior to executing the command.

Could also be connected to some files being cold-cached because I feel the disk IO LED does seem to have been flickering heavily prior to having a stoppage.
Back to top
View user's profile Send private message
kentnl
n00b
n00b


Joined: 17 Mar 2015
Posts: 4

PostPosted: Tue Mar 17, 2015 4:46 pm    Post subject: Reply with quote

mv wrote:
The terminal just does not get updated. However, just pressing "enter" sometimes(!) solves it


Yeah. Never really happened like that for me.

mv wrote:
However, I think on Ubuntu it is a graphics driver issue (although it happens only in terminal...)


Yeah, does sound distinct. I should note that I've also had this happen in a native linux VT without X or any kind of advanced display stuff running. So unlikely to be graphics unless my graphics card is super cookied
Back to top
View user's profile Send private message
blakedude
n00b
n00b


Joined: 05 Mar 2005
Posts: 45
Location: Colorado Springs

PostPosted: Thu Jun 25, 2015 4:33 pm    Post subject: Reply with quote

I have been seeing this same problem for a couple of weeks now, every since I recompiled all the packages that use bash-completion per the news item titled "bash-completion-2.1-r90". Same symptoms, having to type reset a few times per day. I use konsole for terminal.

Did this issue get fixed somewhere? Does anyone have a solution?
Back to top
View user's profile Send private message
blakedude
n00b
n00b


Joined: 05 Mar 2005
Posts: 45
Location: Colorado Springs

PostPosted: Fri Jul 17, 2015 6:30 pm    Post subject: Reply with quote

I was hoping this problem would fix itself with portage updates, but it's been a month and I'm still seeing the problem. It seems to occur more often after pressing ctrl-C to stop something. Then you have to type reset to be able to see what you are typing into the terminal. Output of commands still shows up, just not your input.

I should also mention this happens on my home desktop machine, and my work laptop. They have similar installs, but not identical.

Not the end of the world, but it is annoying. Anyone have ideas of thing to try to fix this?
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Sat Jul 18, 2015 8:26 am    Post subject: Reply with quote

blakedude wrote:
Anyone have ideas of thing to try to fix this?

What I said in March; ask #bash; they'll help you find out which completion file is causing the problem, and how, so you can then patch it locally and file a bug with the patch.
Back to top
View user's profile Send private message
MustrumR
n00b
n00b


Joined: 15 Nov 2011
Posts: 71
Location: Right here

PostPosted: Sat Jul 18, 2015 1:56 pm    Post subject: Reply with quote

I've been having the same problem. Try running-
Code:

$ stty


If it shows -echo, this means that something has disabled terminal echo. This is more probable over terminal emulator glitches.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6921

PostPosted: Mon Nov 23, 2015 4:33 pm    Post subject: Reply with quote

Well, I've been silently putting up with bash/debian's broken BS for 6 months and I'm annoyed enough today to want to complain again. But it turns out I'd already done that in this thread and forgot about it entirely, so good thing I checked first.

Debugging this with symptoms that aren't reliably reproducible is too much effort, so I'm going to revert to the behaviour that I *know* used to work: whitelisting.
Code:
# cd /usr/share/bash-completion/completions
# eselect bashcomp disable *

(yeah yeah, I know, I could spend all week bisecting it. I just want my command line to *work*)
Back to top
View user's profile Send private message
javispedro
n00b
n00b


Joined: 11 Mar 2013
Posts: 14

PostPosted: Tue Jan 12, 2016 12:17 pm    Post subject: Reply with quote

Finally found someone with the same problems!

This is driving me completely crazy. In fact at some point I noticed I found a way to 100% reproduce it using any Gtk+ graphical text editor that doesn't fork, for example GEdit or Pluma.

0. Ensure all pre-eexisting Pluma instances are closed.
1. Open a new terminal
2. Type "pluma a"
3. Press TAB
4. Now press Enter.
5. Move focus back to terminal window and Ctrl+Z
4. Local echo is now lost forever on that terminal until you "reset".

Why it has to be a Gtk+ editor? No idea! It's not a Gtk+ problem, since if you don't autocomplete then it works perfectly fine. It's driving me crazy...

Ant P. wrote:
Code:
# cd /usr/share/bash-completion/completions
# eselect bashcomp disable *
Curiously enough this doesn't actually do anything here, i.e. the problem still manifests consistently after disabling all completions and restarting bash.

However, I've come to notice something particularly strange. On file /usr/share/bash-completion/bash_completion, function _completion_loader, around line 1960, there are two if statements like this:
Code:
    if grep -q -s "${1##*/}" /etc/bash/completion.blacklist; then
        if ! grep -q -s "${1##*/}" ~/.config/bash_completion.whitelist; then
            complete -F _minimal "$1" && return 124
            return 1
        fi
    fi
    if grep -q -s "${1##*/}" ~/.config/bash_completion.blacklist; then
        complete -F _minimal "$1" && return 124
        return 1
    fi

Commenting out all of them reliably fixes the problem. It's very interesting because the contents of the if statements are never run, it's actually the grep that makes local echo fail.

In fact, if the _completion_loader function calls any non-builtin command, like /bin/grep or /bin/true, then local echo is lost. Seems to point towards an actual Bash bug rather than in the completion scripts.

My workaround so far has been to add a call to "stty echo" in there... works and I don't need to uninstall bashcomp.

Is this what's happening to any of you? Could you check?
Back to top
View user's profile Send private message
BobWya
Apprentice
Apprentice


Joined: 12 Aug 2012
Posts: 230
Location: Cambridge,UK

PostPosted: Thu Jan 14, 2016 1:32 am    Post subject: Reply with quote

javispedro wrote:
Finally found someone with the same problems!

However, I've come to notice something particularly strange. On file /usr/share/bash-completion/bash_completion, function _completion_loader, around line 1960, there are two if statements like this:
Code:
    if grep -q -s "${1##*/}" /etc/bash/completion.blacklist; then
        if ! grep -q -s "${1##*/}" ~/.config/bash_completion.whitelist; then
            complete -F _minimal "$1" && return 124
            return 1
        fi
    fi
    if grep -q -s "${1##*/}" ~/.config/bash_completion.blacklist; then
        complete -F _minimal "$1" && return 124
        return 1
    fi

Commenting out all of them reliably fixes the problem. It's very interesting because the contents of the if statements are never run, it's actually the grep that makes local echo fail.

In fact, if the _completion_loader function calls any non-builtin command, like /bin/grep or /bin/true, then local echo is lost. Seems to point towards an actual Bash bug rather than in the completion scripts.

My workaround so far has been to add a call to "stty echo" in there... works and I don't need to uninstall bashcomp.

Is this what's happening to any of you? Could you check?


Ah interesting... Looking at my Arch Linux version of that file the _completion_loader function is quite different from my (stock) Gentoo one:
Code:

# set up dynamic completion loading
_completion_loader()
{
    local compdir=./completions compfile
    [[ $BASH_SOURCE == */* ]] && compdir="${BASH_SOURCE%/*}/completions"

    for compfile in "${1##*/}" _"${1##*/}"; do
        compfile="$compdir/$compfile"
        # Avoid trying to source dirs; https://bugzilla.redhat.com/903540
        [[ -f "$compfile" ]] && . "$compfile" &>/dev/null && return 124
    done

    # Need to define *something*, otherwise there will be no completion at all.
    complete -F _minimal "$1" && return 124
} &&
complete -D -F _completion_loader


I haven't had too encountered this issue too much in recent times on my Gentoo installs (BASH) though... 8O

Bob
_________________
system: G751JT (ASUS-NotebookSKU); processor: Intel(R) Core(TM) i7-4710HQ CPU @ 2.50GHz; memory: 32GiB System Memory; display: GM204M [GeForce GTX 970M]; disk: 2048GB Samsung SSD 850;BD-CMB UJ172 S;1024GB Samsung SSD 850
Back to top
View user's profile Send private message
thiemel
n00b
n00b


Joined: 20 Sep 2017
Posts: 1

PostPosted: Wed Sep 20, 2017 9:41 am    Post subject: Reply with quote

Ant P. wrote:
Well, I've been silently putting up with bash/debian's broken BS for 6 months and I'm annoyed enough today to want to complain again. But it turns out I'd already done that in this thread and forgot about it entirely, so good thing I checked first.

Debugging this with symptoms that aren't reliably reproducible is too much effort, so I'm going to revert to the behaviour that I *know* used to work: whitelisting.
Code:
# cd /usr/share/bash-completion/completions
# eselect bashcomp disable *

(yeah yeah, I know, I could spend all week bisecting it. I just want my command line to *work*)


Hey, thank you very much. You helped me a lot.
It seems like ^Z issue with gentoo-bashcomp


Code:

ftp1 ~ # stty
speed 38400 baud; line = 0;
eol = M-^?; eol2 = M-^?;
-brkint ixany iutf8
ftp1 DATA # chown -R krtek:krtek /FOTO/
^Z
[1]+  Stopped                 chown -R krtek:krtek /FOTO/
ftp1 DATA # ftp1 DATA # speed 38400 baud; line = 0;   <--- launched "stty"
eol = M-^?; eol2 = M-^?; lnext = <undef>; min = 1; time = 0;
-brkint -icrnl ixany iutf8
-icanon -echo
ftp1 DATA # ftp1 DATA #   <--- launched "stty echo"
ftp1 DATA #
ftp1 DATA # stty
speed 38400 baud; line = 0;
eol = M-^?; eol2 = M-^?; lnext = <undef>; min = 1; time = 0;
-brkint -icrnl ixany iutf8
-icanon




Uninstalled "app-shells/gentoo-bashcomp-20140911
Code:

ftp1 ~ # stty
speed 38400 baud; line = 0;
eol = M-^?; eol2 = M-^?;
-brkint ixany iutf8
ftp1 ~ # chown -R krtek:krtek /FOTO/
^Z
[1]+  Stopped                 chown -R krtek:krtek /FOTO/
ftp1 ~ # stty
speed 38400 baud; line = 0;
eol = M-^?; eol2 = M-^?;
-brkint ixany iutf8



After reinstalation of "app-shells/gentoo-bashcomp-20140911
Code:

ftp1 ~ # stty
speed 38400 baud; line = 0;
eol = M-^?; eol2 = M-^?;
-brkint ixany iutf8
ftp1 ~ # chown -R krtek:krtek /FOTO/
^Z
[1]+  Stopped                 chown -R krtek:krtek /FOTO/
ftp1 ~ # stty
speed 38400 baud; line = 0;
eol = M-^?; eol2 = M-^?;
-brkint ixany iutf8
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum