Bug 1328973

Summary: RFE: use "Recommends: /usr/bin/vi" instead of hard Requires, so removing 'vim-minimal' does not remove sudo
Product: [Fedora] Fedora Reporter: Diftraku <diftraku>
Component: sudoAssignee: Radovan Sroka <rsroka>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: kzak, mattdm, moshima.web, ppisar, rsroka
Target Milestone: ---Keywords: Reopened, Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
URL: https://ghostbin.com/paste/hbasv
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-10-03 20:21:19 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Output from 'dnf remove vim-minimal'
none
Select default editor at build time
none
Define list of default editors starting with vim none

Description Diftraku 2016-04-20 18:58:05 UTC
User-Agent:       Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36
Build Identifier: 

When removing 'vim-minimal', 'dnf' also removes 'sudo' as a dependency. This leaves the system without working root if you have not enabled/set a password for the 'root'.

Reproducible: Always

Steps to Reproduce:
1. Run 'sudo dnf remove vim-minimal'
2. ???
3. You now have no 'sudo' or 'vim'. Profit!
Actual Results:  
You are left without vim and sudo

Expected Results:  
'vim-minimal' package is no longer installed and 'sudo' is still installed

$ sudo dnf remove vim-minimal
Dependencies resolved.
====================================================================================
 Package           Arch         Version                Repository              Size
====================================================================================
Removing:
 sudo              x86_64       1.8.15-1.fc23          @updates               2.4 M
 vim-minimal       x86_64       2:7.4.827-1.fc23       @koji-override-0       1.0 M

Transaction Summary
====================================================================================
Remove  2 Packages

Comment 1 Diftraku 2016-04-20 18:58:50 UTC
Created attachment 1149168 [details]
Output from 'dnf remove vim-minimal'

Comment 2 Diftraku 2016-04-20 21:00:52 UTC
This may be a dupe of #164982. Granted, it was closed and did not appear in the guided bug report form.

Comment 3 Karsten Hopp 2016-04-21 15:31:55 UTC
a more recent bugzilla is bug 979382.
This isn't a bug in vim, sudo needs to require something like a virtual requirement 'editor' and all editors like nano, ed, emacs, vi, vim need to provide that so that installing either one of them would be sufficient.
To make visudo work with those other editors it needs to be compiled with --with-env-editor and the EDITOR variable needs to be set.

Comment 4 Fedora End Of Life 2016-11-25 07:25:04 UTC
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 5 Fedora End Of Life 2016-12-20 20:03:40 UTC
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 6 Matthew Miller 2017-02-02 16:11:11 UTC
Even vim-minimal is not completely tiny, and with the advent of /etc/sudoers.d/, editing the config file is rarely necessary. Can we change Requires to Recommends?

Comment 7 Petr Pisar 2017-10-03 12:56:11 UTC
Created attachment 1333632 [details]
Select default editor at build time

I can see it has already been changed from Requires to Recommends.

I offer here another patch that actually allows to select the default editor at build time. This is needed for Modular Fedora where Platform module does not provide vim-minimal. It provides nano instead.

Simply defining sudo_editor at build time does the trick:

%sudo_editor nano

If you don't have objections, I will apply it into master dist-git branch.

Comment 8 Matthew Miller 2017-10-03 13:23:38 UTC
It looks like `editor` in /etc/sudoers takes a list (defaulting to /bin/vi.)

I don't have any particular objection, but perhaps we should set that variable to something like:

Defaults editor = /usr/bin/vim:/usr/bin/vi:/usr/bin/nano

?

I sure would prefer defaulting to vim rather than just vi when available!

Comment 9 Petr Pisar 2017-10-03 13:37:42 UTC
Yes, I know about the list. The configure option also accepts a list. I only thought the spec intentionally uses single value for whatever (performance, security) reason.

I agree that setting a list is better.

What about Recommends? Do you want to keep it there? Or recommend vim-enhanced and suggest all the others?

Comment 10 Petr Pisar 2017-10-03 13:42:46 UTC
I'm not sure what will be the policy about soft dependencies on packages from another modules. I think it's acceptable to Recommend vim-enhanced even if it is not in Platform. Although some releng'a and QE'a scripts performing repoclosure could trigger a wanrnig/error about it. I'm not sure how to handle it.

Comment 11 Matthew Miller 2017-10-03 13:59:11 UTC
I honestly have no idea. :)

Comment 12 Petr Pisar 2017-10-04 13:59:13 UTC
Created attachment 1334263 [details]
Define list of default editors starting with vim

This implements the idea of trying vim, vi and as last nano.

Comment 14 Matthew Miller 2021-08-07 17:07:00 UTC
So I forgot about this but came across it again. I suppose now we should make it:

Defaults editor = /usr/bin/nano:/usr/bin/vim:/usr/bin/vi

with nano first, since nano is now our default editor -- and, correspondingly, "Recommends" nano and "Suggests" the others?

Comment 15 Matthew Miller 2021-10-03 20:21:19 UTC
in Rawhide now (with nano)