Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 375115 - sys-apps/portage: Improve depclean warning when trying to pull a system package due virtuals resolution
Summary: sys-apps/portage: Improve depclean warning when trying to pull a system packa...
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Interface (emerge) (show other bugs)
Hardware: All All
: Normal enhancement
Assignee: Portage team
URL:
Whiteboard:
Keywords:
: 377045 380515 510390 523066 642484 (view as bug list)
Depends on:
Blocks: 384979
  Show dependency tree
 
Reported: 2011-07-13 16:58 UTC by Pacho Ramos
Modified: 2019-10-22 16:06 UTC (History)
17 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 Pacho Ramos gentoo-dev 2011-07-13 16:58:42 UTC
As discussed in bug 370295, looks like would be desirable to improve warning message a bit to stop giving the impression of being contradictory because of offering a package to be depcleaned at first and, just after that, suggesting to not uninstall it due it being in system set pulled in by a virtual.

Current message is:

    !!! 'app-editors/nano' (virtual/editor) is part of your system profile.
    !!! Unmerging it may be damaging to your system.


    app-editors/nano
        selected: 2.3.1
    protected: none
        omitted: none

    All selected packages: app-editors/nano-2.3.1

A proposal could be the following:

    !!! 'app-editors/nano' is part of your system profile pulled in by virtual/editor. You will need to replace its usage with installed virtual providers (like: $(list of installed providers) to prevent damaging to your system.


    app-editors/nano
        selected: 2.3.1
    protected: none
        omitted: none

    All selected packages: app-editors/nano-2.3.1

Thanks a lot

Reproducible: Always
Comment 1 Zac Medico gentoo-dev 2011-07-30 22:36:52 UTC
*** Bug 377045 has been marked as a duplicate of this bug. ***
Comment 2 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2011-08-24 16:21:46 UTC
*** Bug 380515 has been marked as a duplicate of this bug. ***
Comment 3 Cedric Sodhi 2012-10-05 15:44:31 UTC
In my opinion, that additional layer of warning does not agree with what I perceive as Gentoo's policy of being a streamlined, uncluttered system for people who know what they are doing.

In particular, everyone using emerge --depclean is assumed to know very well what (s)he is doing.

We have one uniform layer of safety already, two, actually.

The countdown and --ask.

In fact you may ask why rm does not have any such safety but emerge does. But the layer already exists and is uniform. Another, third layer of warning the user that he may remove packages which (s)he will possibly need in the future, is clutter, in my opinion.

If someone has --deselected a package and consequently --depcleans the tree, he doesn't need to be reminded that the packages which he --deselected will be removed.

As if this weren't enough arguments against this additional warning, it may be noted that virtual/editor is in the @system set, ensuring that there will always be an editor. In fact, the whole risk of removing the "wrong" package is already solved by that. There is no need for a superflous warning of the user of something he commanded to do, which is already assured to not cause any harm by other means.

Thanks.
Comment 4 Dave Kemper 2013-05-29 01:10:12 UTC
Displaying no warning is certainly preferable to displaying the current warning.  As comment 0 explains, even though --depclean is supposed to be the safe way to remove redundant packages, the warning tells the user that this action "may be damaging to your system."  It says this even though some other editor is installed to satisfy virtual/editor (else --depclean wouldn't select nano for removal).

But I also understand why nano may warrant more of a warning than other packages --depclean identifies as redundant: unlike those other redundancies, nano may achieve that status through an unexpected and unintuitive route.  One common case is reported in bug 370295 comment 49.

There are various problems with the way the warning is currently worded, however.

  1. Most objectionable is the phrase "may be damaging to your system."  It may damage the sysadmin's sanity to have nano unexpectedly yanked, but the system itself will be just fine. :-)

  2. The warning doesn't clearly identify what's in the system set: it says "'app-editors/nano' (virtual/editor) is part of your system profile," which is kind of backwards.  It is virtual/editor that is in the system set, NOT app-editors/nano, and the wording does not make that clear.

  3. Last and least: in portage documentation, system is called a "set," not a "profile," and the terminology in the warning message should be consistent with that.

All that said, I don't care much for the alternate wording proposed in comment 0: it's long, still slightly ambiguous, and not proper English.  Here is my proposed wording:

  The system set contains virtual/editor, which is satisfied by [other editor].
  If you want to keep app-editors/nano, you must add it to the world set.

This wording (a) clearly tells the user what is in the system set, (b) identifies the alternate editor that makes --depclean consider nano redundant, and (c) provides a specific action that can be taken to retain nano.
Comment 5 Ben Kohler gentoo-dev 2014-06-17 12:05:39 UTC
*** Bug 510390 has been marked as a duplicate of this bug. ***
Comment 6 Philip Webb 2014-06-18 10:23:54 UTC
I raised this again recently as Bug 510390 & have been alerted to this older bug (thanks to Ben Kohler).  It's now 3 years since it was first reported & I'm surprised it's taken this long to decide what to do.  What's needed is fairly simple.

(1) The warning given when flag -C is used should be something close to :

  "WARNING ! -- don't use this flag
  unless you have previously tested the result with 'emerge -cpv <pkg>'
  & satisfied yourself that no harm to your system will result".

That's plain, accurate & tells a naive user what to do instead or first.

(2) Instead of the present behaviour with flag -c , which treats Nano as a requirement, Portage should check whether any of the other packages satisfying the virtual are installed & if they are, it should proceed to unmerge Nano without further comment.  Only if Nano is the last (only) package satisfying the virtual should Portage refuse to do the unmerge & issue a warning.  This should, of course, apply generally to virtuals & their satisfying packages, not just Nano.  This requires someone to do a bit of Python programming to patch Portage, but that doesn't look as if it would be very complex or time-consuming.

(3) When Portage does find that a user is about to use flag -c to delete the only package satisfying a virtual (as under (2)), it should issue a warning something like :

  "<pkg> is the only package installed to satisfy <virtual>.
  If you unmerge it, you may damage the normal working of other packages
  & in some cases you could render your system unusable".

That's fairly accurate.  As someone has pointed out, unmerging the last package satisfying 'virtual/editor' won't prevent your system booting or most uses of it, but it could be embarrassing if you need to do some sysadmin jobs ; unmerging the last package satisfying 'virtual/package-manager' or '/shadow' or '/ssh' or '/udev' could have much more serious effects.

I am always grateful for Gentoo devs' unpaid work & hope these suggestions will help solve this little problem without much more fuss or time lost by anyone.
Comment 7 Jeroen Roovers (RETIRED) gentoo-dev 2014-09-17 23:47:27 UTC
*** Bug 523066 has been marked as a duplicate of this bug. ***
Comment 8 Zac Medico gentoo-dev 2018-01-08 01:37:58 UTC
*** Bug 642484 has been marked as a duplicate of this bug. ***
Comment 9 Ben Kohler gentoo-dev 2018-02-11 01:01:38 UTC
*** Bug 647262 has been marked as a duplicate of this bug. ***
Comment 10 Michael Allan 2018-04-10 23:47:54 UTC
Philip Webb said:
> (2) Instead of the present behaviour..., Portage should check whether any
> of the other packages satisfying the virtual are installed & if they are,
> it should proceed to unmerge Nano without further comment.  ...
Certainly without a false warning.

  $ portageq expand_virtual / virtual/editor

    app-editors/nano

  $ emerge --unmerge app-editors/nano

    !!! 'app-editors/nano' (virtual/editor) is part of your system profile.
    !!! Unmerging it may be damaging to your system.

    >>> Unmerging ...

  $ portageq expand_virtual / virtual/editor

    app-editors/emacs

Safe and sound.  The warning was false.
Comment 11 inasprecali 2019-03-27 21:02:15 UTC
(In reply to Philip Webb from comment #6)
> I raised this again recently as Bug 510390 & have been alerted to this older
> bug (thanks to Ben Kohler).  It's now 3 years since it was first reported &
> I'm surprised it's taken this long to decide what to do.  What's needed is
> fairly simple.
> 
> (1) The warning given when flag -C is used should be something close to :
> 
>   "WARNING ! -- don't use this flag
>   unless you have previously tested the result with 'emerge -cpv <pkg>'
>   & satisfied yourself that no harm to your system will result".
> 
> That's plain, accurate & tells a naive user what to do instead or first.
> 
> (2) Instead of the present behaviour with flag -c , which treats Nano as a
> requirement, Portage should check whether any of the other packages
> satisfying the virtual are installed & if they are, it should proceed to
> unmerge Nano without further comment.  Only if Nano is the last (only)
> package satisfying the virtual should Portage refuse to do the unmerge &
> issue a warning.  This should, of course, apply generally to virtuals &
> their satisfying packages, not just Nano.  This requires someone to do a bit
> of Python programming to patch Portage, but that doesn't look as if it would
> be very complex or time-consuming.
> 
> (3) When Portage does find that a user is about to use flag -c to delete the
> only package satisfying a virtual (as under (2)), it should issue a warning
> something like :
> 
>   "<pkg> is the only package installed to satisfy <virtual>.
>   If you unmerge it, you may damage the normal working of other packages
>   & in some cases you could render your system unusable".
> 
> That's fairly accurate.  As someone has pointed out, unmerging the last
> package satisfying 'virtual/editor' won't prevent your system booting or
> most uses of it, but it could be embarrassing if you need to do some
> sysadmin jobs ; unmerging the last package satisfying
> 'virtual/package-manager' or '/shadow' or '/ssh' or '/udev' could have much
> more serious effects.
> 
> I am always grateful for Gentoo devs' unpaid work & hope these suggestions
> will help solve this little problem without much more fuss or time lost by
> anyone.

I'm surprised this hasn't been solved yet. This proposed behavior seems appropriate and without a doubt better than the current misleading warning.