Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/
Date: Tue, 21 May 2013 21:38:28
Message-Id: 1369172233.4c5b4a1df363a61ecb0590d64adc12e167903006.zmedico@gentoo
1 commit: 4c5b4a1df363a61ecb0590d64adc12e167903006
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Tue May 21 21:37:13 2013 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Tue May 21 21:37:13 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4c5b4a1d
7
8 ecompressdir: indirect symlinks, bug #470916
9
10 ---
11 bin/ebuild-helpers/ecompressdir | 15 +++++++++++++++
12 1 files changed, 15 insertions(+), 0 deletions(-)
13
14 diff --git a/bin/ebuild-helpers/ecompressdir b/bin/ebuild-helpers/ecompressdir
15 index 40079c0..eca5888 100755
16 --- a/bin/ebuild-helpers/ecompressdir
17 +++ b/bin/ebuild-helpers/ecompressdir
18 @@ -85,6 +85,11 @@ funk_up_dir() {
19 find "${dir}" "${args[@]}" -print0 | ${XARGS} -0 ${binary}
20 ((ret|=$?))
21
22 + # Repeat until nothing changes, in order to handle multiple
23 + # levels of indirection (see bug #470916).
24 + local -i indirection=0
25 + while true ; do
26 + local something_changed=
27 while read -r -d $'\0' brokenlink ; do
28 [[ -e ${brokenlink} ]] && continue
29 olddest=$(readlink "${brokenlink}")
30 @@ -110,12 +115,22 @@ funk_up_dir() {
31 else
32 [[ -f "${dir}/${brokenlink%/*}/${newdest}" ]] || continue
33 fi
34 + something_changed=${brokenlink}
35 rm -f "${brokenlink}"
36 [[ ${act} == "compress" ]] \
37 && ln -snf "${newdest}" "${brokenlink}${suffix}" \
38 || ln -snf "${newdest}" "${brokenlink%${suffix}}"
39 ((ret|=$?))
40 done < <(find "${dir}" -type l -print0)
41 + [[ -n ${something_changed} ]] || break
42 + (( indirection++ ))
43 + if (( indirection >= 100 )) ; then
44 + # Protect against possibility of a bug triggering an endless loop.
45 + eerror "ecompressdir: too many levels of indirection for" \
46 + "'${actual_dir#${ED}}/${something_changed#./}'"
47 + break
48 + fi
49 + done
50 return ${ret}
51 }