vim do not guess $HOME when unavailable
Pierre Habouzit
pierre.habouzit at m4x.org
Mon Jan 23 09:36:33 UTC 2006
Le Lun 23 Janvier 2006 09:51, A. J. Mechelynck a écrit :
> Pierre Habouzit wrote:
> > One of our users reported that with HOME unset vim does not find
> > the users vimrc, because it only uses $HOME to find the vimrc :
> >
> > http://bugs.debian.org/349465
> >
> > Is this intended (and if yes why) ? or shouldn't it use getpwuid to
> > find the information ?
>
> If $HOME is unset, there is a fallback, which can IIUC be set at
> compile-time, possibly in an architecture-dependent fashion. It is
> mentioned in the ":version" listing as "2nd user vimrc file". For
> instance, on many systems (but apparently not on Unix), if
> $HOME/.vimrc and $HOME/_vimrc are not found, Vim will look for the
> same files in the $VIM directory.
if HOME is unset by sudo, it's unlikely that it'let $VIM pass its filter
(and the DSA -- aka Debian Security Alert -- says that it only let
filtered flavours of LC_* and LANG(UAGE)? pass) ... Note that before
mailing vim-dev I read :he $HOME and :he $HOME-use to see if the
problem was already explained here, and I saw the $VIM thing.
Note that IIUC (reading :he $VIM) setting $VIM will skip the sourcing
of /etc/vim/vimrc which is worse ;)
> I suppose that on Unix/Linux, $HOME "ought" never to be unset. (What
> is the logic behind unsetting it intentionally on Debian?)
debian does not unset HOME. apparently the user that reported the bug
had it unset because of sudo.
> About that Debian bug specifically (Vim fails within sudo because
> $HOME is unset), is it really "good practice" to call vim within
> sudo? Or shouldn't sudo (after you enter the root password) set
> HOME='/root' or something like that? Or else leave $HOME unchanged?
> -- Well, now that it is known, I suppose that a usable workaround
> (until the bug is fixed) would be to login to root rather than use
> sudo. Of course it is just a "temporary workaround", not a "permanent
> solution".
sure, that's more ore less what I'll answer the user when all of this
would be sorted out. My only question was that I was surprised that
when HOME is not set, vim does not even try to read the login_dir field
of getpwuid, it's a simple guess, that can save a lot of trouble.
That's all.
I only asked if there was a rationale behind this, or if it was just
`not done' and that a patch would be accepted.
--
·O· Pierre Habouzit
··O madcoder at debian.org
OOO http://www.madism.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-vim-maintainers/attachments/20060123/9830a1d4/attachment-0001.pgp
More information about the pkg-vim-maintainers
mailing list