From d4feb6e617c5ff9b70f2137127a8edfd1ea0d990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 18 Sep 2024 05:07:38 +0200 Subject: [PATCH 1/4] Backport patch fixing Python 3.13 compat Fixes QubesOS/qubes-issues#9453 --- ...ompatibility-regarding-urllib.parse-.patch | 49 +++++++++++++++++++ salt.spec.in | 1 + 2 files changed, 50 insertions(+) create mode 100644 0001-Fix-Python3.13-compatibility-regarding-urllib.parse-.patch diff --git a/0001-Fix-Python3.13-compatibility-regarding-urllib.parse-.patch b/0001-Fix-Python3.13-compatibility-regarding-urllib.parse-.patch new file mode 100644 index 0000000..de65fc0 --- /dev/null +++ b/0001-Fix-Python3.13-compatibility-regarding-urllib.parse-.patch @@ -0,0 +1,49 @@ +From 187f1f6f3bf6e5f8da4f7029368ddd0967711ba9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= + +Date: Wed, 18 Sep 2024 04:54:24 +0200 +Subject: [PATCH] Fix Python3.13 compatibility regarding urllib.parse module + +Python 3.13 fixed handling relative paths in urllib.parse module. +Specifically, relative file URL is now constructed as file:path instead +of converting it to absolute file:///path. This breaks +salt.utils.url.create which expects file:/// specifically. The mismatch +results in for example changing salt://top.sls into salt://.sls and thus +not finding the top file. + +Fix this by handling both prefixes. + +Relevant python change: https://github.com/python/cpython/issues/85110 +Fixes: #66898 +--- + changelog/66898.fixed.md | 1 + + salt/utils/url.py | 5 ++++- + 2 files changed, 5 insertions(+), 1 deletion(-) + create mode 100644 changelog/66898.fixed.md + +diff --git a/changelog/66898.fixed.md b/changelog/66898.fixed.md +new file mode 100644 +index 0000000000..2549d5e00e +--- /dev/null ++++ b/changelog/66898.fixed.md +@@ -0,0 +1 @@ ++Fixed Python 3.13 compatibility regarding urllib.parse module +diff --git a/salt/utils/url.py b/salt/utils/url.py +index 478d8e911c..6d7ea37e6d 100644 +--- a/salt/utils/url.py ++++ b/salt/utils/url.py +@@ -47,7 +47,10 @@ def create(path, saltenv=None): + + query = f"saltenv={saltenv}" if saltenv else "" + url = salt.utils.data.decode(urlunparse(("file", "", path, "", query, ""))) +- return "salt://{}".format(url[len("file:///") :]) ++ # urlunparse changed behavior in Python 3.13 ++ if url.startswith("file:///"): ++ return "salt://{}".format(url[len("file:///") :]) ++ return "salt://{}".format(url[len("file:") :]) + + + def is_escaped(url): +-- +2.46.0 + diff --git a/salt.spec.in b/salt.spec.in index 43dff94..3ce5eb7 100644 --- a/salt.spec.in +++ b/salt.spec.in @@ -44,6 +44,7 @@ Patch1: match_hostname.patch Patch2: 0002-Hide-known-DeprecationWarning-related-to-PEP-594.patch Patch3: 0001-Drop-versioned-certifi-dependency.patch Patch4: 0001-Use-timezone-aware-datetime-objects-for-UTC-too.patch +Patch5: 0001-Fix-Python3.13-compatibility-regarding-urllib.parse-.patch BuildArch: noarch %ifarch %{ix86} x86_64 From 517ac0fc7e93d883ae689eec471863a88140b0a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 18 Sep 2024 18:43:08 +0200 Subject: [PATCH 2/4] Include patched salt in VM too The issue affects Python 3.12.6 too. --- .qubesbuilder | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.qubesbuilder b/.qubesbuilder index 7f6c7e0..32c19b7 100644 --- a/.qubesbuilder +++ b/.qubesbuilder @@ -14,6 +14,18 @@ vm-fc38: rpm: build: - salt.spec +vm-fc39: + rpm: + build: + - salt.spec +vm-fc40: + rpm: + build: + - salt.spec +vm-fc41: + rpm: + build: + - salt.spec vm-bookworm: deb: build: From e2df3a52317308c43a2c641dacb24e8067230cb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 18 Sep 2024 23:42:07 +0200 Subject: [PATCH 3/4] Relax 'requests' dependency Let it pick the version from the distribution. Note the versioned dependency in salt was due to https://github.com/psf/requests/security/advisories/GHSA-9wx4-h78v-vm56, so it's not great, but doesn't affect our use case (the verify= option with possibly non-true value is used when talking to S3, which we don't use). In any case, let the update be handled by the distribution. --- 0001-Drop-versioned-certifi-dependency.patch | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/0001-Drop-versioned-certifi-dependency.patch b/0001-Drop-versioned-certifi-dependency.patch index 6d8bca8..53cd0dc 100644 --- a/0001-Drop-versioned-certifi-dependency.patch +++ b/0001-Drop-versioned-certifi-dependency.patch @@ -5,6 +5,7 @@ Date: Thu, 15 Aug 2024 03:46:12 +0200 Subject: [PATCH] Drop versioned certifi dependency Let it pick the version from the distribution. +Similarly for requests. --- requirements/base.txt | 2 -- 1 file changed, 2 deletions(-) @@ -13,10 +14,13 @@ diff --git a/requirements/base.txt b/requirements/base.txt index de9cbaab17..bce14bc510 100644 --- a/requirements/base.txt +++ b/requirements/base.txt -@@ -7,8 +7,6 @@ PyYAML +@@ -7,10 +7,7 @@ PyYAML + msgpack>=1.0.0 + PyYAML MarkupSafe - requests<2.32.0 ; python_version < '3.10' - requests>=2.32.3 ; python_version >= '3.10' +-requests<2.32.0 ; python_version < '3.10' +-requests>=2.32.3 ; python_version >= '3.10' ++requests -certifi==2023.07.22; python_version < '3.10' -certifi>=2024.7.4; python_version >= '3.10' distro>=1.0.1 From 0117323e86bc1a264a5c28bc4ffa6eaa53d31ad1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 19 Sep 2024 13:21:04 +0200 Subject: [PATCH 4/4] ci: test installing in R4.2 dom0 too Since the fix for https://github.com/QubesOS/qubes-issues/issues/9453 is relevant for R4.2 VMs too, test if it's installable in R4.2. VMs jobs are more or less the same as in R4.3, but dom0 isn't so add that. --- .gitlab-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 89acaae..523253c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,3 +5,7 @@ include: project: QubesOS/qubes-continuous-integration - file: /r4.3/gitlab-vm.yml project: QubesOS/qubes-continuous-integration +- file: /r4.2/gitlab-base.yml + project: QubesOS/qubes-continuous-integration +- file: /r4.2/gitlab-host.yml + project: QubesOS/qubes-continuous-integration