Bug 1192655

Summary: view,ex,rvim,etc broken by libalternatives update to the vim package
Product: [openSUSE] openSUSE Tumbleweed Reporter: Clark Boylan <clark.boylan>
Component: OtherAssignee: E-mail List <screening-team-bugs>
Status: RESOLVED DUPLICATE QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: clark.boylan, osukup
Version: Current   
Target Milestone: ---   
Hardware: x86-64   
OS: openSUSE Tumbleweed   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Clark Boylan 2021-11-13 00:18:38 UTC
https://build.opensuse.org/request/show/929735 updated the vim package to use libalternatives:

$ ls -l /usr/bin/vim
lrwxrwxrwx 1 root root 4 Nov  9 15:39 /usr/bin/vim -> alts
$ alts -l

snip

---
Binary: vi
Alternatives: 1
  Priority: 20*  Target: /usr/bin/vim-nox11
                 Group: vi, vim
---
Binary: vim
Alternatives: 1
  Priority: 20*  Target: /usr/bin/vim-nox11
                 Group: vi, vim

view is a symlink to /usr/bin/vim:
$ ls -l /usr/bin/view
lrwxrwxrwx 1 root root 3 Nov  9 15:39 /usr/bin/view -> vim

Running `view` against a file exits 255:
$ ls foobar
foobar
$ cat foobar
viewing view
$ view foobar
$ echo $?
255

I suspect that the lack of an alts entry is causing this and these other vim executables are also affected:
$ ls -l /usr/bin | grep -- '-> vim'
lrwxrwxrwx 1 root root           3 Nov  9 15:39 edit -> vim
lrwxrwxrwx 1 root root           3 Nov  9 15:39 ex -> vim
lrwxrwxrwx 1 root root           3 Nov  9 15:39 rview -> vim
lrwxrwxrwx 1 root root           3 Nov  9 15:39 rvim -> vim
lrwxrwxrwx 1 root root           3 Nov  9 15:39 view -> vim
lrwxrwxrwx 1 root root           3 Nov  9 15:39 vimdiff -> vim

As a side note `man alts` does not really provide sufficient info on how to use this system. I would attempt to set up a user config to confirm this is the issue, but the manpage doesn't say what config files are used or how to map one name to another program using `alt -u`.
Comment 1 Clark Boylan 2021-11-13 00:41:23 UTC
I managed to find the libalternatives configs via the spec diff in the previously mentioned package update. Mimicking those updates locally:

$ ls -l /usr/share/libalternatives/view
total 4
-rw-r--r-- 1 root root 58 Nov 12 16:38 20.conf
$ cat /usr/share/libalternatives/view/20.conf
binary=/usr/bin/vim-nox11
group=vim, vi
options=KeepArgv0

I can now run `view foobar` and get the file to open. This seems to confirm the issue is a lack of appropriate libalternatives configuration.
Comment 2 Ondřej Súkup 2021-11-13 10:45:19 UTC
duplicate

*** This bug has been marked as a duplicate of bug 1192631 ***