[elbe-devel] [PATCH 3/3] dump: do not use regex in full pkglist validation

Torben Hohn torben.hohn at linutronix.de
Wed Mar 10 17:07:39 CET 2021


The fullpkglist validation should not use regex because
there are no regex in the recorded versions.
So an exact match is sufficient.

This fixes problems where versions like '10.3+deb10u8'
do not match themselves, when one of the versions is
interpreted as a regexp.

>>> re.match('10.3+deb10u8', '10.3+deb10u8') is None
True

An escape would be required.

>>> re.match('10.3\+deb10u8', '10.3+deb10u8') is None
False

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
 elbepack/dump.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/elbepack/dump.py b/elbepack/dump.py
index ec5e8fbfb..d2e157e70 100644
--- a/elbepack/dump.py
+++ b/elbepack/dump.py
@@ -144,7 +144,7 @@ def check_full_pkgs(pkgs, fullpkgs, cache):
 
         pkg = cache.get_pkg(name)
 
-        if not re.match(ver, pkg.installed_version):
+        if pkg.installed_version != ver:
             validation.error("Package '%s' version %s does not match installed version %s",
                              name, ver, pkg.installed_version)
             errors += 1
-- 
2.20.1



More information about the elbe-devel mailing list