web-dev-qa-db-fra.com

Comment puis-je empêcher gvim de planter lors de l'ouverture d'un fichier?

Je suis sur Ubuntu Desktop 16.04 LTS et gvim (vim avec une interface graphique) continue de planter sur moi lorsque j'essaie d'ouvrir un fichier à l'aide de la GUI/du menu. Cependant, j'ai pu ouvrir un fichier depuis le terminal, par exemple:

user@computer:~$ vim -g ./path/to/file

Les messages d'erreur suivants sont imprimés sur le terminal si je lance gvim à partir du terminal à l'aide de vim -g, puis provoque le blocage en essayant d'ouvrir un fichier à l'aide de la barre de menus/GUI:

(gvim:20175): GLib-CRITICAL **: g_ptr_array_insert: assertion 'index_ <= (gint)rarray->len' failed

** (gvim:20175): CRITICAL **: unity_gtk_menu_Shell_get_item: assertion '0 <= index && index < items->len' failed

** (gvim:20175): CRITICAL **: unity_gtk_menu_item_get_child_Shell: assertion 'UNITY_GTK_IS_MENU_ITEM (item)' failed

** (gvim:20175): CRITICAL **: unity_gtk_menu_Shell_get_item: assertion '0 <= index && index < items->len' failed

** (gvim:20175): CRITICAL **: unity_gtk_menu_item_get_label: assertion 'UNITY_GTK_IS_MENU_ITEM (item)' failed

** (gvim:20175): CRITICAL **: unity_gtk_menu_item_get_icon: assertion 'UNITY_GTK_IS_MENU_ITEM (item)' failed
Vim: Caught deadly signal SEGV
Vim: Finished.

Voici les packages liés à vim que j'ai installés:

user@computer:~$ apt list --installed | grep vim

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

vim-common/xenial-updates,now 2:7.4.1689-3ubuntu1.1 AMD64 [installed]
vim-gtk3/xenial-updates,now 2:7.4.1689-3ubuntu1.1 AMD64 [installed]
vim-gui-common/xenial-updates,xenial-updates,now 2:7.4.1689-3ubuntu1.1 all [installed,automatic]
vim-runtime/xenial-updates,xenial-updates,now 2:7.4.1689-3ubuntu1.1 all [installed,automatic]
vim-tiny/xenial-updates,now 2:7.4.1689-3ubuntu1.1 AMD64 [installed]
12
Adam P

J'ai pu arrêter le blocage (jusqu'à présent) en désinstallant le package vim-gtk3 et en installant le package vim-gnome.

Désinstaller vim-gtk3:

user@computer:~$ Sudo apt remove vim-gtk3
[Sudo] password for user: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-4.4.0-34 linux-headers-4.4.0-34-generic
  linux-image-4.4.0-34-generic linux-image-extra-4.4.0-34-generic
Use 'Sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  vim-gtk3
0 upgraded, 0 newly installed, 1 to remove and 18 not upgraded.
After this operation, 2,948 kB disk space will be freed.
Do you want to continue? [Y/n] 
(Reading database ... 336958 files and directories currently installed.)
Removing vim-gtk3 (2:7.4.1689-3ubuntu1.1) ...
update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/vi (vi) in auto mode
update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/view (view) in auto mode
update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/ex (ex) in auto mode
update-alternatives: using /bin/nano to provide /usr/bin/editor (editor) in auto mode
update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/rview (rview) in auto mode

Installez vim-gnome:

user@computer:~$ Sudo apt install vim-gnome
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-4.4.0-34 linux-headers-4.4.0-34-generic linux-image-4.4.0-34-generic
  linux-image-extra-4.4.0-34-generic
Use 'Sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libbonoboui2-0 libbonoboui2-common libgnome2-0 libgnome2-bin libgnomeui-0 libgnomeui-common
Suggested packages:
  cscope vim-doc fonts-dejavu
The following NEW packages will be installed:
  libbonoboui2-0 libbonoboui2-common libgnome2-0 libgnome2-bin libgnomeui-0 libgnomeui-common
  vim-gnome
