[elbe-devel] [PATCH v2 2/2] dump: only compare /usr-unprefixed file names

Kurt Kanzenbach kurt.kanzenbach at linutronix.de
Tue Feb 21 12:30:35 CET 2023


On Tue Feb 21 2023, Bastian Germann wrote:
> Collect the apt package index without the /usr prefix.
> Unprefix the comparisons against it as well.
>
> This will result in falsely claimed "postinst generated" files being mapped
> to their package, which potentially populates the target package list with
> more packages on stripped-down (diet, tighten) systems.
>
> Signed-off-by: Bastian Germann <bage at linutronix.de>

Any bug reference available? 

> ---
>  elbepack/dump.py | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/elbepack/dump.py b/elbepack/dump.py
> index 6d889bd566..758c7a1baa 100644
> --- a/elbepack/dump.py
> +++ b/elbepack/dump.py
> @@ -221,7 +221,7 @@ def elbe_report(xml, buildenv, cache, targetfs):
>      for p in instpkgs:
>          report.info("|%s|%s|%s", p.name, p.installed_version, p.origin)
>  
> -    index = cache.get_fileindex()
> +    index = cache.get_fileindex(removeprefix='/usr')
>      mt_index = targetfs.mtime_snap()
>  
>      if xml.has("archive") and not xml.text("archive") is None:
> @@ -247,8 +247,9 @@ def elbe_report(xml, buildenv, cache, targetfs):
>      tgt_pkg_list = set()
>  
>      for fpath, _ in targetfs.walk_files():
> -        if fpath in index:
> -            pkg = index[fpath]
> +        unprefixed = fpath[4:] if fpath.startswith('/usr') else fpath

fpath[len('/usr'):] maybe?

Not sure whether it is important, some strings use single quotes and
some double quotes in this file.

Thanks,
Kurt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 873 bytes
Desc: not available
URL: <http://lists.linutronix.de/pipermail/elbe-devel/attachments/20230221/2cd28d14/attachment.sig>


More information about the elbe-devel mailing list