1 |
commit: c74972c6b1e30232ab961f0206cdee81b7e4c5f5 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Aug 23 22:29:35 2012 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Aug 23 22:29:35 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c74972c6 |
7 |
|
8 |
prepstrip: avoid debugedit/strip interference |
9 |
|
10 |
This will fix bug #421099. |
11 |
|
12 |
--- |
13 |
bin/ebuild-helpers/prepstrip | 30 ++++++++++++++++-------------- |
14 |
1 files changed, 16 insertions(+), 14 deletions(-) |
15 |
|
16 |
diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip |
17 |
index bbcfac2..5f87482 100755 |
18 |
--- a/bin/ebuild-helpers/prepstrip |
19 |
+++ b/bin/ebuild-helpers/prepstrip |
20 |
@@ -160,23 +160,24 @@ process_elf() { |
21 |
local x=$1 strip_flags=${*:2} |
22 |
|
23 |
vecho " ${x:${#ED}}" |
24 |
+ |
25 |
+ # If two processes try to debugedit or strip the same hardlink at the |
26 |
+ # same time, it may corrupt files or cause loss of splitdebug info. |
27 |
+ # So, use a lockfile to prevent interference (easily observed with |
28 |
+ # dev-vcs/git which creates ~111 hardlinks to one file in |
29 |
+ # /usr/libexec/git-core). |
30 |
+ local lockfile=$(inode_file_link "${x}")_lockfile |
31 |
+ if ! ln "${x}" "${lockfile}" 2>/dev/null ; then |
32 |
+ while [[ -f ${lockfile} ]] ; do |
33 |
+ sleep 1 |
34 |
+ done |
35 |
+ unset lockfile |
36 |
+ fi |
37 |
+ |
38 |
save_elf_sources "${x}" |
39 |
|
40 |
if ${strip_this} ; then |
41 |
|
42 |
- # If two processes try to strip the same hardlink at the same |
43 |
- # time, it will cause one of them to lose the splitdebug info. |
44 |
- # So, use a lockfile to prevent interference (easily observed |
45 |
- # with dev-vcs/git which creates ~109 hardlinks to one file in |
46 |
- # /usr/libexec/git-core). |
47 |
- local lockfile=$(inode_file_link "${x}")_lockfile |
48 |
- if ! ln "${x}" "${lockfile}" ; then |
49 |
- while [[ -f ${lockfile} ]] ; do |
50 |
- sleep 1 |
51 |
- done |
52 |
- unset lockfile |
53 |
- fi |
54 |
- |
55 |
# see if we can split & strip at the same time |
56 |
if [[ -n ${SPLIT_STRIP_FLAGS} ]] ; then |
57 |
local shortname="${x##*/}.debug" |
58 |
@@ -190,8 +191,9 @@ process_elf() { |
59 |
save_elf_debug "${x}" |
60 |
${STRIP} ${strip_flags} "${x}" |
61 |
fi |
62 |
- [[ -n ${lockfile} ]] && rm -f "${lockfile}" |
63 |
fi |
64 |
+ |
65 |
+ [[ -n ${lockfile} ]] && rm -f "${lockfile}" |
66 |
} |
67 |
|
68 |
# The existance of the section .symtab tells us that a binary is stripped. |