Interloper vi

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Interloper vi

Suresh Govindachar`
Hello,

On Ubuntu 16.04, downloaded sources from github, and executed

     cd vim
     ./configure --prefix=/lhome/me/tools
     cd src
     make
     make install

ls /lhome/me/tools/bin does not show any vi.  So executed

     cd /lhome/me/tools/bin
     ln -s /lhome/me/tools/bin/vim vi

     $ which vi
     /lhome/me/tools/bin/vi

     $ ll /lhome/me/tools/bin/vi
     lrwxrwxrwx 1 hidden hidden 3 Jul 31 19:01 /lhome/me/tools/bin/vi ->
/lhome/me/tools/bin/vim*

vim --version does show the expected version.
However, vi --version shows some old version!

Why is the old vi being executed even though `which vi` shows the newer
one?  And how to get vi to execute the newly installed vim?

     $ ll /usr/bin/vi
     lrwxrwxrwx 1 root root 20 Jun 16  2017 /usr/bin/vi ->
/etc/alternatives/vi*

     $ ll /etc/alternatives/vi
     lrwxrwxrwx 1 root root 17 Jun 21  2017 /etc/alternatives/vi ->
/usr/bin/vim.gtk3*

Thanks,

--Suresh

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Interloper vi

Tim Chase
On 2018-07-31 19:20, 'Suresh Govindachar' via vim_use wrote:
> Why is the old vi being executed even though `which vi` shows the
> newer one?  And how to get vi to execute the newly installed vim?

Have you checked for an alias?  Possibly something like

  $ alias vi
  alias vi='/usr/bin/vi'

Also, what's your $PATH?

  $ echo $PATH

-tim



--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Interloper vi

Tony Mechelynck
If you use the bash shell, the command "type -a vi" (without the
quotes) will tell you every alias and every executable in the $PATH
with the name "vi", and it will display them in the order in which the
shell loks for them.

If there is an alias for "vi", you can remove it with
    unalias vi
then the symlink you already have ought to become the first "vi" that
bash finds, and it loads your new home-compiled vim.

Best regards,
Tony.

On Wed, Aug 1, 2018 at 4:23 AM, Tim Chase <[hidden email]> wrote:

> On 2018-07-31 19:20, 'Suresh Govindachar' via vim_use wrote:
>> Why is the old vi being executed even though `which vi` shows the
>> newer one?  And how to get vi to execute the newly installed vim?
>
> Have you checked for an alias?  Possibly something like
>
>   $ alias vi
>   alias vi='/usr/bin/vi'
>
> Also, what's your $PATH?
>
>   $ echo $PATH
>
> -tim
>
>
>
> --
> --
> 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
>
> ---
> You received this message because you are subscribed to the Google Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> For more options, visit https://groups.google.com/d/optout.

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Interloper vi

Tony Mechelynck
On Wed, Aug 1, 2018 at 4:37 AM, Tony Mechelynck
<[hidden email]> wrote:
> If you use the bash shell, the command "type -a vi" (without the
> quotes) will tell you every alias and every executable in the $PATH
> with the name "vi", and it will display them in the order in which the
> shell loks for them.
>
> If there is an alias for "vi", you can remove it with
>     unalias vi
> then the symlink you already have ought to become the first "vi" that
> bash finds, and it loads your new home-compiled vim.

P.S. This "unalias" command is only temporary. If you want to make it
permanent, you will have to remove or override that alias, which is
set by one (or more) of the startup scripts run by your shell. See the
shell's manpage for details.

>
> Best regards,
> Tony.
>
> On Wed, Aug 1, 2018 at 4:23 AM, Tim Chase <[hidden email]> wrote:
>> On 2018-07-31 19:20, 'Suresh Govindachar' via vim_use wrote:
>>> Why is the old vi being executed even though `which vi` shows the
>>> newer one?  And how to get vi to execute the newly installed vim?
>>
>> Have you checked for an alias?  Possibly something like
>>
>>   $ alias vi
>>   alias vi='/usr/bin/vi'
>>
>> Also, what's your $PATH?
>>
>>   $ echo $PATH
>>
>> -tim
>>
>>
>>
>> --
>> --
>> 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
>>
>> ---
>> You received this message because you are subscribed to the Google Groups "vim_use" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
>> For more options, visit https://groups.google.com/d/optout.

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Interloper vi

Suresh Govindachar`
In reply to this post by Suresh Govindachar`

Tried the suggestions from Tim and Tony, but to no avail:


     $ echo $PATH
 
/lhome/me/tools/bin:/lhome/me/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/cuda/bin:/usr/local/cuda/bin:/opt/rocm/bin:/lhome/me/g/bin

     $ alias  vi
     bash: alias: vi: not found

     $ cd
     $ find . -maxdepth 1 -type f |xargs  grep alias |  grep vi
     <no output>

     $ type -a vi
     vi is /lhome/me/tools/bin/vi
     vi is /usr/bin/vi

     $ ll  /lhome/me/tools/bin/vi
     lrwxrwxrwx 1 hidden hidden 28 Jul 31 19:18 /lhome/me/tools/bin/vi
-> /lhome/me/tools/bin/vim*

     $ ll  /lhome/me/tools/bin/vim
     -rwxr-xr-x 1 hidden hidden 2723248 Jul 31 18:53
/lhome/me/tools/bin/vim*

     $ ll  /usr/bin/vi
     lrwxrwxrwx 1 root root 20 Jun 16  2017 /usr/bin/vi ->
/etc/alternatives/vi*

     $ ll   /etc/alternatives/vi
     lrwxrwxrwx 1 root root 17 Jun 21  2017 /etc/alternatives/vi ->
/usr/bin/vim.gtk3*

     $ ll  /usr/bin/vim.gtk3
     -rwxr-xr-x 1 root root 2927872 Nov 24  2016 /usr/bin/vim.gtk3*

     $ which vi
     /lhome/me/tools/bin/vi

     Still `vi --version` shows the old version (and `vim --version`
shows the latest version)

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Interloper vi

Tony Mechelynck
Maybe your shell has forgotten to update its hash tables of
"remembered" program locations.

Try (at a shell prompt)
    hash -r

to forget everything, then invoke vi again.

Best regards,
Tony.

On Wed, Aug 1, 2018 at 6:24 AM, 'Suresh Govindachar' via vim_use
<[hidden email]> wrote:

>
> Tried the suggestions from Tim and Tony, but to no avail:
>
>
>     $ echo $PATH
>
> /lhome/me/tools/bin:/lhome/me/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/cuda/bin:/usr/local/cuda/bin:/opt/rocm/bin:/lhome/me/g/bin
>
>     $ alias  vi
>     bash: alias: vi: not found
>
>     $ cd
>     $ find . -maxdepth 1 -type f |xargs  grep alias |  grep vi
>     <no output>
>
>     $ type -a vi
>     vi is /lhome/me/tools/bin/vi
>     vi is /usr/bin/vi
>
>     $ ll  /lhome/me/tools/bin/vi
>     lrwxrwxrwx 1 hidden hidden 28 Jul 31 19:18 /lhome/me/tools/bin/vi ->
> /lhome/me/tools/bin/vim*
>
>     $ ll  /lhome/me/tools/bin/vim
>     -rwxr-xr-x 1 hidden hidden 2723248 Jul 31 18:53 /lhome/me/tools/bin/vim*
>
>     $ ll  /usr/bin/vi
>     lrwxrwxrwx 1 root root 20 Jun 16  2017 /usr/bin/vi ->
> /etc/alternatives/vi*
>
>     $ ll   /etc/alternatives/vi
>     lrwxrwxrwx 1 root root 17 Jun 21  2017 /etc/alternatives/vi ->
> /usr/bin/vim.gtk3*
>
>     $ ll  /usr/bin/vim.gtk3
>     -rwxr-xr-x 1 root root 2927872 Nov 24  2016 /usr/bin/vim.gtk3*
>
>     $ which vi
>     /lhome/me/tools/bin/vi
>
>     Still `vi --version` shows the old version (and `vim --version` shows
> the latest version)
>
>
> --
> --
> 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
>
> --- You received this message because you are subscribed to the Google
> Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [hidden email].
> For more options, visit https://groups.google.com/d/optout.

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Interloper vi

John Little-4
In reply to this post by Suresh Govindachar`

