René's URL Explorer Experiment


Title: Incorrect debian version comparisons with tilde · Issue #3 · memory/python-dpkg · GitHub

Open Graph Title: Incorrect debian version comparisons with tilde · Issue #3 · memory/python-dpkg

X Title: Incorrect debian version comparisons with tilde · Issue #3 · memory/python-dpkg

Description: The tilde in debian versions sorts before anything else, meaning version 1.2.3-1~deb7u1 is less than 1.2.3-1. python-dpkg does not properly sort these versions. The check here triggers an IndexError: python-dpkg/pydpkg/__init__.py Line 4...

Open Graph Description: The tilde in debian versions sorts before anything else, meaning version 1.2.3-1~deb7u1 is less than 1.2.3-1. python-dpkg does not properly sort these versions. The check here triggers an IndexErro...

X Description: The tilde in debian versions sorts before anything else, meaning version 1.2.3-1~deb7u1 is less than 1.2.3-1. python-dpkg does not properly sort these versions. The check here triggers an IndexErro...

Opengraph URL: https://github.com/memory/python-dpkg/issues/3

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Incorrect debian version comparisons with tilde","articleBody":"The tilde in debian versions sorts before anything else, meaning version 1.2.3-1~deb7u1 is less than 1.2.3-1. python-dpkg does not properly sort these versions.\r\n\r\nThe check here triggers an IndexError:\r\nhttps://github.com/memory/python-dpkg/blob/dc88cfbbd0f052a6808f339486bf9b7e991c137c/pydpkg/__init__.py#L497\r\n\r\nThis index error is caught here:\r\nhttps://github.com/memory/python-dpkg/blob/dc88cfbbd0f052a6808f339486bf9b7e991c137c/pydpkg/__init__.py#L513-L515\r\n\r\nThe assumption that since rev1 is longer than rev2 it is greater is not correct because of the tilde.\r\n\r\nBelow are some tests that can be added to `test_dpkg.py` to catch this error. I've also added a few other tests for completeness and to catch some other edge cases.\r\n\r\n```diff\r\ndiff --git a/tests/test_dpkg.py b/tests/test_dpkg.py\r\nindex 2bec9b7..8dd1564 100644\r\n--- a/tests/test_dpkg.py\r\n+++ b/tests/test_dpkg.py\r\n@@ -187,6 +187,9 @@ class DpkgVersionsTest(unittest.TestCase):\r\n         self.assertEqual(Dpkg.compare_versions('0.0.9', '0.0.10'), -1)\r\n         self.assertEqual(Dpkg.compare_versions('0.9.0', '0.10.0'), -1)\r\n         self.assertEqual(Dpkg.compare_versions('9.0.0', '10.0.0'), -1)\r\n+        self.assertEqual(Dpkg.compare_versions('1.2.3-1~deb7u1', '1.2.3-1'), -1)\r\n+        self.assertEqual(Dpkg.compare_versions('2.7.4+reloaded2-13ubuntu1', '2.7.4+reloaded2-13+deb9u1'), -1)\r\n+        self.assertEqual(Dpkg.compare_versions('2.7.4+reloaded2-13', '2.7.4+reloaded2-13+deb9u1'), -1)\r\n \r\n         # greater than\r\n         self.assertEqual(Dpkg.compare_versions('0.0.1-0', '0:0.0.0'), 1)\r\n@@ -195,6 +198,9 @@ class DpkgVersionsTest(unittest.TestCase):\r\n         self.assertEqual(Dpkg.compare_versions('0.0.9', '0.0.1'), 1)\r\n         self.assertEqual(Dpkg.compare_versions('0.9.0', '0.1.0'), 1)\r\n         self.assertEqual(Dpkg.compare_versions('9.0.0', '1.0.0'), 1)\r\n+        self.assertEqual(Dpkg.compare_versions('1.2.3-1', '1.2.3-1~deb7u1'), 1)\r\n+        self.assertEqual(Dpkg.compare_versions('2.7.4+reloaded2-13+deb9u1', '2.7.4+reloaded2-13ubuntu1'), 1)\r\n+        self.assertEqual(Dpkg.compare_versions('2.7.4+reloaded2-13+deb9u1', '2.7.4+reloaded2-13'), 1)\r\n \r\n         # unicode me harder\r\n         self.assertEqual(Dpkg.compare_versions(u'2:0.0.44-1', u'2:0.0.44-nobin'), -1)\r\n```\r\n\r\nI haven't had the time to try and come up with a solution, but, as a reference, here's another pure-python implementation of version comparison: https://git.launchpad.net/review-tools/tree/reviewtools/debversion.py","author":{"url":"https://github.com/mssalvatore","@type":"Person","name":"mssalvatore"},"datePublished":"2020-11-20T13:12:14Z","url":"https://github.com/memory/python-dpkg/issues/3"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:32cc7c18-1957-addd-392d-8a3b11a961a6
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9CFC:2E5652:2849B7D:334AE8A:6B019FD6
html-safe-nonced63fd9ce60d3a6887698e4d2c70edae13befcdbe4609c5f72fb468abc79a1f82
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Q0ZDOjJFNTY1MjoyODQ5QjdEOjMzNEFFOEE6NkIwMTlGRDYiLCJ2aXNpdG9yX2lkIjoiNjAyNzg3MjMyMTI0MTQ1NjU5OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacf6a8d81915a93232f6d65c7736f11257e6c8026a97b8b244ae3ec87f35e28968
hovercard-subject-tagissue:747480399
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/memory/python-dpkg/3/issue_layout
twitter:imagehttps://opengraph.githubassets.com/ef3691b4cea1b84e7c3752e9da9ef50da0b0037298b959a8fc21b5f519649d4e/memory/python-dpkg/issues/3
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/ef3691b4cea1b84e7c3752e9da9ef50da0b0037298b959a8fc21b5f519649d4e/memory/python-dpkg/issues/3
og:image:altThe tilde in debian versions sorts before anything else, meaning version 1.2.3-1~deb7u1 is less than 1.2.3-1. python-dpkg does not properly sort these versions. The check here triggers an IndexErro...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemssalvatore
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/memory/python-dpkg git https://github.com/memory/python-dpkg.git
octolytics-dimension-user_id394064
octolytics-dimension-user_loginmemory
octolytics-dimension-repository_id120547428
octolytics-dimension-repository_nwomemory/python-dpkg
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id120547428
octolytics-dimension-repository_network_root_nwomemory/python-dpkg
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/memory/python-dpkg/issues/3#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmemory%2Fpython-dpkg%2Fissues%2F3
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmemory%2Fpython-dpkg%2Fissues%2F3
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=memory%2Fpython-dpkg
Reloadhttps://github.com/memory/python-dpkg/issues/3
Reloadhttps://github.com/memory/python-dpkg/issues/3
Reloadhttps://github.com/memory/python-dpkg/issues/3
memoryhttps://github.com/memory
python-dpkghttps://github.com/memory/python-dpkg
Codehttps://github.com/memory/python-dpkg
Issueshttps://github.com/memory/python-dpkg/issues
Pull requestshttps://github.com/memory/python-dpkg/pulls
Actionshttps://github.com/memory/python-dpkg/actions
Projectshttps://github.com/memory/python-dpkg/projects
Wikihttps://github.com/memory/python-dpkg/wiki
Security and qualityhttps://github.com/memory/python-dpkg/security
Insightshttps://github.com/memory/python-dpkg/pulse
https://github.com/memory/python-dpkg
New issuehttps://github.com/login?return_to=https://github.com/memory/python-dpkg/issues/3
New issuehttps://github.com/login?return_to=https://github.com/memory/python-dpkg/issues/3
#4https://github.com/memory/python-dpkg/pull/4
Incorrect debian version comparisons with tildehttps://github.com/memory/python-dpkg/issues/3#top
#4https://github.com/memory/python-dpkg/pull/4
https://github.com/mssalvatore
mssalvatorehttps://github.com/mssalvatore
on Nov 20, 2020https://github.com/memory/python-dpkg/issues/3#issue-747480399
python-dpkg/pydpkg/__init__.pyhttps://github.com/memory/python-dpkg/blob/dc88cfbbd0f052a6808f339486bf9b7e991c137c/pydpkg/__init__.py#L497
dc88cfbhttps://github.com/memory/python-dpkg/commit/dc88cfbbd0f052a6808f339486bf9b7e991c137c
python-dpkg/pydpkg/__init__.pyhttps://github.com/memory/python-dpkg/blob/dc88cfbbd0f052a6808f339486bf9b7e991c137c/pydpkg/__init__.py#L513-L515
dc88cfbhttps://github.com/memory/python-dpkg/commit/dc88cfbbd0f052a6808f339486bf9b7e991c137c
https://git.launchpad.net/review-tools/tree/reviewtools/debversion.pyhttps://git.launchpad.net/review-tools/tree/reviewtools/debversion.py
https://github.com/memory
memoryhttps://github.com/memory
on Nov 20, 2020https://github.com/memory/python-dpkg/issues/3#issuecomment-731407741
https://github.com/memory
memoryhttps://github.com/memory
on Nov 20, 2020https://github.com/memory/python-dpkg/issues/3#issuecomment-731434982
n-odenhttps://github.com/n-oden
on Nov 20, 2020https://github.com/memory/python-dpkg/issues/3#event-4023076726
Fix tilde comparisonshttps://github.com/memory/python-dpkg/commit/b2669e84a9010021fabfa137c4c535376730132e
b2669e8https://github.com/memory/python-dpkg/commit/b2669e84a9010021fabfa137c4c535376730132e
https://github.com/memory
memoryhttps://github.com/memory
on Nov 20, 2020https://github.com/memory/python-dpkg/issues/3#issuecomment-731453867
@mssalvatorehttps://github.com/mssalvatore
#4https://github.com/memory/python-dpkg/pull/4
memoryhttps://github.com/memory
completedhttps://github.com/memory/python-dpkg/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#4https://github.com/memory/python-dpkg/pull/4
on Nov 23, 2020https://github.com/memory/python-dpkg/issues/3#event-4028352303
https://github.com/mssalvatore
mssalvatorehttps://github.com/mssalvatore
on Nov 23, 2020https://github.com/memory/python-dpkg/issues/3#issuecomment-732286182
@memoryhttps://github.com/memory
pombredannehttps://github.com/pombredanne
on Mar 24, 2021https://github.com/memory/python-dpkg/issues/3#event-4501084182
Improve comparison of versionshttps://github.com/aboutcode-org/debian-inspector/commit/d12f8aad6b20ebb8b6c80957245694338fe7c3b1
d12f8aahttps://github.com/aboutcode-org/debian-inspector/commit/d12f8aad6b20ebb8b6c80957245694338fe7c3b1
sbs2001https://github.com/sbs2001
on Mar 29, 2021https://github.com/memory/python-dpkg/issues/3#event-4519573645
Improve comparison of versionshttps://github.com/aboutcode-org/univers/commit/e1f58ce0724eb73bcf3c89784d3be9d6876ba2ed
e1f58cehttps://github.com/aboutcode-org/univers/commit/e1f58ce0724eb73bcf3c89784d3be9d6876ba2ed
Sign up for freehttps://github.com/signup?return_to=https://github.com/memory/python-dpkg/issues/3
Sign in to commenthttps://github.com/login?return_to=https://github.com/memory/python-dpkg/issues/3
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.