You are not logged in.

#1 2015-01-08 22:19:31

anderslundstedt
Member
Registered: 2015-01-08
Posts: 8

[SOLVED] Vim does not work in certain directories

Update and TLDR: For some reason, the youcompleteme vim plugin caused vim to crash in directories when any file named codecs.py or codecs.pyc was present.

In certain directories, vim does not work. It crashes immediately with a corruptly printed and not fully visible error message. In most directories there is no problem. Same problem for both bash and zsh, as well as in the virtual console. Tested with empty vimrc.

Steps to reproduce (on my system, but probably not yours?):

(1) Download and unpack Python source: https://www.python.org/ftp/python/3.4.2 … -3.4.2.tgz
(2)

cd /path-to-python-source/Lib/

(3)

vim

Update:

touch codecs.py
vim

Screenshot of error: http://i.imgur.com/qSUvUe6.png
Video of error: https://vid.me/3wfS

 % pacman -Qi vim
Name           : vim
Version        : 7.4.537-1
Description    : Vi Improved, a highly configurable, improved version of the vi text editor (with support for additional scripting languages)
Architecture   : x86_64
URL            : http://www.vim.org
Licenses       : custom:vim
Groups         : None
Provides       : None
Depends On     : vim-runtime=7.4.537-1  gpm  ruby  lua  python2  acl
Optional Deps  : None
Required By    : vim-youcompleteme-git
Optional For   : pacmatic
Conflicts With : vim-minimal  vim-python3  gvim  gvim-python3
Replaces       : None
Installed Size :   2.42 MiB
Packager       : Anatol Pomozov <anatol.pomozov@gmail.com>
Build Date     : Sat 29 Nov 2014 06:49:46 PM CET
Install Date   : Thu 08 Jan 2015 10:59:36 PM CET
Install Reason : Explicitly installed
Install Script : No
Validated By   : Signature
% vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 29 2014 09:47:39)
Included patches: 1-537
Compiled by Arch Linux
Huge version without GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +syntax
+arabic          +file_in_path    +mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
-balloon_eval    +float           +mouse_urxvt     -tag_any_white
-browse          +folding         +mouse_xterm     -tcl
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         +gettext         -mzscheme        +textobjects
-clientserver    -hangul_input    +netbeans_intg   +title
-clipboard       +iconv           +path_extra      -toolbar
+cmdline_compl   +insert_expand   +perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python          +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con      +lua             +rightleft       +windows
+diff            +menu            +ruby            +writebackup
+digraphs        +mksession       +scrollbind      -X11
-dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     -xim
+emacs_tags      -mouseshape      -sniff           -xsmp
+eval            +mouse_dec       +startuptime     -xterm_clipboard
+ex_extra        +mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    -xpm
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -D_FORTIFY_SOURCE=2  -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1      
Linking: gcc   -L. -Wl,-O1,--sort-common,--as-needed,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE  -Wl,-O1,--sort-common,--as-needed,-z,relro -L/usr/local/lib -Wl,--as-needed -o vim        -lm -lncurses -lelf -lnsl   -lacl -lattr -lgpm -ldl  -L/usr/lib -llua -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro -fstack-protector -L/usr/local/lib  -L/usr/lib/perl5/core_perl/CORE -lperl -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc -L/usr/lib/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic   -lruby -lpthread -lgmp -ldl -lcrypt -lm  -L/usr/lib

Last edited by anderslundstedt (2015-01-08 23:59:36)

Offline

#2 2015-01-08 22:45:18

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,872
Website

Re: [SOLVED] Vim does not work in certain directories

I can't reproduce that bug here, but you are using an outdated version of vim. Try running a pacman -Syu to update your system, then see if the bug persists.

Welcome to the forums.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#3 2015-01-08 22:53:54

anderslundstedt
Member
Registered: 2015-01-08
Posts: 8

Re: [SOLVED] Vim does not work in certain directories

WorMzy wrote:

... you are using an outdated version of vim. Try running a pacman -Syu to update your system, then see if the bug persists.

According to pacman my vim is up to date. pacman -Syu does nothing. Strange ...

Offline

#4 2015-01-08 23:11:08

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,872
Website

Re: [SOLVED] Vim does not work in certain directories


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#5 2015-01-08 23:11:16

