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

Re: [patch] check for tempdir

Expand Messages
  • Bram Moolenaar
    ... If the temp directory gets deleted that means any temp files are also gone. That s already a problem, e.g., when running a :make that takes a while.
    Message 1 of 2 , Dec 28, 2010
      Christian Brabandt wrote:

      > this patch checks, that the generated tmpdir does exist and not error
      > out. For example when a cron job deletes the v* temporary directory
      > (because it is too old). You can check this, if you manually delete the
      > /tmp/v* directory for a running vim session and afterwards run something
      > like :r !echo "foobar" or :echo system("echo foo")
      >
      > With this patch, a new directory will be created, in case the old one
      > does not exist anymore and no error message will be displayed.
      >
      > chrisbra@r500vm ~/code/vim/src (hg)-[default]- % hg qdiff
      > diff --git a/src/fileio.c b/src/fileio.c
      > --- a/src/fileio.c
      > +++ b/src/fileio.c
      > @@ -7353,7 +7353,7 @@
      > * It's also a bit faster, because we only need to check for an existing
      > * file when creating the directory and not for each temp file.
      > */
      > - if (vim_tempdir == NULL)
      > + if (vim_tempdir == NULL || !mch_isdir(vim_tempdir))
      > {
      > /*
      > * Try the entries in TEMPDIRNAMES to create the temp directory.

      If the temp directory gets deleted that means any temp files are also
      gone. That's already a problem, e.g., when running a ":make" that takes
      a while. Creating the directory anew just lessens the problem.

      There must be no cron jobs that delete temp files, that is a
      configuration error. On FreeBSD the temp files are not even deleted on
      reboot.

      The check if the directory exists takes a bit of extra time.
      If we really want to re-create the directory, it's better done when
      something fails, to avoid this extra overhead that is unecessary in
      99.99% of the cases.

      --
      hundred-and-one symptoms of being an internet addict:
      48. You get a tatoo that says "This body best viewed with Netscape 3.1 or
      higher."

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ an exciting new programming language -- http://www.Zimbu.org ///
      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    Your message has been successfully submitted and would be delivered to recipients shortly.