Loading ...
Sorry, an error occurred while loading the content.

Bug in 7.0.178? redir => var makes vim crash (sometimes)

Expand Messages
  • Thomas
    Hi, The following code makes vim crash sometimes. fun! MakeVimCrash() redir = lets silent let redir END endf call MakeVimCrash() It doesn t crash always.
    Message 1 of 3 , Jan 2, 2007
    • 0 Attachment
      Hi,

      The following code makes vim crash sometimes.

      fun! MakeVimCrash()
      redir => lets
      silent let
      redir END
      endf
      call MakeVimCrash()

      It doesn't crash always. Sometimes I have to call the function twice.

      I now ran a few more tests. It appears that vim is more likely to crash
      when loading more plugins. When I remove plugins, I can call the
      function more often. I'm not able to pin it down this problem to one
      specific plugin though.

      BTW, this is part of the following function:

      fun! ResetOption(name)
      if empty(a:name)
      redir => lets
      silent let
      redir END
      let options = split(lets, "\n")
      call filter(options, 'v:val =~ ''^[^_]\+_default\s''')
      call map(options, 'matchstr(v:val, ''^[^_]\+\ze_default\s'')')
      call filter(options, 'exists("&".v:val)')
      else
      let options = split(a:name, '\W\+')
      endif
      for name in options
      let name0 = 'g:'. name .'_default'
      if exists(name0)
      exec 'let &'. name .' = '. name0
      endif
      endfor
      endf
      command! -nargs=* ResetOption :call ResetOption(<q-args>)

      Use it like this (eg to deal with misbehaving plugins changing global
      options):

      let g:tabstop_default = 4
      let &tabstop = g:tabstop_default

      let &tabstop = 8
      ResetOption

      Unfortunately :set doesn't provide a way to (re)set user-defined default
      values, it seems.

      Regards,
      Thomas.
    • Bram Moolenaar
      ... I cannot reproduce it. Please have it crash in a debugger so that we can see where it happens. Can you make it crash with vim -u NONE ? If not then
      Message 2 of 3 , Jan 6, 2007
      • 0 Attachment
        Thomas wrote:

        > The following code makes vim crash sometimes.
        >
        > fun! MakeVimCrash()
        > redir => lets
        > silent let
        > redir END
        > endf
        > call MakeVimCrash()
        >
        > It doesn't crash always. Sometimes I have to call the function twice.
        >
        > I now ran a few more tests. It appears that vim is more likely to crash
        > when loading more plugins. When I remove plugins, I can call the
        > function more often. I'm not able to pin it down this problem to one
        > specific plugin though.

        I cannot reproduce it. Please have it crash in a debugger so that we
        can see where it happens.

        Can you make it crash with "vim -u NONE"? If not then perhaps some of
        your settings or startup scripts matter. Perhaps there is a variable
        with a special value that causes a problem for ":let". E.g., a list or
        dictionary with a recursive reference. Try ":unlet" (if you can
        reproduce the crash).

        --
        Never under any circumstances take a sleeping pill
        and a laxative on the same night.

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ download, build and distribute -- http://www.A-A-P.org ///
        \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
      Your message has been successfully submitted and would be delivered to recipients shortly.