On Di, 13 Aug 2013, Christian Brabandt wrote:

> On Tue, August 13, 2013 01:00, Einar Lielmanis wrote:
> > Encrypted file contents are destroyed, if something (e.g autocmd)
> > triggers write event, while user is being asked for password.
> >
> > To repro:
> > 1. have an encrypted.txt ready (:X)
> > 2. gvim, :au focuslost * w
> > 3. :e encrypted.txt, don't type in the password yet,
> > 4. lose window focus, e.g via switching to another window, to trigger
> >    the focuslost event,
> >
> > Expected:
> > The file hasn't changed, so it should stay unmodified,
> >
> > Actual behavior:
> > encrypted.txt is truncated to a zero size.
> 
> 
> I don't see this. Using Vim 7.4 on Windows I get
> vim -u NONE -N -i NONE
> :au FocusLost * w
> :e encrypted.txt
> (change Focus)
> Error detected while processing FocusLost Auto commands for "*":
> E505: "c:\temp\encrypted.txt" is read-only (add ! to override)
> "c:\temp\encrypted.txt" [crypted] 2L, 13C
> 
> 
> In any case, the file is *not* written.
> 
> If you used au FocusLost * :w! the file is indeed truncated
> but even then after entering the correct password Vim can read
> the encrypted file (but you would need to make sure
> you have written the file or else you would be left with an empty
> file).

Hm, on Linux, it indeed truncates the encrypted file.
Anybody else sees this difference?

Wouldn't it be a good idea, to have the file set readonly for as long it 
hasn't been encrypted (e.g. the current windows behaviour)?

regards,
Christian
-- 

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Raspunde prin e-mail lui