Skip to content

package_versions.versions() corrupts Debian/Ubuntu epochs ending in 0 (e.g. 30:0.30-6 -> 30.30-6) #227

Backlog

Description

@trackoor

fetchcode.package_versions.versions() removes every "0:" substring instead of only a leading default "0:" epoch, corrupting Debian and Ubuntu package versions whose epoch ends in 0 (such as intercal 30:0.30-6).

$ python3 -c 'from fetchcode.package_versions import versions; print([v.value for v in versions("pkg:deb/debian/intercal")])'
['30.30-6', '30.30-2', '30.30-1', '29:0.29-3', '29:0.29-2', '28:0.28-4', '0.24-3', '0.20-9', '0.20-4', '0.16-1']

Expected ['30:0.30-6', '30:0.30-2', '30:0.30-1', '29:0.29-3', '29:0.29-2', '28:0.28-4', '0.24-3', '0.20-9', '0.20-4', '0.16-1'] (and '30:0.30-6' rather than '30.30-6' for versions("pkg:deb/ubuntu/intercal")). Stripping 0: turns epoch-30 releases into non-existent epoch-0 versions that no longer match the archive and sort older than 28:0.28-4 under Debian Policy 5.6.12.

Tested with fetchcode 0.8.5 and master (ffbd683), Python 3.11.2 on Linux 6.1.0 (x86_64).

remove_debian_default_epoch() in src/fetchcode/package_versions.py (line 551) calls version.replace("0:", "") across the whole string instead of version.removeprefix("0:").

Credit: https://ucsbplse.github.io/

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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