On Wednesday, August 1, 2018 at 4:24:14 PM UTC+12, Suresh Govindachar wrote:
...
>      $ alias  vi
>      bash: alias: vi: not found

reveals your shell is bash.

>      $ which vi
>      /lhome/me/tools/bin/vi

"which" is not what you want with bash.  It is /usr/bin/which, not a bash built-in, so it doesn't tell you what bash will do. In a new bash window, if I run:

        $ type vim
        vim is /usr/local/bin/vim
        $ vim -c q
        # the screen clears...
        $ which vim
        /usr/local/bin/vim
        $ type vim
        vim is hashed (/usr/local/bin/vim)

So, better use "type".  Seeing vim hashed to something you don't expect would at least be a hint towards Tony's advice to try hash -r.

Regards, John Little

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Interloper vi

Suresh Govindachar`
In reply to this post by Tony Mechelynck
Resolved -- the interloper vi (i.e., what was executed when vi was
called in bash) was a vi that bash had hashed rather than the vi that
was currently in the PATH.

Extract from replies:  `which` does not report on what bash will
execute;  `type` does.  Although `type` provides info on whether the
command is hashed or not, `type -a` does not. `hash -r` clears the hash.

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Interloper vi

Tony Mechelynck
"hash" will no arguments will also tell you the full list of the
hashes for _this instance_ of bash. If you have several shells (e.g.
in several konsole tabs and/or several xterms and/or in Ctrl-Alt-F1,
Ctrl-Alt-F2 .. Ctrl-Alt-F6; etc.), each of them has a separate
hashlist.

Best regards,
Tony.

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Interloper vi

Christian Brabandt
In reply to this post by Suresh Govindachar`

