Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index out of range #22

Open
christianmlong opened this issue Jan 16, 2018 · 1 comment
Open

Index out of range #22

christianmlong opened this issue Jan 16, 2018 · 1 comment

Comments

@christianmlong
Copy link

I'm getting an error on this test

from version_utils import rpm
def test_compare_evr_trailing_chars():
    """
    Test a fix I applied to the evr function.
    """
    evr_a = [u'0', u'2.02.98', u'9.el6_4.2']
    evr_b = [u'0', u'2.02.98', u'9.el6.']
    assert rpm.compare_evrs(evr_a, evr_b) == rpm.a_newer
        while len(chars_a) != 0 and len(chars_b) != 0:
            logger.debug('starting loop comparing %s '
                         'to %s', chars_a, chars_b)
            _check_leading(chars_a, chars_b)
            if chars_a[0] == '~' and chars_b[0] == '~':
                map(lambda x: x.pop(0), (chars_a, chars_b))
            elif chars_a[0] == '~':
                return b_newer
>           elif chars_b[0] == '~':
E           IndexError: list index out of range

../../../../.virtualenvs/ciam/lib/python2.7/site-packages/version_utils/rpm.py:173: IndexError

I think the problem is in compare_versions on line #168. _check_leading modifies a list in place, making the list empty.

I think a fix might be to add another length check at line 169, right after the call to _check_leading.

@mplanchard
Copy link
Contributor

Hey there. Sorry I missed the notifications on this issue. I moved on from Ihiji in January, and I had all Ihiji repos set up to go to to my old work e-mail.

Thanks for the report, and especially for the PR! It looks like this repo isn't being actively maintained anymore, and I no longer have push permissions, so we may want to move work to my fork

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants