Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 374259 - app-editors/vim: confirm function in .vimrc causes cpu 100% & process lockup
Summary: app-editors/vim: confirm function in .vimrc causes cpu 100% & process lockup
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Vim Maintainers
Depends on:
Reported: 2011-07-06 17:55 UTC by morris
Modified: 2017-10-22 12:46 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description morris 2011-07-06 17:55:04 UTC
This may or may not belong to the Gentoo team, but starting here anyway, since it was modified by Gentoo....

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jul  3 2011 06:41:30)
Included patches: 1-189
Modified by Gentoo-7.3.189
Compiled by mwalton@walle
Huge version without GUI.  Features included (+) or not (-):
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +conceal
+cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs -dnd -ebcdic
+emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path +float
+folding -footer +fork() +gettext -hangul_input +iconv +insert_expand +jumplist +keymap
 +langmap +libcall +linebreak +lispindent +listcmds +localmap -lua +menu +mksession
+modify_fname +mouse -mouseshape +mouse_dec +mouse_gpm -mouse_jsbterm +mouse_netterm
-mouse_sysmouse +mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg
-osfiletype +path_extra +perl +persistent_undo +postscript +printer +profile +python
-python3 +quickfix +reltime +rightleft -ruby +scrollbind +signs +smartindent -sniff
+startuptime +statusline -sun_workshop +syntax +tag_binary +tag_old_static
-tag_any_white -tcl +terminfo +termresponse +textobjects +title -toolbar +user_commands
 +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore +wildmenu
+windows +writebackup +X11 +xfontset -xim +xsmp_interact +xterm_clipboard -xterm_save
   system vimrc file: "/etc/vim/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/share/vim"
Compilation: x86_64-pc-linux-gnu-gcc -c -I. -Iproto -DHAVE_CONFIG_H     -march=core2 -O2
 -pipe -ggdb -D_FORTIFY_SOURCE=1
Linking: x86_64-pc-linux-gnu-gcc   -Wl,-E  -Wl,-O1 -Wl,--as-needed -L/usr/local/lib -Wl,
--as-needed -o vim    -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -lelf -lnsl   -
lcurses -lacl -lattr -lgpm -ldl    -Wl,-E -Wl,-O1 -Wl,--as-needed  -L/usr/lib64/perl5/5.
12.3/x86_64-linux/CORE -lperl -lnsl -ldl -lm -lcrypt -lutil -lc -L/usr/lib/python2.6/con
fig -lpython2.6 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic

Reproducible: Always

Steps to Reproduce:
1.launch vim from the command line w/o arguments
Actual Results:  
100% process utilization, unresponsive application

Expected Results:  
confirm command take input & process.


set et
set ignorecase
set ruler
set cpo=aABceFs
set noerrorbells
set nocp incsearch
set cinoptions=:0,p0,t0
set cinwords=if,else,while,do,for,switch,case
set formatoptions=tcqr
set cindent
set syntax=c
set tags=./tags,../tags,../../tags
set shell=/bin/bash
syntax on
map m I/*  */
i Comment       ctermbg=black ctermfg=lightgrey
hi Constant     ctermbg=black ctermfg=darkcyan
hi cTab         term=underline guibg=Grey

colorscheme morris

au VimLeave * call VimLeave()
au VimEnter * call VimEnter()

let g:PathToSessions = $HOME . "/.vim/sessions/"

function! VimEnter()
   if argc() == 0
      " gvim started with no files
      if has("browse") == 1
         let g:SessionFileName = browse(0, "Select Session", g:PathToSessions, g:PathToSessions . "LastSession.vim")
         if g:SessionFileName != ""
            exe "source " . g:SessionFileName
        " For non-gui vim
"if has("confirm") == 1
        if has("dialog_con") == 1
         let LoadLastSession = confirm("Restore last session?", "&Yes\n&No")
         if LoadLastSession == 1
            exe "source " . g:PathToSessions . "LastSession.vim"

function! VimLeave()
   exe "mksession! " . g:PathToSessions . "LastSession.vim"
   if exists("g:SessionFileName") == 1
      if g:SessionFileName != ""
         exe "mksession! " . g:SessionFileName

" A command for setting the session name (SetSession)
com -nargs=1 SS :let g:SessionFileName = g:PathToSessions . "<args>" . ".vim"
" A command for restoring the session name (RestoreSession)
com -nargs=1 RS :exec "source " . g:PathToSessions . "<args>" . ".vim"
"com -nargs=1 SetSession :let g:SessionFileName = g:PathToSessions . "pr10014" . ".vim"
" .. and a command to unset the session
com -nargs=0 US :let g:SessionFileName = ""
Comment 1 Jim Ramsay (lack) (RETIRED) gentoo-dev 2011-07-14 05:43:52 UTC
I copied in your .vimrc as given and ran vim with no arguments (with vim-7.3.244) and did not see any problems here, except a couple minor error messages:

Error detected while processing /home/lack/.vimrc:
line   16:
E488: Trailing characters: i Comment       ctermbg=black ctermfg=lightgrey
line   20:
E185: Cannot find color scheme morris
Press ENTER or type command to continue

But then it prompts me with 'Restore last session?' as I would expect from your script.  No hang.

When did the problem start happening - Immediately after you upgraded to 7.3.189?  Or some time after that?

Does the problem occur only when starting vim with no arguments?  What about with arguments, such as "vim ~/.vimrc"?

Have you tried:
 - Temporarily disabling sections of your .vimrc to find out where the problem might be (Your bug title suggests you think it's in 'confirm' - Are you sure about that?
 - Temporarily moving aside your .vim/sessions/ directory
 - Upgrading to the latest unstable (which right now is 7.3.244)

By the way, that's a neat script.
Comment 2 morris 2011-07-14 18:00:34 UTC
Thanks for the Help!

I get the "Restore last session?" prompt also, but the process takes no input at that point.  I've noticed that if I kill the process, I get some ascii stuff out of the terminal before getting the shell back:

Restore last session?
[Y]es, (N)o:Killed
mwalton@walle ~ $ 439175_1.pdf666222237=1B5B313B324666666666n 

a subsequent attempt:

Restore last session?
[Y]es, (N)o:Killed
mwalton@walle ~ $ 439175_1.pdf666222237=1B5B313B324666666666nasdfadfasdfasdf 

I'm sure the culprit is on the line containing the "confirm" command.  If I comment that line out, all is well.

creating a new sessions directory doesn't have any affect - problem still there.

i've tried to avoid using unstable.  i do compile with debug capability - maybe should try to break into the process with the debugger?

thanks - i have enjoyed using the script - i got it off the internet some time ago.

thanks for all the help.
Comment 3 Jim Ramsay (lack) (RETIRED) gentoo-dev 2011-07-15 00:35:42 UTC
If you get rid of the script temporarily and get into vim, and run just the 'confirm' line manually in command mode, does it lock up again?

  :let LoadLastSession = confirm("Restore last session?", "&Yes\n&No")
Comment 4 morris 2011-08-12 18:52:09 UTC
That seems to work fine from within vim.
Comment 5 Patrice Clement gentoo-dev 2017-10-22 12:46:42 UTC

Is this still bug report an issue? Please talk to upstream if it. Thanks!