Bug#600481: vim removes contents of encrypted files without warning if gnupg key has expired

H. S. hs.samix at gmail.com
Mon Oct 18 03:14:03 UTC 2010

On Sun, Oct 17, 2010 at 12:52 PM, James Vega <jamessan at debian.org> wrote:
> reassign 600481 vim-scripts
> forcemerge 573440 600481
> retitle 573440 [gnupg.vim] Truncates original file when error in gnupg command occurs
> thanks
> On Sun, Oct 17, 2010 at 10:25:18AM -0400, H. S. wrote:
>> Trying to open a gnupg encrypted text file in vim when the GnuPG key is expired results in
>> deletion of the contents of the file. Vim gives no warning that the contents will be lost, at
>>  least I did not see any. This happened repeatedly until I renewd my gnupg key.
> This looks like it may have the same root cause as #573440.  Namely, the way
> gnupg.vim is written it doesn't handle an error from gnupg.  I contacted
> Markus about that a while ago but haven't heard back from him yet.
> I think the proper solution would be to change gnupg.vim to use a BufWriteCmd
> autocmd instead of a pair of BufWritePre/BufWritePost autocmds, but I haven't
> had a chance to test out such an implementation.

Thanks for the feedback. I am interested in how this problem is
resolved so I plan to follow this bug.

What I don't understand is that if vim cannot save the file in
encrypted form becuase the key has expired (and goes not to delete the
file's contents), why is it able to decrypt and open it in the first
place? If it at least did not open the file, it would prevent the data

Warm regards.

More information about the pkg-vim-maintainers mailing list