Skip to content

Incomplete / incorrect version splitting for REST API endpoint #238

@Kangie

Description

@Kangie

Upstream in the 5.2 branch the API version is defined as 5.2+:

https://github.com/bugzilla/bugzilla/blob/6525e6d90f15fed7d87f591f38f5578ce403dc1b/Bugzilla/Constants.pm#L203

Unfortunately, python-bugzilla expects to split version on the . and retrieve two ints:

Bugzilla version string: 5.2+
version doesn't match expected format X.Y.Z, assuming 5.0
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/bugzilla/base.py", line 447, in _set_bz_version
    major, minor = [int(i) for i in version.split(".")[0:2]]
                    ~~~^^^
ValueError: invalid literal for int() with base 10: '2+'

def _set_bz_version(self, version):
self._cache.version_raw = version
try:
major, minor = [int(i) for i in version.split(".")[0:2]]
except Exception:
log.debug("version doesn't match expected format X.Y.Z, "
"assuming 5.0", exc_info=True)
major = 5
minor = 0
self._cache.version_parsed = (major, minor)

We've dropped the + in the Gentoo Bugzilla in the interim, but clearly the current handling does not reflect the reality of modern Bugzilla. The fallback to 5.0 is "fine", but ideally we would strip the + or something so that we:

  1. get accurate version information
  2. don't display a traceback when we connect to the API

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions