[Bug 93449] Re: Wrong .viminfo creation permissions when running "sudo vim"
Launchpad Bug Tracker
93449 at bugs.launchpad.net
Fri Oct 25 05:26:06 UTC 2013
*** This bug is a duplicate of bug 58002 ***
https://bugs.launchpad.net/bugs/58002
Status changed to 'Confirmed' because the bug affects multiple users.
** Changed in: vim (Ubuntu)
Status: New => Confirmed
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to vim in Ubuntu.
https://bugs.launchpad.net/bugs/93449
Title:
Wrong .viminfo creation permissions when running "sudo vim"
Status in “vim” package in Ubuntu:
Confirmed
Bug description:
Binary package hint: vim
Description:
When running vim for the first time, if you run it with sudo (e.g.
"sudo vim /tmp/file.txt"), the $HOME/.viminfo file is created with
root:root permissions, and the usual vim session environment (e.g.
command history, markers) does not work anymore until you fix .viminfo
permissions.
Steps do reproduce the problem:
1) Remove previous .viminfo file:
$ rm -f ~/.viminfo
2) Run vim with sudo to edit a file:
$ sudo vim /tmp/test1.txt
3) Run commands in normal mode (e.g. :1d, :wq), save the file and
exit.
4) Run vim again, this time as a normal user:
$ vim /tmp/test2.txt
5) Type, in normal mode, ":history". You should see:
# cmd history
> 1 history
Note the commands typed in previous session are not listed. From now
on, any commands typed will not be saved to the .viminfo file, because
of its wrong permissions:
$ ls -l ~/.viminfo
-rw------- 1 root root 593 2007-03-18 12:43 .viminfo
Workaround:
- Create a empty .viminfo in /etc/skel/, so new accounts have vim
history working properly from the beginning:
# touch /etc/skel/.viminfo
- Fix .viminfo permissions for existing users. For each existing user
on the system, run (as the user):
$ sudo chown $(id -u):$(id -g) .viminfo
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/vim/+bug/93449/+subscriptions
More information about the foundations-bugs
mailing list