[issue245] smart does not handle index out of range errors

Joseph Wang at Labix Tracker tracker at labix.org
Sun Nov 12 10:32:12 PST 2006


New submission from Joseph Wang <joe at gnacademy.org>:

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:]

----------
messages: 919
nosy: twofish
priority: bug
project: smart
status: unread
title: smart does not handle index out of range errors

_______________________________________
Labix issue tracker <tracker at labix.org>
<http://tracker.labix.org/issue245>
_______________________________________


More information about the smart mailing list