Simon Ruderich wrote:

> On Wed, Nov 08, 2017 at 10:15:31PM +0100, Bram Moolenaar wrote:
> >>> Can you write a test for this?
> >>
> >> I don't know how. It's a race condition which is difficult to
> >> reproduce (file must not exist during mch_stat, but exist during
> >> mch_open).
> >
> > I think you can simulate this by creating the viminfo.tmp file with no
> > access for the current user.  Then mch_stat() fails but creating the
> > file also fails.
> 
> This won't work. Stating a file succeeds even without read
> access. Preventing write access to the directory would work for
> the first part (mch_stat and mch_open fail) but then the rename
> step would fail.

I'm starting to wonder when renaming the temp file would ever work.
If the directory is writable it would be in the same directory as the
original viminfo file.  If it's not writable, then renaming should also
fail...

-- 
SOLDIER: Where did you get the coconuts?
ARTHUR:  Through ... We found them.
SOLDIER: Found them?  In Mercea.  The coconut's tropical!
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- 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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui