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 <sly...@gentoo.org>
---
 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#/}/" )
 
-- 
2.32.0


Reply via email to