--- /dev/null
+From efaa883cbf89e1db6695b6cc0119eeea62256abd Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
+Date: Mon, 24 Jul 2023 10:57:49 +0200
+Subject: [PATCH] Fix string escaping in location tool
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Python 3.12 started to warn on an invalid string escape sequence:
+
+$ location list-networks-by-as --format ipset 1
+/usr/bin/location:583: SyntaxWarning: invalid escape sequence '\d'
+ m = re.match("^AS(\d+)$", object)
+IpsetOutputWriter requires family being set
+
+This patch fixes the warning as well as the regular expression by
+using a raw string.
+
+<https://docs.python.org/3.12/whatsnew/changelog.html#id77>
+
+Signed-off-by: Petr Písař <ppisar@redhat.com>
+---
+ src/scripts/location.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/scripts/location.in b/src/scripts/location.in
+index 60b11d6..b34cc91 100644
+--- a/src/scripts/location.in
++++ b/src/scripts/location.in
+@@ -580,7 +580,7 @@ class CLI(object):
+ families = [ socket.AF_INET6, socket.AF_INET ]
+
+ for object in ns.objects:
+- m = re.match("^AS(\d+)$", object)
++ m = re.match(r"^AS(\d+)$", object)
+ if m:
+ object = int(m.group(1))
+
+--
+2.41.0
+
# 2/2 Fix "location list-networks-by-as --format ipset" output,
# in upstream after 0.9.16, upstream bug #12897
Patch1: libloc-0.9.16-export-Raise-an-error-when-trying-to-export-ipset-fo.patch
+# Fix string escaping with Python 3.12, proposed to the upstream,
+# upstream bug #13188
+Patch2: libloc-0.9.16-Fix-string-escaping-in-location-tool.patch
BuildRequires: asciidoc
BuildRequires: autoconf >= 2.60
# autoconf-archive for unbundled m4/ax_prog_perl_modules.m4
* Mon Jul 24 2023 Petr Pisar <ppisar@redhat.com> - 0.9.16-2
- Fix "location list-networks-by-as --format ipset" output
(upstream bug #12897)
+- Fix string escaping with Python 3.12 (upstream bug #13188)
* Mon Oct 31 2022 Petr Pisar <ppisar@redhat.com> - 0.9.16-1
- 0.9.16 bump