Gentoo Archives: gentoo-portage-dev

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Sergei Trofimovich <slyfox@g.o>
Subject: [gentoo-portage-dev] [PATCH] bin/estrip: avoid copying directories in FEATURES=installsources
Date: Sat, 17 Jul 2021 20:00:40
Message-Id: 20210717195949.2913663-1-slyfox@gentoo.org
1 Initially problem is noticed on gcc-11 as a full ${WORKDIR} syncing
2 into /usr/src/debug. It happens because `debug.sources` sometimes
3 contains directory. For example on bash-5 it has:
4
5 $ grep -zv '/<[^/>]*>$' debug.sources | LANG=C sort -z -u | sed -e 's/\x00/\n/g'
6 bash-5.0/
7 bash-5.0/alias.c
8 ...
9
10 This causes syncing object files, config.log, final binaries
11 and other unexpected data. The change avoids syncking paths
12 that end with '/'.
13
14 Signed-off-by: Sergei Trofimovich <slyfox@g.o>
15 ---
16 bin/estrip | 3 +++
17 1 file changed, 3 insertions(+)
18
19 diff --git a/bin/estrip b/bin/estrip
20 index 7ef1ec35c..6cca0d04b 100755
21 --- a/bin/estrip
22 +++ b/bin/estrip
23 @@ -464,7 +464,10 @@ if [[ -s ${tmpdir}/debug.sources ]] && \
24 then
25 __vecho "installsources: rsyncing source files"
26 [[ -d ${D%/}/${prepstrip_sources_dir#/} ]] || mkdir -p "${D%/}/${prepstrip_sources_dir#/}"
27 + # skip installation of ".../<foo>" (system headers? why inner slashes are forbidden?)
28 + # skip syncing of ".../foo/" (complete directories)
29 grep -zv '/<[^/>]*>$' "${tmpdir}"/debug.sources | \
30 + grep -zv '/$' | \
31 (cd "${WORKDIR}"; LANG=C sort -z -u | \
32 rsync -tL0 --chmod=ugo-st,a+r,go-w,Da+x,Fa-x --files-from=- "${WORKDIR}/" "${D%/}/${prepstrip_sources_dir#/}/" )
33
34 --
35 2.32.0

Replies