On Mi, 01 Aug 2018, 'Suresh Govindachar' via vim_use wrote:

> Extract from replies:  `which` does not report on what bash will execute;
> `type` does.  Although `type` provides info on whether the command is hashed
> or not, `type -a` does not. `hash -r` clears the hash.

Just a related and imho interesting read about the gotchas of which and
pros and cons of alternatives in various shells:
https://unix.stackexchange.com/q/85249

Best,
Christian
--
Einen Menschen lieben hei├čt, ihn so zu sehen, wie Gott ihn gemeint
hat.
                -- Fjodor Michailowitsch Dostojewski

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Interloper vi

Erik Christiansen
On 01.08.18 13:19, Christian Brabandt wrote:
>
> On Mi, 01 Aug 2018, 'Suresh Govindachar' via vim_use wrote:
>
> > Extract from replies:  `which` does not report on what bash will execute;
> > `type` does.  Although `type` provides info on whether the command is hashed
> > or not, `type -a` does not. `hash -r` clears the hash.

My take, FWIW, on `type -a` not reporting hash details is that it's only
an advantage, as the hash is just an irrelevant internal cache of paths,
without any effect on which executables are available, or which will be
executed.

> Just a related and imho interesting read about the gotchas of which and
> pros and cons of alternatives in various shells:
> https://unix.stackexchange.com/q/85249

Thanks Christian, for that informative history. It brings back memories
of why I aliased "which" to `type -a' over a quarter of a century ago.
ISTM that the "which" script, having never been fixed, remains unusable,
and "type" remains mnemonically indistinguishable from a print command,
so the alias continues to fix a broken situation, so long as we're on an
account we've set up. (It's far from the only thing in .bashrc &
.profile to make the raw shell usable.)

Erik

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.