summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico2012-08-23 22:29:35 (GMT)
committerZac Medico2012-08-23 22:29:35 (GMT)
commitc74972c6b1e30232ab961f0206cdee81b7e4c5f5 (patch)
tree1b3f8bc3abce668f0e19fdf699fda7b2f3cd7162
parent905572230b2f156c10faa619e9e4d76b5540173a (diff)
prepstrip: avoid debugedit/strip interference
This will fix bug #421099.
-rwxr-xr-xbin/ebuild-helpers/prepstrip30
1 files changed, 16 insertions, 14 deletions
diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
index bbcfac2..5f87482 100755
--- a/bin/ebuild-helpers/prepstrip
+++ b/bin/ebuild-helpers/prepstrip
@@ -160,23 +160,24 @@ process_elf() {
local x=$1 strip_flags=${*:2}
vecho " ${x:${#ED}}"
+
+ # If two processes try to debugedit or strip the same hardlink at the
+ # same time, it may corrupt files or cause loss of splitdebug info.
+ # So, use a lockfile to prevent interference (easily observed with
+ # dev-vcs/git which creates ~111 hardlinks to one file in
+ # /usr/libexec/git-core).
+ local lockfile=$(inode_file_link "${x}")_lockfile
+ if ! ln "${x}" "${lockfile}" 2>/dev/null ; then
+ while [[ -f ${lockfile} ]] ; do
+ sleep 1
+ done
+ unset lockfile
+ fi
+
save_elf_sources "${x}"
if ${strip_this} ; then
- # If two processes try to strip the same hardlink at the same
- # time, it will cause one of them to lose the splitdebug info.
- # So, use a lockfile to prevent interference (easily observed
- # with dev-vcs/git which creates ~109 hardlinks to one file in
- # /usr/libexec/git-core).
- local lockfile=$(inode_file_link "${x}")_lockfile
- if ! ln "${x}" "${lockfile}" ; then
- while [[ -f ${lockfile} ]] ; do
- sleep 1
- done
- unset lockfile
- fi
-
# see if we can split & strip at the same time
if [[ -n ${SPLIT_STRIP_FLAGS} ]] ; then
local shortname="${x##*/}.debug"
@@ -190,8 +191,9 @@ process_elf() {
save_elf_debug "${x}"
${STRIP} ${strip_flags} "${x}"
fi
- [[ -n ${lockfile} ]] && rm -f "${lockfile}"
fi
+
+ [[ -n ${lockfile} ]] && rm -f "${lockfile}"
}
# The existance of the section .symtab tells us that a binary is stripped.