Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 819342 - app-editors/nano - after removing nano with emerge --depclean there was no check with eselect editor update
Summary: app-editors/nano - after removing nano with emerge --depclean there was no ch...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal minor
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2021-10-21 18:15 UTC by korte
Modified: 2024-12-07 22:55 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description korte 2021-10-21 18:15:25 UTC
I would be nice, to run a 'eselect editor update' if a package from app-editors is removed.

Thanks to hyphoon from #gentoo.



see also: https://bugs.gentoo.org/18537
Comment 1 Mike Gilbert gentoo-dev 2021-10-24 01:27:12 UTC
This could potentially be implemented in pkg_postrm in the ebuild.

Personally, I don't use "eselect editor", and would prefer NOT to have the nano ebuild invoke it automatically every time I unmerge nano.
Comment 2 Ulrich Müller gentoo-dev 2021-10-24 10:33:40 UTC
The only package attempting such a thing is sys-apps/moreutils which calls "eselect editor update" in pkg_postinst (see bug 604630).

The update action will check if the currently selected target is valid (and do nothing in this case), otherwise it will go through EDITOR_LIST="nano ed emacs ex vi xemacs" in order and select the first available target. Similar for "eselect visual" where the list is "nano emacs vi xemacs".

I am not entirely sure if calling it from an ebuild is a good thing. Except for listing nano first, the list doesn't express any preferences and is in alphabetical order. So, I tend to say that ebuilds shouldn't try to guess the user's preferences there, because the result may be worse than leaving the variable alone.

Maybe pkg_postrm of nano could just test for [[ ${EDITOR##*/} == nano ]] and output a warning that the user needs to update the variable? (Same for ${VISUAL} I guess.)
Comment 3 korte 2021-10-24 19:25:14 UTC
(In reply to Ulrich Müller from comment #2)

> Maybe pkg_postrm of nano could just test for [[ ${EDITOR##*/} == nano ]] and
> output a warning that the user needs to update the variable? (Same for
> ${VISUAL} I guess.)

That would be helpful.
Comment 4 Larry the Git Cow gentoo-dev 2022-06-29 09:09:15 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6f0a95daae18c8bb7c99acd1a3430651e2d6ca75

commit 6f0a95daae18c8bb7c99acd1a3430651e2d6ca75
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2022-06-29 07:38:13 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-06-29 09:09:09 +0000

    app-editors/nano: Warn in pkg_postrm about updating EDITOR
    
    Closes: https://bugs.gentoo.org/819342
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>
    Closes: https://github.com/gentoo/gentoo/pull/26133
    Signed-off-by: Sam James <sam@gentoo.org>

 app-editors/nano/nano-6.3.ebuild | 9 +++++++++
 1 file changed, 9 insertions(+)
Comment 5 Alexander Kurakin 2024-12-07 22:21:55 UTC
Should we populate this solution to some other packages?
Comment 6 Mike Gilbert gentoo-dev 2024-12-07 22:55:56 UTC
Is there any reason to spread this to other ebuilds? You would really have to go out of your way to run into this situation with anything other than nano.