Bug 462158

Summary: optparse.OptionConflictError: option --skip-broken
Product: [Fedora] Fedora Reporter: Dave Blackburn <blackburn>
Component: yumAssignee: Seth Vidal <skvidal>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 8CC: blackburn, ffesti, james.antill, katzj, pmatilai, tim.lauridsen
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 3.2.19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-10-27 16:05:22 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dave Blackburn 2008-09-13 04:24:34 UTC
Description of problem:

After updating yum packages
  yum update yum\*
All these fail with a stack trace and the error:
  yum check-update
  yum --help
  yum list yum\*

optparse.OptionConflictError: option --skip-broken: conflicting option string(s): --skip-broken

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

yum -C list yum\*
...
Installed Packages
yum.noarch                               3.2.19-3.fc8           installed       
yum-aliases.noarch                       1.1.15-1.fc8           installed       
yum-allowdowngrade.noarch                1.1.15-1.fc8           installed       
yum-downloadonly.noarch                  1.1.15-1.fc8           installed       
yum-fastestmirror.noarch                 1.1.15-1.fc8           installed       
yum-fedorakmod.noarch                    1.1.15-1.fc8           installed       
yum-kernel-module.noarch                 1.1.15-1.fc8           installed       
yum-list-data.noarch                     1.1.15-1.fc8           installed       
yum-merge-conf.noarch                    1.1.15-1.fc8           installed       
yum-metadata-parser.i386                 1.1.2-1.fc8            installed       
yum-presto.noarch                        0.4.5-1.fc8            installed       
yum-priorities.noarch                    1.1.15-1.fc8           installed       
yum-protect-packages.noarch              1.1.15-1.fc8           installed       
yum-protectbase.noarch                   1.1.15-1.fc8           installed       
yum-refresh-updatesd.noarch              1.1.15-1.fc8           installed       
yum-security.noarch                      1.1.15-1.fc8           installed       
yum-skip-broken.noarch                   1.1.15-1.fc8           installed       
yum-tsflags.noarch                       1.1.15-1.fc8           installed       
yum-updatesd.noarch                      1:0.9-1.fc8            installed       
yum-utils.noarch                         1.1.15-1.fc8           installed       


How reproducible:
  yum --help
or other yum commands

Steps to Reproduce:
1. yum --help
  
Actual results:

  File "/usr/bin/yum", line 29, in <module>
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/yummain.py", line 229, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 84, in main
    base.getOptionsConfig(args)
  File "/usr/share/yum-cli/cli.py", line 184, in getOptionsConfig
    enabled_plugins=self.optparser._splitArg(opts.enableplugins))
  File "/usr/lib/python2.5/site-packages/yum/__init__.py", line 189, in _getConfig
    startupconf.pluginconfpath,disabled_plugins,enabled_plugins)
  File "/usr/lib/python2.5/site-packages/yum/__init__.py", line 355, in doPluginSetup
    plugin_types, confpath, disabled_plugins, enabled_plugins)
  File "/usr/lib/python2.5/site-packages/yum/plugins.py", line 160, in __init__
    self.run('config')
  File "/usr/lib/python2.5/site-packages/yum/plugins.py", line 176, in run
    func(conduitcls(self, self.base, conf, **kwargs))
  File "/usr/lib/yum-plugins/skip-broken.py", line 110, in config_hook
    help="skip packages with broken dependencies")    
  File "/usr/lib/python2.5/optparse.py", line 1014, in add_option
    self._check_conflict(option)
  File "/usr/lib/python2.5/optparse.py", line 989, in _check_conflict
    option)
optparse.OptionConflictError: option --skip-broken: conflicting option string(s): --skip-broken

Expected results:

Loaded plugins: aliases, allowdowngrade, downloadonly, fastestmirror,
              : fedorakmod, kernel-module, list-data, presto, priorities,
              : protect-packages, protectbase, security, skip-broken, tsflags
Usage: yum [options] COMMAND
List of Commands
...

Additional info:

This is a quick and dirty workaround.

diff -ub /usr/lib/python2.5/optparse.py{.orig,}
--- /usr/lib/python2.5/optparse.py.orig 2007-10-30 11:54:12.000000000 -0600
+++ /usr/lib/python2.5/optparse.py      2008-09-12 21:01:35.000000000 -0600
@@ -982,12 +982,7 @@
 
         if conflict_opts:
             handler = self.conflict_handler
-            if handler == "error":
-                raise OptionConflictError(
-                    "conflicting option string(s): %s"
-                    % ", ".join([co[0] for co in conflict_opts]),
-                    option)
-            elif handler == "resolve":
+            if handler == "resolve":
                 for (opt, c_option) in conflict_opts:
                     if opt.startswith("--"):
                         c_option._long_opts.remove(opt)

Even this works after the patch!

  yum -C --skip-broken list yum\*

Comment 1 Dave Blackburn 2008-09-13 04:38:07 UTC
I uncovered the following:

grep -A 3 -r 'skip-broken' /usr/share/yum-cli

/usr/share/yum-cli/cli.py:        self.add_option("--skip-broken", action="store_true", dest="skipbroken",
/usr/share/yum-cli/cli.py-                help=_("skip packages with depsolving problems"))

So --skip-broken is being defined in two places apparently.

Here as well as above:
grep -A 3 -r 'skip-broken' /usr/lib/yum-plugins
--
/usr/lib/yum-plugins/skip-broken.py:        parser.add_option("", "--skip-broken", dest="skipbroken",
/usr/lib/yum-plugins/skip-broken.py-                action="store_true", default=False, 
/usr/lib/yum-plugins/skip-broken.py-                help="skip packages with broken dependencies")  

That would explain this conflict since the option is added two places:
conflicting option string(s): --skip-broken

Comment 2 Tim Lauridsen 2008-09-15 16:34:23 UTC
the --skip-broken has been added to the yum, so the yum-skip-broken plugin should not be used any more. so remove it, will solve your issue.

there need to added some obsoletion for the yum-skip-broken in the yum rpm, i thought it was added, but don't look to be the case.

Comment 3 seth vidal 2008-10-27 16:05:22 UTC
it has been added and pushed now, I believe.