anderslundstedt
Member
Registered: 2015-01-08
Posts: 8

Re: [SOLVED] Vim does not work in certain directories

I have now narrowed down the problem considerably.

Steps to reproduce (for me):

cd $(mktemp -d)
wget https://raw.githubusercontent.com/python/cpython/master/Lib/codecs.py
vim

What is up with that codecs.py file?

Last edited by anderslundstedt (2015-01-08 23:11:46)

Offline

#6 2015-01-08 23:29:05

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,534
Website

Re: [SOLVED] Vim does not work in certain directories

anderslundstedt wrote:

What is up with that codecs.py file?

Nothing.  I also can't reproduce the error.  So the problem is not with that file.

Can you try with another user (and/or root)?


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#7 2015-01-08 23:44:23

anderslundstedt
Member
Registered: 2015-01-08
Posts: 8

Re: [SOLVED] Vim does not work in certain directories

Trilby wrote:
anderslundstedt wrote:

What is up with that codecs.py file?

Nothing.  I also can't reproduce the error.  So the problem is not with that file.

Well, obviously there is something in with that file causing vim to fail on my system. (Which is not to say that there is something wrong with the file.)

Tribly wrote:

Can you try with another user (and/or root)?

The problem is not present when running as root.

Last edited by anderslundstedt (2015-01-08 23:51:17)

Offline

#8 2015-01-08 23:52:38

anderslundstedt
Member
Registered: 2015-01-08
Posts: 8

Re: [SOLVED] Vim does not work in certain directories

Narrowed down. Steps to reproduce:

touch codecs.py
vim

Why could the filename codecs.py be problematic?

Offline

#9 2015-01-08 23:57:00

anderslundstedt
Member
Registered: 2015-01-08
Posts: 8

Re: [SOLVED] Vim does not work in certain directories

Solved:

sudo pacman -Rs vim-youcompleteme-git

For some reason, youcompleteme caused this error. Will look further into that and perhaps provide an update.

Offline

#10 2015-01-09 00:04:02

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,534
Website

Re: [SOLVED] Vim does not work in certain directories

All these files have "import codecs" in their code:

argparse/test/test_argparse.py
requests/requests/utils.py
requests/requests/packages/urllib3/filepost.py
requests/requests/packages/chardet/universaldetector.py
YouCompleteMe/third_party/ycmd/third_party/requests/requests/utils.py
YouCompleteMe/third_party/ycmd/third_party/requests/requests/packages/urllib3/filepost.py
YouCompleteMe/third_party/ycmd/third_party/requests/requests/packages/chardet/universaldetector.py
YouCompleteMe/third_party/ycmd/third_party/argparse/test/test_argparse.py
YouCompleteMe/third_party/requests/requests/utils.py
YouCompleteMe/third_party/requests/requests/packages/urllib3/filepost.py
YouCompleteMe/third_party/requests/requests/packages/chardet/universaldetector.py

At least one of them seems to be trying to import the file from the current working directory rather than the proper path.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#11 2015-01-09 00:05:50

anderslundstedt
Member
Registered: 2015-01-08
Posts: 8

Re: [SOLVED] Vim does not work in certain directories

Trilby wrote:

All these files have "import codecs" in their code:

...

At least one of them seems to be trying to import the file from the current working directory rather than the proper path.

Thanks. Will file a bug report.

Offline

#12 2015-01-09 00:10:53

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,534
Website

Re: [SOLVED] Vim does not work in certain directories

As I've only tinkered a bit with python, I don't know the right way to do it - it seems this type of error can be found all over the web, and in postings from ~2008 this was discussed quite a bit.  I can't imagine this problem hasn't been solved, and there is a "proper" way to import modules that will not be this fragile.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#13 2015-01-09 00:12:32

anderslundstedt
Member
Registered: 2015-01-08
Posts: 8

Re: [SOLVED] Vim does not work in certain directories

There is a proper way (absolute imports).

Offline

#14 2015-01-09 00:16:40

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,534
Website

Re: [SOLVED] Vim does not work in certain directories

Ah, thanks - I learned something too smile

(I just looked up absolute imports and found a S.O. thread.  This might be old news to pythoners - but as one who's written probably less that 100 lines of python this is new)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

Board footer

Powered by FluxBB