Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

E828: Cannot open undo file for writing / odd path from undofile() #5

Closed
blueyed opened this Issue Dec 5, 2011 · 9 comments

Comments

Projects
None yet
3 participants
Contributor

blueyed commented Dec 5, 2011

When trying to SudoWrite a file like /etc/fstab, I am getting the following error:

"/etc/fstab" 26L, 1473C written
Error detected while processing function SudoEdit#SudoDo..SudoEdit#LocalSettings:
line   16:
E828: Cannot open undo file for writing: /home/user/.local/share/vim/undo//etc/fstabetc/etc/fstabfstab

It looks like the undofile() function returns some odd path (in SudoEdit#LocalSettings), but works properly when called manually:

:echo undofile(@%)
/home/user/.local/share/vim/undo/%etc%fstab

Using Vim 7.3.315.

This is related to the fix for issue 3.

Owner

chrisbra commented Dec 5, 2011

Hi Daniel!

On Mo, 05 Dez 2011, Daniel Hahler wrote:

When trying to SudoWrite a file like /etc/fstab, I am getting the following error:

"/etc/fstab" 26L, 1473C written
Error detected while processing function SudoEdit#SudoDo..SudoEdit#LocalSettings:
line   16:
E828: Cannot open undo file for writing: /home/user/.local/share/vim/undo//etc/fstabetc/etc/fstabfstab

It looks like the undofile() function returns some odd path (in SudoEdit#LocalSettings), but works properly when called manually:

:echo undofile(@%)
/home/user/.local/share/vim/undo/%etc%fstab

Using Vim 7.3.315.

This is related to the fix for issue 3.

Thanks for noticing. You are using the undodir option? This might be
related.

I think the last commit fixes that.

regards,
Christian

This is still an error for me:

"Can't write undofile! Check permissions of ..."

Is there something going on with trying to write the undofile as sudo and not the regular user?

Owner

chrisbra commented Dec 6, 2011

On Tue, December 6, 2011 4:48 am, Sean Farley wrote:

This is still an error for me:

"Can't write undofile! Check permissions of ..."

Is there something going on with trying to write the undofile as sudo and
not the regular user?

Probably Vim will try to create an undofile for you as regular user in a
path, that is not writable for the regular user. You should be able to
set the 'undodir' option to have Vim no scatter your system with undofiles
all around.

regards,
Christian

Sorry, I didn't post the path. It is my usual undodir setting:

"Can't write undofile! Check permissions of /Users/sean/.vim/tmp/undo//%opt%local%etc%mpicc.conf"

which should definitely be writeable as both myself and as root.

Contributor

blueyed commented Dec 6, 2011

Maybe a problem with the double slashes ("//") in there? (wild guess)

Contributor

blueyed commented Dec 6, 2011

I was getting this error still (after not catching and rephrasing it anymore):

E828: Cannot open undo file for writing: /home/user/.local/share/vim/undo//etc/fstabetc/etc/fstabfstab

I have just created a pull request to fix this: #6

Owner

chrisbra commented Dec 6, 2011

Thanks for your fix. However, the last commit should have fixed it. Well, but perhaps fnameescape is even better.

Owner

chrisbra commented Dec 6, 2011

last commit makes use of fnameescape().
please test. It should work now.

Contributor

blueyed commented Dec 6, 2011

Yup, much better.
Thanks!

@blueyed blueyed closed this Dec 6, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment