smart does not handle index out of range errors

Bug #244488 reported by Rehan Khan
2
Affects Status Importance Assigned to Milestone
Smart Package Manager
New
Undecided
Unassigned

Bug Description

Imported: http://tracker.labix.org/issue245

Reason: Patch Review

further details: https://blueprints.launchpad.net/smart/+spec/bug-reporting-migration

msg930 (view) Author: dfarning Date: 2006-11-15.20:32:52

twofish,
I have turned your fix into a patch. Can you verify that the patch works for
you against trunk.

Dave

msg919 (view) Author: twofish Date: 2006-11-12.18:32:11

smart fails when I run it against my repository

Traceback (most recent call last):##################################### ( 99%)
  File "/usr/bin/smart", line 194, in ?
    main(sys.argv[1:])
  File "/usr/bin/smart", line 167, in main
    exitcode = iface.run(opts.command, opts.argv)
  File "/usr/lib/python2.4/site-packages/smart/interface.py", line 53, in run
    result = _command.main(self._ctrl, opts)
  File "/usr/lib/python2.4/site-packages/smart/commands/upgrade.py", line 97, in
main
    ctrl.reloadChannels()
  File "/usr/lib/python2.4/site-packages/smart/control.py", line 375, in
reloadChannels
    self._cache.load()
  File "/usr/lib/python2.4/site-packages/smart/backends/rpm/header.py", line
191, in load
    def load(self):
  File "/usr/lib/python2.4/site-packages/smart/backends/rpm/header.py", line
293, in load
    vi = v[i] or None
IndexError: list index out of range

I've fixed this by adding a cache for IndexError

                for i in range(len(n)):
                    try:
                        vi = v[i] or None
                    except TypeError:
                        vi = None
                        pass
                    except IndexError:
                        vi = None
                        continue
                    if vi and vi[:2] == "0:":
                        vi = vi[2:]

Revision history for this message
Rehan Khan (rasker) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.