Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bash-completion erroring out #44

Open
cajeffery opened this issue Oct 1, 2020 · 3 comments
Open

bash-completion erroring out #44

cajeffery opened this issue Oct 1, 2020 · 3 comments

Comments

@cajeffery
Copy link

Hello,
This is what bash-completion-debug shows:

This buffer contains information about the last completion command
and the BASH process it was sent to. This can help you figure out
what's happening.

If it doesn't, go to
https://github.com/szermatt/emacs-bash-completion/issues/new
to create a new issue that describes:

  • what you were trying to do
  • what you expected to happen
  • what actually happened

Then add a copy of the information below:

commandline: <<EOF
__emacs_complete_pre_command; echo -n "��pwd=${PWD}��";__EMACS_COMPLETE_WRAPPER='COMP_LINE='''source(get'''; COMP_POINT=$(( 1 + ${#COMP_LINE} )); COMP_CWORD=1; COMP_WORDS=( source '''(get''' ); _completion_loader source '''(get''' source' compgen -F __emacs_complete_wrapper -- '(get' 2>/dev/null
EOF

error: "timeout"
buffer-string: <<EOF
Error: unexpected input in "_"

EOF

process: #
output-buffer: <<EOF
Error: unexpected input in "_"

EOF

bash-major-version: 4
emacs-version: "24.3.1"
context: [cl-struct-completion "source(get"
("source" "(get")
1 "("get" 9695 "(get" 34
("-F" "_completion_loader")
""'><=;|&(:" nil]

complete-p: (("createrepo" "-o" "filenames" "-F" "_cr_createrepo")
("_minimal" "-F")
("oodraw" "-F" "_filedir_xspec")
("elinks" "-F" "_filedir_xspec")
("freeamp" "-F" "_filedir_xspec")
("split" "-F" "_longopt")
("sed" "-F" "_longopt")
("ld" "-F" "_longopt")
("grep" "-F" "_longopt")
("jobs" "-j" "-P" ""%" "-S" """)
("pushd" "-d")
("subscription-manager" "-F" "_subscription_manager")
("fcoemon" "-F" "_fcoemon_options")
("playmidi" "-F" "_filedir_xspec")
("mv" "-F" "_longopt")
("rlogin" "-F" "_known_hosts")
("service" "-F" "_service")
("help" "-b")
("bg" "-A" "stopped" "-P" ""%" "-S" """)
("genpkgmetadata.py" "-o" "filenames" "-F" "_cr_createrepo")
("cdiff" "-F" "_filedir_xspec")
("bibtex" "-F" "_filedir_xspec")
("rgview" "-F" "_filedir_xspec")
("realplay" "-F" "_filedir_xspec")
("xine" "-F" "_filedir_xspec")
("xpdf" "-F" "_filedir_xspec")
("strip" "-F" "_longopt")
("pr" "-F" "_longopt")
("grub" "-F" "_longopt")
("gperf" "-F" "_longopt")
("ftp" "-F" "_known_hosts")
("yum-debug-dump.py" "-o" "filenames" "-F" "_yu_debug_dump")
("yum-builddep" "-o" "filenames" "-F" "_yu_builddep")
("repoclosure" "-o" "filenames" "-F" "_yu_repoclosure")
("repo-rss" "-o" "filenames" "-F" "_yu_repo_rss")
("oowriter" "-F" "_filedir_xspec")
("chromium-browser" "-F" "_filedir_xspec")
("gqmpeg" "-F" "_filedir_xspec")
("tex" "-F" "_filedir_xspec")
("zathura" "-F" "_filedir_xspec")
("lzegrep" "-F" "_filedir_xspec")
("m4" "-F" "_longopt")
("time" "-F" "_command")
("exec" "-F" "_command")
("do" "-F" "_command")
("finger" "-o" "nospace" "-F" "_user_at_host")
("ytalk" "-o" "nospace" "-F" "_user_at_host")
("/etc/rc.d/init.d/netconsole" "-F" "_service")
("which" "-c")
("slay" "-u")
("repodiff.py" "-F" "_yu_repodiff")
("aviplay" "-F" "_filedir_xspec")
("latex" "-F" "_filedir_xspec")
("uname" "-F" "_longopt")
("tac" "-F" "_longopt")
("shar" "-F" "_longopt")
("ldd" "-F" "_longopt")
("tracepath6" "-F" "_known_hosts")
("netscape" "-F" "_filedir_xspec")
("acroread" "-o" "filenames" "-o" "nospace" "-F" "_acroread")
("bc" "-F" "_longopt")
("gksudo" "-F" "_root_command")
("/etc/init.d/netconsole" "-F" "_service")
("yumdownloader" "-o" "filenames" "-F" "_yu_yumdownloader")
("yum-builddep.py" "-o" "filenames" "-F" "_yu_builddep")
("repoclosure.py" "-o" "filenames" "-F" "_yu_repoclosure")
("repo-rss.py" "-o" "filenames" "-F" "_yu_repo_rss")
("rhn-migrate-classic-to-rhsm" "-F" "_rhn_migrate_classic_to_rhsm")
("modifyrepo" "-o" "filenames" "-F" "_cr_modifyrepo")
("rvim" "-F" "_filedir_xspec")
("makeinfo" "-F" "_filedir_xspec")
("bunzip2" "-F" "_filedir_xspec")
("tail" "-F" "_longopt")
("nl" "-F" "_longopt")
("tracepath" "-F" "_known_hosts")
("yum" "-o" "filenames" "-F" "_yum")
("ogg123" "-F" "_filedir_xspec")
("sha224sum" "-F" "_longopt")
("nm" "-F" "_longopt")
("awk" "-F" "_longopt")
("xargs" "-F" "_command")
("/etc/init.d/ledger2_svc" "-F" "_service")
("repoquery" "-o" "filenames" "-F" "_yu_repoquery")
("kwrite" "-F" "_filedir_xspec")
("gview" "-F" "_filedir_xspec")
("ps2pdfwr" "-F" "_filedir_xspec")
("qiv" "-F" "_filedir_xspec")
("lrunzip" "-F" "_filedir_xspec")
("znew" "-F" "_filedir_xspec")
("bzcat" "-F" "_filedir_xspec")
("who" "-F" "_longopt")
("expand" "-F" "_longopt")
("repodiff" "-F" "_yu_repodiff")
(nil "-F" "_completion_loader")
("harbour" "-F" "_filedir_xspec")
("lokalize" "-F" "_filedir_xspec")
("amaya" "-F" "_filedir_xspec")
("kate" "-F" "_filedir_xspec")
("xemacs" "-F" "_filedir_xspec")
("dragon" "-F" "_filedir_xspec")
("pdftex" "-F" "_filedir_xspec")
("unlzma" "-F" "_filedir_xspec")
("paste" "-F" "_longopt")
("mkdir" "-F" "_longopt")
("cp" "-F" "_longopt")
("really" "-F" "_root_command")
("kdesudo" "-F" "_root_command")
("/etc/init.d/network" "-F" "_service")
("gluster" "-F" "_gluster_completion")
("hbpp" "-F" "_filedir_xspec")
("rpm2cpio" "-F" "_filedir_xspec")
("pdflatex" "-F" "_filedir_xspec")
("ln" "-F" "_longopt")
("df" "-F" "_longopt")
("bash" "-F" "_longopt")
("a2ps" "-F" "_longopt")
("repo-graph" "-o" "filenames" "-F" "_yu_repo_graph")
("view" "-F" "_filedir_xspec")
("vi" "-F" "_filedir_xspec")
("unxz" "-F" "_filedir_xspec")
("sha512sum" "-F" "_longopt")
("nice" "-F" "_command")
("else" "-F" "_command")
("mtr" "-F" "_known_hosts")
("unset" "-v")
("ly2dvi" "-F" "_filedir_xspec")
("mozilla-firefox" "-F" "_filedir_xspec")
("mozilla" "-F" "_filedir_xspec")
("objcopy" "-F" "_longopt")
("enscript" "-F" "_longopt")
("traceroute6" "-F" "_known_hosts")
("sux" "-u")
("ooimpress" "-F" "_filedir_xspec")
("gvim" "-F" "_filedir_xspec")
("uncompress" "-F" "_filedir_xspec")
("dir" "-F" "_longopt")
("bind" "-A" "binding")
("package-cleanup.py" "-o" "filenames" "-F" "_yu_package_cleanup")
("modplugplay" "-F" "_filedir_xspec")
("lzgrep" "-F" "_filedir_xspec")
("tr" "-F" "_longopt")
("gksu" "-F" "_root_command")
("fping" "-F" "_known_hosts")
("repoquery.py" "-o" "filenames" "-F" "_yu_repoquery")
("pyflakes" "-F" "_filedir_xspec")
("kid3-qt" "-F" "_filedir_xspec")
("xanim" "-F" "_filedir_xspec")
("unpigz" "-F" "_filedir_xspec")
("rhsm-debug" "-o" "default" "-F" "_rhsm_debug")
("git" "-o" "bashdefault" "-o" "default" "-o" "nospace" "-F" "__git_wrap__git_main")
("portecle" "-F" "_filedir_xspec")
("dillo" "-F" "_filedir_xspec")
("aaxine" "-F" "_filedir_xspec")
("dvipdfmx" "-F" "_filedir_xspec")
("advi" "-F" "_filedir_xspec")
("ggv" "-F" "_filedir_xspec")
("rmdir" "-F" "_longopt")
("cut" "-F" "_longopt")
("nohup" "-F" "_command")
("set" "-A" "setopt")
("groups" "-u")
("yumdb" "-o" "filenames" "-F" "_yu_yumdb")
("repomanage" "-o" "filenames" "-F" "_yu_repomanage")
("oocalc" "-F" "_filedir_xspec")
("emacs" "-F" "_filedir_xspec")
("lzmore" "-F" "_filedir_xspec")
("lzless" "-F" "_filedir_xspec")
("bison" "-F" "_longopt")
("verifytree.py" "-o" "filenames" "-F" "_yu_verifytree")
("scl" "-F" "_scl")
("lldptool" "-F" "_lldptool_options")
("bpftool" "-F" "_bpftool")
("fbxine" "-F" "_filedir_xspec")
("kdvi" "-F" "_filedir_xspec")
("sha384sum" "-F" "_longopt")
("indent" "-F" "_longopt")
("padsp" "-F" "_command")
("eval" "-F" "_command")
("debuginfo-install" "-F" "_yu_debuginfo_install")
("lldpad" "-F" "_lldpad_options")
("poedit" "-F" "_filedir_xspec")
("firefox" "-F" "_filedir_xspec")
("lynx" "-F" "_filedir_xspec")
("ps2pdf" "-F" "_filedir_xspec")
("kpdf" "-F" "_filedir_xspec")
("gv" "-F" "_filedir_xspec")
("vdir" "-F" "_longopt")
("shasum" "-F" "_longopt")
("less" "-F" "_longopt")
("vsound" "-F" "_command")
("command" "-F" "_command")
("oomath" "-F" "_filedir_xspec")
("madplay" "-F" "_filedir_xspec")
("compress" "-F" "_filedir_xspec")
("lbzcat" "-F" "_filedir_xspec")
("sort" "-F" "_longopt")
("ptx" "-F" "_longopt")
("colordiff" "-F" "_longopt")
("ssh-installkeys" "-F" "_known_hosts")
("/etc/rc.d/init.d/rhnsd" "-F" "_service")
("yumdownloader.py" "-o" "filenames" "-F" "_yu_yumdownloader")
("modifyrepo.py" "-o" "filenames" "-F" "_cr_modifyrepo")
("lilypond" "-F" "_filedir_xspec")
("gtranslator" "-F" "_filedir_xspec")
("jadetex" "-F" "_filedir_xspec")
("texindex" "-F" "_longopt")
("seq" "-F" "_longopt")
("fold" "-F" "_longopt")
("env" "-F" "_longopt")
("csplit" "-F" "_longopt")
("then" "-F" "_command")
("builtin" "-b")
("fg" "-j" "-P" ""%" "-S" """)
("debuginfo-install.py" "-F" "_yu_debuginfo_install")
("iceweasel" "-F" "_filedir_xspec")
("sxemacs" "-F" "_filedir_xspec")
("mpg321" "-F" "_filedir_xspec")
("mpg123" "-F" "_filedir_xspec")
("epdfview" "-F" "_filedir_xspec")
("zcat" "-F" "_filedir_xspec")
("unzip" "-F" "_filedir_xspec")
("pbunzip2" "-F" "_filedir_xspec")
("wc" "-F" "_longopt")
("sha256sum" "-F" "_longopt")
("head" "-F" "_longopt")
("aoss" "-F" "_command")
("syspurpose" "-F" "_syspurpose")
("kid3" "-F" "_filedir_xspec")
("pdfjadetex" "-F" "_filedir_xspec")
("gpdf" "-F" "_filedir_xspec")
("dvipdf" "-F" "_filedir_xspec")
("kghostview" "-F" "_filedir_xspec")
("mknod" "-F" "_longopt")
("ls" "-F" "_longopt")
("ltrace" "-F" "_command")
("rsh" "-F" "_known_hosts")
("w" "-u")
("module" "-o" "default" "-F" "_module")
("rhsmcertd" "-F" "_rhsmcertd")
("rhsm-icon" "-F" "_rhsm_icon")
("mergerepo" "-o" "filenames" "-F" "_cr_mergerepo")
("gharbour" "-F" "_filedir_xspec")
("modplug123" "-F" "_filedir_xspec")
("dvipdfm" "-F" "_filedir_xspec")
("pbzcat" "-F" "_filedir_xspec")
("sha1sum" "-F" "_longopt")
("dig" "-F" "_known_hosts")
("telnet" "-F" "_known_hosts")
("type" "-c")
("shopt" "-A" "shopt")
("iprconfig" "-F" "_comp_iprconfig")
("oobase" "-F" "_filedir_xspec")
("texi2dvi" "-F" "_filedir_xspec")
("texi2html" "-F" "_filedir_xspec")
("zipinfo" "-F" "_filedir_xspec")
("unexpand" "-F" "_longopt")
("sum" "-F" "_longopt")
("od" "-F" "_longopt")
("irb" "-F" "_longopt")
("fmt" "-F" "_longopt")
("du" "-F" "_longopt")
("module2" "-o" "nospace" "-F" "_compl_module")
("epiphany" "-F" "_filedir_xspec")
("ps2pdf12" "-F" "_filedir_xspec")
("ee" "-F" "_filedir_xspec")
("lzcat" "-F" "_filedir_xspec")
("lbunzip2" "-F" "_filedir_xspec")
("showmount" "-F" "_known_hosts")
("talk" "-o" "nospace" "-F" "_user_at_host")
("readonly" "-v")
("package-cleanup" "-o" "filenames" "-F" "_yu_package_cleanup")
("rct" "-o" "default" "-F" "_rct")
("gitk" "-o" "bashdefault" "-o" "default" "-o" "nospace" "-F" "__git_wrap__gitk_main")
("fcoeadm" "-F" "_fcoeadm_options")
("ps2pdf13" "-F" "_filedir_xspec")
("gunzip" "-F" "_filedir_xspec")
("rm" "-F" "_longopt")
("readelf" "-F" "_longopt")
("netstat" "-F" "_longopt")
("fakeroot" "-F" "_root_command")
("/etc/init.d/cfengine3" "-F" "_service")
("yum-debug-dump" "-o" "filenames" "-F" "_yu_debug_dump")
("yumdb.py" "-o" "filenames" "-F" "_yu_yumdb")
("repomanage.py" "-o" "filenames" "-F" "_yu_repomanage")
("google-chrome" "-F" "_filedir_xspec")
("vim" "-F" "_filedir_xspec")
("ps2pdf14" "-F" "_filedir_xspec")
("okular" "-F" "_filedir_xspec")
("dvips" "-F" "_filedir_xspec")
("lzfgrep" "-F" "_filedir_xspec")
("date" "-F" "_longopt")
("cat" "-F" "_longopt")
("fping6" "-F" "_known_hosts")
("disown" "-j" "-P" ""%" "-S" """)
("hbrun" "-F" "_filedir_xspec")
("kbabel" "-F" "_filedir_xspec")
("rview" "-F" "_filedir_xspec")
("kaffeine" "-F" "_filedir_xspec")
("slitex" "-F" "_filedir_xspec")
("units" "-F" "_longopt")
("touch" "-F" "_longopt")
("objdump" "-F" "_longopt")
("md5sum" "-F" "_longopt")
("diff" "-F" "_longopt")
("base64" "-F" "_longopt")
("cd" "-o" "nospace" "-F" "_cd")
("/etc/rc.d/init.d/ledger2_svc" "-F" "_service")
("/etc/rc.d/init.d/cfengine3" "-F" "_service")
("repo-graph.py" "-o" "filenames" "-F" "_yu_repo_graph")
("galeon" "-F" "_filedir_xspec")
("bzme" "-F" "_filedir_xspec")
("xfig" "-F" "_filedir_xspec")
("xv" "-F" "_filedir_xspec")
("xzcat" "-F" "_filedir_xspec")
("tee" "-F" "_longopt")
("mkfifo" "-F" "_longopt")
("traceroute" "-F" "_known_hosts")
("/etc/init.d/rhnsd" "-F" "_service")
("verifytree" "-o" "filenames" "-F" "_yu_verifytree")
("yummain.py" "-o" "filenames" "-F" "_yum")
("subscription-manager-gui" "-F" "_subscription_manager_gui")
("mergerepo.py" "-o" "filenames" "-F" "_cr_mergerepo")
("rgvim" "-F" "_filedir_xspec")
("timidity" "-F" "_filedir_xspec")
("dvitype" "-F" "_filedir_xspec")
("dviselect" "-F" "_filedir_xspec")
("xdvi" "-F" "_filedir_xspec")
("uniq" "-F" "_longopt")
("tsocks" "-F" "_command")
("/etc/rc.d/init.d/network" "-F" "_service")
("unalias" "-a"))

@szermatt
Copy link
Owner

szermatt commented Oct 4, 2020

Thank you for filing the bug report!

If I understood the situation correctly, you started another interpreter from bash, then pressed TAB while in the prompt for that interpreter, Emacs froze and eventually you got an error message. This is wrong: bash-completion.el should detect quickly that it's not talking to bash anymore and fall back to a default completion.

I'll find a way of fixing that.

In the meantime, to avoid this issue if it annoys you, I'd suggest adding the following to your .emacs as a workaround:

(setq bash-completion-use-separate-processes t)

This tells bash-completion.el to always start a separate bash process to communicate with, so the situation just doesn't arise. The drawback is that, since completion happens on a different bash process, any function you added or any variable you set in your shell process will not be completed.

szermatt added a commit that referenced this issue Oct 10, 2020
With this change, bash-completion-send first sends a short echo command,
just to see whether the process answers properly, so that, in the case
where the process is not able to respond or not a bash process,
bash-completion fails quickly.

This makes issue #44 less annoying but doesn't actually solve the
problem yet.
szermatt added a commit that referenced this issue Oct 10, 2020
In single-process mode, the comint version of
bash-completion-dynamic-complete automatically turns off bash completion
when it thinks it's not talking to a BASH command-line.

This is controlled by bash-completion-nonbash-prompts and
bash-completion-bash-prompts.

This is a way of avoiding issue #44.
szermatt added a commit that referenced this issue Oct 11, 2020
Reverting the changes that causes test failures on gihtub action as I'll
need some time to reproduce and fix them.

This reverts commits:

d550256 master origin/master Disable flakey test for now.
ca4fbce Turn off bash completion when non-bash prompts are detected.
fd85366 Detect non-responsive processes more quickly.
@Kyrremann
Copy link

I think I have the same problem. When I ssh/exec into a Kubernetes pod with bash I have the same problem where the commands times out. And when I check the debug-commando I get some escape signs in the command line that is called.

commandline: <<EOF
__emacs_complete_pre_command;  echo -n "^[^[pwd=${PWD}^[^[";compgen -b -c -a -A function -- expo 2>/dev/null
EOF

error: "timeout"
buffer-string: <<EOF
__emacs_complete_pre_command;  echo -n "testapp" pwd=${PWD}^G";compgen -b -c -a -A function -- expo 2>/dev/nulll
> EOF

process: #<process shell>
output-buffer: <<EOF
__emacs_complete_pre_command;  echo -n "testapp" pwd=${PWD}^G";compgen -b -c -a -A function -- expo 2>/dev/nulll
> EOF

bash-major-version: 5
emacs-version: "27.2"
context: #s(completion "expo"
              ("expo")
              0 "expo" 1003170 "expo" nil nil "\"'><=;|&(:" nil)

@Kyrremann
Copy link

Using a remote shell to a pod gives me this error:

commandline: <<EOF
__emacs_complete_pre_command; function __emacs_complete_pre_command {  if [[ -z "$__emacs_complete_ps1" ]]; then    __emacs_complete_ps1="$PS1";    __emacs_complete_pc="$PROMPT_COMMAND";  fi;  PROMPT_COMMAND=__emacs_complete_prompt;  history &>/dev/null -d $((HISTCMD - 1)) || true;} &&function __emacs_complete_prompt {  PS1='	$?�';  PROMPT_COMMAND=__emacs_complete_recover_prompt;} &&function __emacs_complete_recover_prompt {  local r=$?;  PS1="${__emacs_complete_ps1}";  PROMPT_COMMAND="${__emacs_complete_pc}";  unset __emacs_complete_ps1 __emacs_complete_pc;  if [[ -n "$PROMPT_COMMAND" ]]; then    (exit $r); eval "$PROMPT_COMMAND";  fi;} &&__emacs_complete_pre_command
EOF

error: "timeout"
buffer-string: <<EOF
/bin/sh: set: illegal option +o emacs
EOF

process: #<process shell<1>>
output-buffer: <<EOF
/bin/sh: set: illegal option +o emacs
EOF

emacs-version: "27.2"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants