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

Re: (patch) GUI version of vim (vim -g) still does not clean up cscope tmp files

Expand Messages
  • Bram Moolenaar
    ... Looks like a good fix. Thanks. I ll include it. -- hundred-and-one symptoms of being an internet addict: 165. You have a web page burned into your
    Message 1 of 2 , Mar 25, 2008
    • 0 Attachment
      Dominique Pelle wrote:

      > Vim properly terminates cscope after patches 7.1.{279,281} hence
      > cleaning up cscope temporary files.
      >
      > However, I just noticed that the GUI version of Vim (vim -g)
      > still does *not* properly clean up cscope temporary files.
      > I'm using Vim-7.1.285 (GUI GTK2) on Linux x86.
      >
      > Steps to reproduce bug:
      >
      > 1/ run vim GUI in background with: "vim -g"
      >
      > 2/ add a cscope datbase with: ":cs add cscope.out"
      >
      > 3/ exit vim with ":q!"
      >
      > 4/ observe that temporary files /tmp/cscope.* are left
      >
      > Bug happens with "vim -g" but does not happen with "vim -f -g".
      >
      > After debugging, I found that "vim -g" fails to to properly
      > shutdown cscope because call to waitpid() in cs_release_csp()
      > returns error with errno=10 (No child processes). So vim sends
      > immediately SIGKILL to cscope before cscope had a chance to
      > terminate. It happens because the GUI version of vim 'vim -g'
      > runs in a forked process, so cscope process is no longer a
      > child process of vim GUI but a sibling. So waitpid fails
      > (waitpid can only wait for children processes to exit).
      >
      > I did not notice the bug earlier because I rarely run the
      > GUI version of vim.
      >
      > I attach a patch which fixes it by polling until cscope exits
      > itself as a result of sending the "q" command.
      >
      > Perhaps there is a more elegant way of fixing it. For example,
      > if cscope was spawned after forking vim, then waitpid() in
      > cs_release_csp() would succeed without having to resort to
      > such polling. But it might be a bigger change.

      Looks like a good fix. Thanks. I'll include it.

      --
      hundred-and-one symptoms of being an internet addict:
      165. You have a web page burned into your glasses

      /// 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 ///

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    Your message has been successfully submitted and would be delivered to recipients shortly.