Bug 524454 - yum repolist accesses all repos
yum repolist accesses all repos
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: yum (Show other bugs)
rawhide
All Linux
low Severity medium
: ---
: ---
Assigned To: Seth Vidal
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-09-20 08:51 EDT by Mads Kiilerich
Modified: 2014-01-21 18:11 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-09-24 23:56:47 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Mads Kiilerich 2009-09-20 08:51:00 EDT
Description of problem:

yum repolist accesses all repos. That is a problem one of the repos for some reason (which isn't relevant here) doesn't work and I want a list of all my repos so that I can see which I can to disable and enable.

[root@localhost ~]# yum -y repolist
Not loading "blacklist" plugin, as it is disabled
Loading "fastestmirror" plugin
Loading "merge-conf" plugin
Loading "presto" plugin
Loading "refresh-packagekit" plugin
Loading "remove-with-leaves" plugin
Not loading "whiteout" plugin, as it is disabled
Running "config" handler for "merge-conf" plugin
Running "config" handler for "presto" plugin
Running "config" handler for "remove-with-leaves" plugin
Config time: 0.390
Running "init" handler for "fastestmirror" plugin
Yum Version: 3.2.24
COMMAND: yum -y repolist 
Installroot: /
Running "postreposetup" handler for "fastestmirror" plugin
Loading mirror speeds from cached hostfile
^C^C^C^C^C^C^C

I expect repolist to be a meta-ish command which doesn't _use_ repo configs but only reports them - at least when -v isn't specified.


Version-Release number of selected component (if applicable):

yum-metadata-parser-1.1.2-14.fc12.i686
yum-plugin-fastestmirror-1.1.23-3.fc12.noarch
yum-plugin-merge-conf-1.1.23-3.fc12.noarch
yum-presto-0.6.1-1.fc12.noarch
yum-3.2.24-4.fc12.noarch
yum-NetworkManager-dispatcher-1.1.23-3.fc12.noarch
yum-plugin-remove-with-leaves-1.1.23-3.fc12.noarch
yum-utils-1.1.23-3.fc12.noarch
Comment 1 James Antill 2009-09-21 02:06:32 EDT
Proposed fix for upstream:

    Catch and ignore any repo. errors, and allow cache only (BZ 524454)

diff --git a/yumcommands.py b/yumcommands.py
index bd73d0c..3d88ee4 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -778,13 +778,17 @@ class RepoListCommand(YumCommand):
             arg = 'enabled'
         extcmds = map(lambda x: x.lower(), extcmds)
 
-        # Setup so len(repo.sack) is correct
-        base.repos.populateSack()
+        verbose = base.verbose_logger.isEnabledFor(logginglevels.DEBUG_3)
+        try:
+            # Setup so len(repo.sack) is correct
+            base.repos.populateSack()
+        except yum.Errors.RepoError:
+            if verbose:
+                raise
 
         repos = base.repos.repos.values()
         repos.sort()
         enabled_repos = base.repos.listEnabled()
-        verbose = base.verbose_logger.isEnabledFor(logginglevels.DEBUG_3)
         if arg == 'all':
             ehibeg = base.term.FG_COLOR['green'] + base.term.MODE['bold']
             dhibeg = base.term.FG_COLOR['red']

...this means that "yum repolist -C all" will now always work (without hitting the network).
Comment 2 Mads Kiilerich 2009-09-21 17:08:16 EDT
I am not familiar with the yum codebase, but at a first glance it seems like this patch "just" would make it acceptable that contacting the repos failed unless verbose. In my specific case where yum hang while trying to contact a repo that isn't good enough.

And AFAICS a plain repolist without verbose doesn't use anything from the server anyway, so why contact them at all?

This patch to yum-3.2.24-4.fc12.noarch seems to give the behaviour I would like:

--- /usr/share/yum-cli/yumcommands.py-	2009-09-21 23:02:01.000000000 +0200
+++ /usr/share/yum-cli/yumcommands.py	2009-09-21 23:02:48.000000000 +0200
@@ -778,13 +778,14 @@
             arg = 'enabled'
         extcmds = map(lambda x: x.lower(), extcmds)
 
-        # Setup so len(repo.sack) is correct
-        base.repos.populateSack()
+        verbose = base.verbose_logger.isEnabledFor(logginglevels.DEBUG_3)
+        if verbose:
+            # Setup so len(repo.sack) is correct
+            base.repos.populateSack()
 
         repos = base.repos.repos.values()
         repos.sort()
         enabled_repos = base.repos.listEnabled()
-        verbose = base.verbose_logger.isEnabledFor(logginglevels.DEBUG_3)
         if arg == 'all':
             ehibeg = base.term.FG_COLOR['green'] + base.term.MODE['bold']
             dhibeg = base.term.FG_COLOR['red']
Comment 3 James Antill 2009-09-21 22:38:38 EDT
 As I said in my last comment:

this means that "yum repolist -C all" will now always work (without hitting
the network).

...feel free to use an alias or whatever if you always want that behaviour.

 Upstream commit is now in as:

http://yum.baseurl.org/gitweb?p=yum.git;a=commitdiff;h=2ffe59eb3e441f3fce3038d1c19079cc5c59eb74

...but I think new F11 packages should be in updates-testing "soon", if you don't want to apply it by hand it.
Comment 4 Mads Kiilerich 2009-09-22 04:55:21 EDT
Yes, I saw that -C worked without hitting the network. That is fine and definitely an improvement. It did however not cross my mind to try to use -C, so it wouldn't have helped _me_ in that situation.

My point is that there is _no_ need for repolist without -C and without -v to hit the network. For that reason I think it would be nice if it didn't do that.

I assume that you got my point but disagree and say that the rule is that yum without -C hits the network and yum with -C doesn't and you don't want execptions. Ok. You write the code and you decide ;-)
Comment 5 James Antill 2009-09-24 23:56:47 EDT
> My point is that there is _no_ need for repolist without -C and without -v to
> hit the network.

 It hits the network so it can get the package counts, I guess there are cases where this might not be that useful but there are some where it's very useful.

> say that the rule is that yum without -C hits the network

 The rule is only that yum without -C _can_ hit the network, but we try not to if there's no reason to (for instance "yum remove" doesn't). At the same time we don't try to optimize for broken repos. ... so you'd have to have a pretty good argument for removing the package counts.

 Anyway, a yum with the fix is in rawhide now.
Comment 6 Mads Kiilerich 2009-09-26 21:44:25 EDT
You are right. Package count is a reason to always try to connect. I hadn't noticed the package counts in the output.
Comment 7 Fedora Update System 2009-09-29 21:39:42 EDT
yum-3.2.24-2.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 8 Fedora Update System 2009-10-19 12:46:06 EDT
yum-3.2.24-2.fc10 has been submitted as an update for Fedora 10.
http://admin.fedoraproject.org/updates/yum-3.2.24-2.fc10
Comment 9 Fedora Update System 2009-11-04 07:07:03 EST
yum-3.2.24-2.fc10 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.