On Thu, Nov 09, 2017 at 12:29:52PM +0100, Bram Moolenaar wrote:
> 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...

It wouldn't. I just wanted to mention another possible
alternative to trigger the race condition ("Preventing write
access to the directory ...") which won't work either.

So in summary, I don't know a reliable way to test this race
condition. Could you merge this patch without a test to fix the
issue?

Regards
Simon
-- 
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9

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