0 upgraded, 7 newly installed, 0 to remove and 18 not upgraded.
Need to get 1,619 kB of archives.
After this operation, 5,536 kB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://us.archive.ubuntu.com/ubuntu xenial/main AMD64 libgnome2-bin AMD64 2.32.1-5ubuntu1 [5,040 B]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial/main AMD64 libgnome2-0 AMD64 2.32.1-5ubuntu1 [1,656 B]
Get:3 http://us.archive.ubuntu.com/ubuntu xenial/main AMD64 libbonoboui2-common all 2.24.5-3ubuntu1 [11.9 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu xenial/main AMD64 libbonoboui2-0 AMD64 2.24.5-3ubuntu1 [154 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu xenial/main AMD64 libgnomeui-common all 2.24.5-3.1 [16.3 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu xenial/main AMD64 libgnomeui-0 AMD64 2.24.5-3.1 [207 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu xenial-updates/main AMD64 vim-gnome AMD64 2:7.4.1689-3ubuntu1.1 [1,223 kB]
Fetched 1,619 kB in 0s (3,435 kB/s)  
Selecting previously unselected package libgnome2-bin.
(Reading database ... 336954 files and directories currently installed.)
Preparing to unpack .../libgnome2-bin_2.32.1-5ubuntu1_AMD64.deb ...
Unpacking libgnome2-bin (2.32.1-5ubuntu1) ...
Selecting previously unselected package libgnome2-0:AMD64.
Preparing to unpack .../libgnome2-0_2.32.1-5ubuntu1_AMD64.deb ...
Unpacking libgnome2-0:AMD64 (2.32.1-5ubuntu1) ...
Selecting previously unselected package libbonoboui2-common.
Preparing to unpack .../libbonoboui2-common_2.24.5-3ubuntu1_all.deb ...
Unpacking libbonoboui2-common (2.24.5-3ubuntu1) ...
Selecting previously unselected package libbonoboui2-0:AMD64.
Preparing to unpack .../libbonoboui2-0_2.24.5-3ubuntu1_AMD64.deb ...
Unpacking libbonoboui2-0:AMD64 (2.24.5-3ubuntu1) ...
Selecting previously unselected package libgnomeui-common.
Preparing to unpack .../libgnomeui-common_2.24.5-3.1_all.deb ...
Unpacking libgnomeui-common (2.24.5-3.1) ...
Selecting previously unselected package libgnomeui-0:AMD64.
Preparing to unpack .../libgnomeui-0_2.24.5-3.1_AMD64.deb ...
Unpacking libgnomeui-0:AMD64 (2.24.5-3.1) ...
Selecting previously unselected package vim-gnome.
Preparing to unpack .../vim-gnome_2%3a7.4.1689-3ubuntu1.1_AMD64.deb ...
Unpacking vim-gnome (2:7.4.1689-3ubuntu1.1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Setting up libgnome2-bin (2.32.1-5ubuntu1) ...
Setting up libgnome2-0:AMD64 (2.32.1-5ubuntu1) ...
Setting up libbonoboui2-common (2.24.5-3ubuntu1) ...
Setting up libbonoboui2-0:AMD64 (2.24.5-3ubuntu1) ...
Setting up libgnomeui-common (2.24.5-3.1) ...
Setting up libgnomeui-0:AMD64 (2.24.5-3.1) ...
Setting up vim-gnome (2:7.4.1689-3ubuntu1.1) ...
update-alternatives: using /usr/bin/vim.gnome to provide /usr/bin/vim (vim) in auto mode
update-alternatives: using /usr/bin/vim.gnome to provide /usr/bin/vimdiff (vimdiff) in auto mode
update-alternatives: using /usr/bin/vim.gnome to provide /usr/bin/rvim (rvim) in auto mode
update-alternatives: using /usr/bin/vim.gnome to provide /usr/bin/rview (rview) in auto mode
update-alternatives: using /usr/bin/vim.gnome to provide /usr/bin/vi (vi) in auto mode
update-alternatives: using /usr/bin/vim.gnome to provide /usr/bin/view (view) in auto mode
update-alternatives: using /usr/bin/vim.gnome to provide /usr/bin/ex (ex) in auto mode
update-alternatives: using /usr/bin/vim.gnome to provide /usr/bin/editor (editor) in auto mode
update-alternatives: using /usr/bin/vim.gnome to provide /usr/bin/gvim (gvim) in auto mode
update-alternatives: using /usr/bin/vim.gnome to provide /usr/bin/gview (gview) in auto mode
update-alternatives: using /usr/bin/vim.gnome to provide /usr/bin/rgview (rgview) in auto mode
update-alternatives: using /usr/bin/vim.gnome to provide /usr/bin/rgvim (rgvim) in auto mode
update-alternatives: using /usr/bin/vim.gnome to provide /usr/bin/evim (evim) in auto mode
update-alternatives: using /usr/bin/vim.gnome to provide /usr/bin/eview (eview) in auto mode
update-alternatives: using /usr/bin/vim.gnome to provide /usr/bin/gvimdiff (gvimdiff) in auto mode
Processing triggers for libc-bin (2.23-0ubuntu3) ...
5
Adam P

Ubuntu 17.04

Les choses se sont cassées quand j'ai mis à jour, et je l'ai résolu avec:

Sudo apt-get remove vim-gtk3
Sudo apt-get install vim-gtk

vim-gnome mentionné dans La réponse d'Adam P indique qu'il pointe sur vim-gtk3, donc rien ne changerait.

vim-gtk indique toutefois qu'il utilise gtk 2 et qu'il fonctionne.

Pour mon cas, j'ai d'abord enlevé gvim installé par:

Sudo apt-get remove --auto-remove vim-gtk3

Ensuite, j'ai installé gvim avec:

Sudo apt install vim-gtk3-py2 

En passant, j'utilise Vim8 à partir de:

Sudo add-apt-repository ppa:jonathonf/vim
2
suns