Re: [gentoo-dev] [PATCH v2] verify-sig.eclass: avoid calling unpack on sig files

2024-05-22 Thread Mike Gilbert
On Tue, May 21, 2024 at 11:38 PM Michał Górny  wrote:
>
> On Tue, 2024-05-21 at 22:05 -0400, Mike Gilbert wrote:
> > Signed-off-by: Mike Gilbert 
> > ---
> >  eclass/verify-sig.eclass | 10 +++---
> >  1 file changed, 7 insertions(+), 3 deletions(-)
> >
> > diff --git a/eclass/verify-sig.eclass b/eclass/verify-sig.eclass
> > index b74ed78290aa..4d48c9ed8503 100644
> > --- a/eclass/verify-sig.eclass
> > +++ b/eclass/verify-sig.eclass
> > @@ -426,10 +426,14 @@ verify-sig_src_unpack() {
> >   verify-sig_verify_detached \
> >   "${DISTDIR}/${f%.*}" "${DISTDIR}/${f}"
> >   done
> > - fi
> >
> > - # finally, unpack the distfiles
> > - default_src_unpack
> > + # finally, unpack the distfiles
> > + if [[ ${#distfiles[@]} -gt 0 ]]; then
> > + unpack "${distfiles[@]}"
> > + fi
> > + else
> > + default_src_unpack
> > + fi
> >  }
> >
> >  fi
>
> Please make a pull request or send a patch with more context.
> As submitted, this patch is completely unreadable.

Sure, I updated the commit message per ulm's comments, and opened a PR.

https://github.com/gentoo/gentoo/pull/36776



Re: [gentoo-dev] [PATCH v2] verify-sig.eclass: avoid calling unpack on sig files

2024-05-22 Thread Mike Gilbert
On Wed, May 22, 2024 at 1:53 AM Ulrich Mueller  wrote:
> Please provide an explanation what problem this patch fixes.
>
> Why is calling unpack on sig files bad? It should silently skip files
> with unknown extensions.

The main reason is that Portage does not *silently* skip unknown
extensions in unpack. For  example:

>>> Unpacking freerdp-2.11.7.tar.gz.asc to 
>>> /x/portage/net-misc/freerdp-2.11.7/work
unpack freerdp-2.11.7.tar.gz.asc: file format not recognized. Ignoring.

The other reason would be the small/trivial efficiency gain; there is
no point in calling unpack on a file it won't be able to process.