FS#67828 - codes in xterm after gvim plugin for key combinations.

Attached to Project: Arch Linux
Opened by Roel Kluin (roelk) - Friday, 04 September 2020, 22:37 GMT
Last edited by freswa (frederik) - Saturday, 05 September 2020, 20:43 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To No-one
Architecture x86_64
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

xterm keyboard output becomes broken after gvim for key + shift, ctrl or alt in xterm this console (nowhere else). Before gvim xterm just works (no color, just text), after gim:

Shift+A:
;2;65~

same goes for any other key except a few:
!#$ %&*() + :" <>? work, as well as Shift+Insert/PageUp/PageDown.

Exception: gvim --noplugin doesn't have this effect.



Beside visual, function is also broken. e.g. Ctrl+C does not break the last command. xev output does not show changes (only the root line changed). This started after a pacman -Syu at the end of August. My system was fairly up to date. I do have AUR packages and an adapted vim folder, but no recent changes (before plugin update attempts today). The problem persists after reboot or pacman update.

Additional info:
Linux Z 5.8.5-arch1-1 #1 SMP PREEMPT Thu, 27 Aug 2020 18:53:02 +0000 x86_64 GNU/Linux

* package version(s)
XTerm(359)

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Sep 03 2020 21:38:43)
Included patches: 1-1584
Compiled by Arch Linux
Huge version with GTK3 GUI. Features included (+) or not (-):
+acl -farsi +mouse_sgr +tag_binary
+arabic +file_in_path -mouse_sysmouse -tag_old_static
+autocmd +find_in_path +mouse_urxvt -tag_any_white
+autochdir +float +mouse_xterm +tcl/dyn
-autoservername +folding +multi_byte +termguicolors
+balloon_eval -footer +multi_lang +terminal
+balloon_eval_term +fork() -mzscheme +terminfo
+browse +gettext +netbeans_intg +termresponse
++builtin_terms -hangul_input +num64 +textobjects
+byte_offset +iconv +packages +textprop
+channel +insert_expand +path_extra +timers
+cindent +ipv6 +perl/dyn +title
+clientserver +job +persistent_undo +toolbar
+clipboard +jumplist +popupwin +user_commands
+cmdline_compl +keymap +postscript +vartabs
+cmdline_hist +lambda +printer +vertsplit
+cmdline_info +langmap +profile +virtualedit
+comments +libcall +python/dyn +visual
+conceal +linebreak +python3/dyn +visualextra
+cryptv +lispindent +quickfix +viminfo
+cscope +listcmds +reltime +vreplace
+cursorbind +localmap +rightleft +wildignore
+cursorshape +lua/dyn +ruby/dyn +wildmenu
+dialog_con_gui +menu +scrollbind +windows
+diff +mksession +signs +writebackup
+digraphs +modify_fname +smartindent +X11
+dnd +mouse +sound -xfontset
-ebcdic +mouseshape +spell +xim
+emacs_tags +mouse_dec +startuptime -xpm
+eval +mouse_gpm +statusline +xsmp_interact
+ex_extra -mouse_jsbterm -sun_workshop +xterm_clipboard
+extra_search +mouse_netterm +syntax -xterm_save
system vimrc file: "/etc/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "/etc/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
defaults file: "$VIMRUNTIME/defaults.vim"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/at-spi-2.0 -pthread -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L. -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.32/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -L/usr/local/lib -Wl,--as-needed -o vim -lgtk-3 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lelf -lcanberra -lacl -lattr -lgpm -ldl -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.32/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -L/usr/local/lib -L/usr/lib/perl5/5.32/core_perl/CORE -lperl -lpthread -ldl -lm -lcrypt -lutil -lc -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lm
* config and/or log files etc.

Ok, I admit, my plugin folder is a mess. I have vim8 style, pathogen and vundle plugins. Simple git updates haven't resolved the issue. I had a suspicious AnsiEsc plugin, but still.. a child process shouldn't affect a parents' keyboard interpretation.

Also there are .Xdefaults .Xmodmap and .Xresources files. Again, nothing I changed in the last month:

* link to upstream bug report, if any
nothing obvious in the journalctl or dmesg.

Steps to reproduce:
start xterm 1 and xterm 2
# Shift+A (works in both terminals). Then start in xterm 1:
gvim
# quit with :q
# in xterm 1 Shift+A (is broken)
# in xterm 2 Shift+A (still works)

Only the parent xterm is affected if a gvim is invoked in a nested xterm.
This task depends upon

Closed by  freswa (frederik)
Saturday, 05 September 2020, 20:43 GMT
Reason for closing:  Not a bug
Additional comments about closing:  This is rather a configuration issue than a packaging issue. Please use the forum, the mailing list or the IRC to ask for support. Thank you
Comment by Roel Kluin (roelk) - Friday, 04 September 2020, 22:55 GMT
Forgot to mention the plugins:

ls ~/.vim/plugin/
SimpleFold.vim cecutil.vim foldutil.vim genutils.vim supertab.vim taglist.vim

ls ~/.vim/pack/plugins/start/
rust.vim

ls .vim/bundle/
SimpylFold Vundle.vim YouCompleteMe indentpython.vim rust.vim twine.vim vim-flake8 vim-fugitive

looking at my .vimrc, it seems the ones in .vim/bundle/ were enabled.

If I temporarily rename my .vim folder (e.g. _.vim) the problem persists. Is the issue maybe a pacman/yay installed plugin?
Comment by Roel Kluin (roelk) - Saturday, 05 September 2020, 00:06 GMT
The same happens in an xterm as a root user, if I run gvim, keyboard responses become broken for the parent xterm. The root user has no custom plugins. This is an installed issue.
Comment by Roel Kluin (roelk) - Saturday, 05 September 2020, 00:42 GMT
Three packages were installed via yay, and now updated, didn't resolve the issue, though.

