Saturday, January 21, 2012

Re: warning on opening encrypted file

On Sat, Jan 21, 2012 at 02:20:26PM +0100, Bram Moolenaar wrote:

> Toothpik wrote:

> > On Fri, Jan 20, 2012 at 02:46:58PM -0600, sc wrote:
> > > On Fri, Jan 20, 2012 at 09:14:13PM +0100, Bram Moolenaar wrote:
> >
> > > > Toothpik wrote:
> >
> > > > > i'm one of those risk-takers who like to keep his passwords in a
> > > > > module in his home path -- for the purposes of this email let's
> > > > > say i call it "passwords"
> > > > >
> > > > > as a nod to security i've started keeping it encrypted
> > > > > (blowfish)
> > > > >
> > > > > i also like the new undofile option, it would have saved me much
> > > > > hair tearing and teeth gnashing if i had had it all along
> > > > >
> > > > > when these two likes coincide (opening an encrypted file with
> > > > > 'set undofile' in my .vimrc) i get an unpleasant warning that
> > > > >
> > > > > E832: Non-encrypted file has encrypted undo file:
> > > > > /yadayada/passwords
> > > > >
> > > > > i can work around this with
> > > > >
> > > > > if expand("%") != "passwords"
> > > > > set undofile
> > > > > endif
> > > > >
> > > > > in my .vimrc, but on reflection i can't think of a better
> > > > > candidate for persistent undo than that module
> > > > >
> > > > > does anyone have a better workaround, or is this perchance a bug
> > > > > somewhere along the line -- after all, it is indeed not a
> > > > > non-encrypted file and should not be reporting it as such
> > > > >
> > > > > my vim is 7.3.406
> >
> > > > I don't see this problem, I can use an undo file with an encrypted file
> > > > without problems.
> >
> > > > Perhaps the sequence in which you do things matter? Try to make a
> > > > reproducible example, starting with "vim -u NONE". Don't use your real
> > > > passwords file :-).
> >
> > > ok, you're right -- with "vim -u testvimrc" it doesn't happen
> > > too, where testvimrc contains only
> >
> > > set nocompatible
> > > set undofile
> >
> > > so, for the next while or so i will be moving things around in
> > > my [monster] vimrc in an attempt to find out why
> >
> > > anyone wanting to help out is welcome to see the beast at
> >
> > > https://github.com/toothpik/toothpik-s-.vimrc/blob/master/.vimrc
> >
> > ok, this is fun
> >
> > it seems setting undodir before undofile triggers the E832 for
> > encrypted files
> >
> > to recreate, make a testvimrc containing only
> >
> > set nocompatible
> > set undodir=~/.vim/undo
> > set undofile
> >
> > then use it as with
> >
> > vim -u testvimrc testfile
> >
> > where testfile is encrypted -- you are guaranteed to see the
> > error
> >
> > it bites me because i try to keep my options sorted
> > alphabetically -- they're easier to find that way, and undodir
> > sorts above undofile

> I cannot reproduce the problem. Perhaps it's because of other files in
> your undo directory? Try using another directory, e.g. ~/.vim/undotest

you are spot-on bram

with a new directory, with undodir defined before my undofile
definition, i can open "test" with no E832

after adding another normal file i could still open "test" no
problem (with undodir set to ~/.vim/undotestdir i made changes
to an un-encrypted file)

BUT then i made changes to "test", and saved and exited, and the
next time i tried to open "test" i got the E832 -- so you are
right, there are more steps to recreate the issue -- there need
to be both encrypted and non-encrypted files in the undodir
before the error message generates

recapping: to generate a spurious and misleading error message

- define undodir before undofile in your .vimrc
- create both normal and encrypted undofiles in the defined
undodir by saving changes to both normal and encrypted
files
- attempt to open an encrypted file -- you will see the E832
- move the definition of undodir to after the definition of
undofile in your vimrc
- open an encrypted file again and you will be surprised by
what you will not see: the error

you probably want to give this a low priority since there is
such a simple workaround, but it gives a bad impression of vim
when it generates error messages that are simply not true

sc

--
You received this message from the "vim_use" 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

No comments: