Re: [PATCH] bin/estrip: avoid copying directories in FEATURES=installsources

Sergei Trofimovich <[email protected]> Sun, 18 Jul 2021 16:41:45 +0100
Newsgroups gmane.linux.gentoo.portage.devel
Message-ID <20210718164145.68da7d49@zn3>
On Sat, 17 Jul 2021 15:34:12 -0700
Zac Medico <[email protected]> wrote:

> On 7/17/21 12:59 PM, Sergei Trofimovich wrote:
> > Initially problem is noticed on gcc-11 as a full ${WORKDIR} syncing
> > into /usr/src/debug. It happens because `debug.sources` sometimes
> > contains directory. For example on bash-5 it has:
> > 
> >     $ grep -zv '/<[^/>]*>$' debug.sources | LANG=C sort -z -u  | sed -e 's/\x00/\n/g'
> >     bash-5.0/
> >     bash-5.0/alias.c
> >     ...
> > 
> > This causes syncing object files, config.log, final binaries
> > and other unexpected data. The change avoids syncking paths
> > that end with '/'.
> > 
> > Signed-off-by: Sergei Trofimovich <[email protected]>
> > ---
> >  bin/estrip | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/bin/estrip b/bin/estrip
> > index 7ef1ec35c..6cca0d04b 100755
> > --- a/bin/estrip
> > +++ b/bin/estrip
> > @@ -464,7 +464,10 @@ if [[ -s ${tmpdir}/debug.sources ]] && \
> >  then
> >  	__vecho "installsources: rsyncing source files"
> >  	[[ -d ${D%/}/${prepstrip_sources_dir#/} ]] || mkdir -p "${D%/}/${prepstrip_sources_dir#/}"
> > +	# skip installation of ".../<foo>" (system headers? why inner slashes are forbidden?)
> > +	# skip syncing of ".../foo/" (complete directories)
> >  	grep -zv '/<[^/>]*>$' "${tmpdir}"/debug.sources | \
> > +	grep -zv '/$' | \
> >  		(cd "${WORKDIR}"; LANG=C sort -z -u | \
> >  		rsync -tL0 --chmod=ugo-st,a+r,go-w,Da+x,Fa-x --files-from=- "${WORKDIR}/" "${D%/}/${prepstrip_sources_dir#/}/" )
> >  
> >   
> 
> Looks good. Merged with both grep calls combined via grep -e. Thanks!
> 
> https://gitweb.gentoo.org/proj/portage.git/commit/?id=e083c8bf20d8488d329e3dccd643c28429e6fe30

TIL 'grep -e'! Thank you!

-- 

  Sergei
signature.asc (application/pgp-signature, 981 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQKTBAEBCgB9FiEE+g11JqJ4cL44QkmN7V5F4G8qwpMFAmD0S7lfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEZB
MEQ3NTI2QTI3ODcwQkUzODQyNDk4REVENUU0NUUwNkYyQUMyOTMACgkQ7V5F4G8q
wpMglQ//bmyILX5CX3CuDwu9HrAf5RmT+8LpVKSLeizbIl4MpzbsmibnM0SytNRP
wnhBQQGzM2Fyb4fcSWSTPJOWN8jyehTuoTOeT2aldFZLn3CfObFGuYc9k98fCjMK
HphkENjdRpnMLfKxZbDgz/gkFssmIUq39iBkYwi7x9ZhTBZHmlj9+AnF+pgn5sEf
bl6xK+JX21ApZT1ObOshpPiEtN/JwdoN/M/uy05X0KLOnXOozAVS4i79gJujZWg1
HGJ3BKRozTK1MPPg86VCrP9tFsIY69R6Obj8lHPayySISbDRWR40BLjqF4TmUi5r
YIX3I3sH7rqDdpNRX9o8t9s7rZxPIq8W2S9cF06QM0xS7gX1zKqrtJ65EMeWOz/r
grYgiEDIWudLEN0bhg51WMEkDnPms3pnNXzRZeWyQa97RFWkMYEFokyZ4Vz1+ZfB
VooP5/zJA0hwQK8yukikehbDRI16Au1umbCElHhSItR6YNZuAJhlhOZeChSiNtHy
zhi35MBxogtRPAt2tOfV43C/38rKYBXddRGjvCFhoSsLkeClz9qX7RF6nyCayg3f
ZnOxzsC6TVULHUbMvH1G3Jw32fOo0kE8x5YD31xkEFV89hZgvx97IX3ot5Ltzpww
ntKuFOaRLxp3Y5P+csahYikHKgwq+IJjSTpyoLySzUNsLBhiXA8=
=Be1Z
-----END PGP SIGNATURE-----