vim-guicolorscheme
vim-taglist
vim-youcompleteme-git

running as root with and without plugin:

gvim --noplugin -V4vimroot-noplugin.txt
gvim -V4vimroot-regular.txt

# enables to indicate in what directories the culprit must reside:
diff -u0 /home/roel/vimroot* | sed -n 's/^+finished sourcing //p' | xargs dirname | sort | uniq -c
2 /usr/share/vim/vim82
12 /usr/share/vim/vim82/plugin
1 /usr/share/vim/vimfiles/after/plugin
1 /usr/share/vim/vimfiles/autoload
1 /usr/share/vim/vimfiles/autoload/UltiSnips
2 /usr/share/vim/vimfiles/autoload/ctrlp
1 /usr/share/vim/vimfiles/autoload/nerdtree
2 /usr/share/vim/vimfiles/autoload/syntastic
14 /usr/share/vim/vimfiles/lib/nerdtree
3 /usr/share/vim/vimfiles/nerdtree_plugin
33 /usr/share/vim/vimfiles/plugin
20 /usr/share/vim/vimfiles/plugin/syntastic
Comment by Roel Kluin (roelk) - Saturday, 05 September 2020, 01:30 GMT
Ok I found the culprit.. nobody cares, but this is how..

# I extracted the guards for the vim plugins
diff -u0 ~/vimroot* | sed -n 's/^+finished sourcing //p'| xargs egrep -ho "g:loaded_[^'\" ]+" | grep -v '|' |sort | uniq > guards.txt

# and then I started console and started gvim each time with one guard activated.
[ ! -e cg.txt ] && lg=0 || lg=$(grep -hn -f cg.txt guards.txt | cut -d ':' -f 1)
guard=$(sed -n "$((lg+1))p" guards.txt)
echo "${guard}$" | tee cg.txt
gvim --cmd "let $guard = 1"
# and tested whether Shift+A was working.

#And with this guard it is working:
gvim --cmd "let g:loaded_syntastic_plugin = 1"

..so it's the syntastic plugin that's affecting xterm (both are buggy IMO).
Comment by Roel Kluin (roelk) - Saturday, 05 September 2020, 02:00 GMT
added a bug report for vim-syntastic here:
https://bugs.archlinux.org/task/67829
Comment by Roel Kluin (roelk) - Saturday, 05 September 2020, 19:13 GMT
Ok, no duplicates. Fine. I just noticed the issue goes away with:

gvim --cmd "let g:loaded_syntastic_util_autoload = 1"

and in contrast to the g:loaded_syntastic_plugin guard, this one is only used in
/usr/share/vim/vimfiles/autoload/syntastic/util.vim
Comment by Roel Kluin (roelk) - Saturday, 05 September 2020, 19:48 GMT
Only commenting this functions seems to resolve the bug:

function! syntastic#util#system(command) abort

It appears /usr/share/vim/vimfiles/plugin/syntastic.vim line 59 does:
split(syntastic#util#system('uname'), "\n")
which triggers the issue. The code that is run that causes it is:

calling syntastic#util#system('uname')

line 1: let old_shell = &shell
line 2: let old_lc_messages = $LC_MESSAGES
line 3: let old_lc_all = $LC_ALL
line 4:
line 5: let &shell = syntastic#util#var('shell')
calling syntastic#util#var('shell')

line 1: return call('syntastic#util#rawVar', ['syntastic_' . a:name] + a:000)
calling syntastic#util#rawVar('syntastic_shell')

line 1: return get(b:, a:name, get(g:, a:name, a:0 ? a:1 : ''))
syntastic#util#rawVar returning '/bin/bash'

continuing in syntastic#util#var

syntastic#util#var returning '/bin/bash'

continuing in syntastic#util#system

line 6: let $LC_MESSAGES = 'C'
line 7: let $LC_ALL = ''
line 8:
line 9: let crashed = 0
line 10: let cmd_start = reltime()
line 11: try
line 12: let out = system(a:command)
Calling shell to execute: "(uname) > /tmp/vYcIq6r/0"
line 13: catch
line 14: let crashed = 1
line 15: call syntastic#log#error('exception running system(' . string(a:command) . '): ' . v:exception)
line 16: if syntastic#util#isRunningWindows()
line 17: call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, '$TMP = ' . string($TMP) . ', $TEMP = ' . string($TEMP))
line 18: else
line 19: call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, '$TERM = ' . string($TERM))
line 20: call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, '$TMPDIR = ' . string($TMPDIR))
line 21: endif
line 22: call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, '$PATH = ' . string($PATH))
line 23: call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'getcwd() = ' . string(getcwd()))
line 24: call syntastic#log#debugShowOptions(g:_SYNTASTIC_DEBUG_TRACE, g:_SYNTASTIC_SHELL_OPTIONS)
line 25: let out = ''
line 26: endtry
line 27: let cmd_time = split(reltimestr(reltime(cmd_start)))[0]
line 28:
line 29: let $LC_ALL = old_lc_all
line 30: let $LC_MESSAGES = old_lc_messages
line 31:
line 32: let &shell = old_shell
line 33:
line 34: if !crashed && exists('g:_SYNTASTIC_DEBUG_TRACE')
line 35: call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'system: command run in ' . cmd_time . 's')
line 36: endif
line 37:
line 38: return out
syntastic#util#system returning 'Linux^@'


Loading...