1 |
Use $BASHPID which will be unique even in subshells. |
2 |
|
3 |
URL: https://bugs.gentoo.org/487478 |
4 |
--- |
5 |
bin/phase-helpers.sh | 17 +++++++++++------ |
6 |
1 file changed, 11 insertions(+), 6 deletions(-) |
7 |
|
8 |
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh |
9 |
index ec48c94..1a7ae03 100644 |
10 |
--- a/bin/phase-helpers.sh |
11 |
+++ b/bin/phase-helpers.sh |
12 |
@@ -469,6 +469,7 @@ unpack() { |
13 |
|
14 |
econf() { |
15 |
local x |
16 |
+ local pid=${BASHPID} |
17 |
|
18 |
if ! ___eapi_has_prefix_variables; then |
19 |
local EPREFIX= |
20 |
@@ -501,18 +502,22 @@ econf() { |
21 |
if [[ -n $CONFIG_SHELL && \ |
22 |
"$(head -n1 "$ECONF_SOURCE/configure")" =~ ^'#!'[[:space:]]*/bin/sh([[:space:]]|$) ]] ; then |
23 |
# preserve timestamp, see bug #440304 |
24 |
- touch -r "$ECONF_SOURCE/configure" "$ECONF_SOURCE/configure._portage_tmp_.$$" || die |
25 |
- sed -e "1s:^#![[:space:]]*/bin/sh:#!$CONFIG_SHELL:" -i "$ECONF_SOURCE/configure" || \ |
26 |
- die "Substition of shebang in '$ECONF_SOURCE/configure' failed" |
27 |
- touch -r "$ECONF_SOURCE/configure._portage_tmp_.$$" "$ECONF_SOURCE/configure" || die |
28 |
- rm -f "$ECONF_SOURCE/configure._portage_tmp_.$$" |
29 |
+ touch -r "${ECONF_SOURCE}/configure" "${ECONF_SOURCE}/configure._portage_tmp_.${pid}" || die |
30 |
+ sed -i \ |
31 |
+ -e "1s:^#![[:space:]]*/bin/sh:#!$CONFIG_SHELL:" \ |
32 |
+ "${ECONF_SOURCE}/configure" \ |
33 |
+ || die "Substition of shebang in '${ECONF_SOURCE}/configure' failed" |
34 |
+ touch -r "${ECONF_SOURCE}/configure._portage_tmp_.${pid}" "${ECONF_SOURCE}/configure" || die |
35 |
+ rm -f "${ECONF_SOURCE}/configure._portage_tmp_.${pid}" |
36 |
fi |
37 |
if [ -e "${EPREFIX}"/usr/share/gnuconfig/ ]; then |
38 |
find "${WORKDIR}" -type f '(' \ |
39 |
-name config.guess -o -name config.sub ')' -print0 | \ |
40 |
while read -r -d $'\0' x ; do |
41 |
__vecho " * econf: updating ${x/${WORKDIR}\/} with ${EPREFIX}/usr/share/gnuconfig/${x##*/}" |
42 |
- cp -f "${EPREFIX}"/usr/share/gnuconfig/"${x##*/}" "${x}" |
43 |
+ # Make sure we do this atomically incase we're run in parallel. #487478 |
44 |
+ cp -f "${EPREFIX}"/usr/share/gnuconfig/"${x##*/}" "${x}.${pid}" |
45 |
+ mv -f "${x}.${pid}" "${x}" |
46 |
done |
47 |
fi |
48 |
|
49 |
-- |
50 |
1.8.4.3 |