[elbe-devel] [PATCH 3/3] dump: do not use regex in full pkglist validation
Bastian Germann
bage at linutronix.de
Wed Mar 10 18:06:52 CET 2021
Am 10.03.21 um 17:07 schrieb Torben Hohn:
> 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
Does this affect the use case of the original change?
https://github.com/Linutronix/elbe/issues/276
There are two regex matches introduced with that. You only reverted one
here.
> 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
>
More information about the elbe-devel
mailing list