1 |
LGTM |
2 |
|
3 |
|
4 |
On Tue, Dec 17, 2013 at 4:26 PM, Brian Dolbec <dolsen@g.o> wrote: |
5 |
|
6 |
> On Tue, 2013-12-17 at 18:28 -0500, Mike Frysinger wrote: |
7 |
> > Use $BASHPID which will be unique even in subshells. |
8 |
> > |
9 |
> > URL: https://bugs.gentoo.org/487478 |
10 |
> > --- |
11 |
> > bin/phase-helpers.sh | 17 +++++++++++------ |
12 |
> > 1 file changed, 11 insertions(+), 6 deletions(-) |
13 |
> > |
14 |
> > diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh |
15 |
> > index ec48c94..1a7ae03 100644 |
16 |
> > --- a/bin/phase-helpers.sh |
17 |
> > +++ b/bin/phase-helpers.sh |
18 |
> > @@ -469,6 +469,7 @@ unpack() { |
19 |
> > |
20 |
> > econf() { |
21 |
> > local x |
22 |
> > + local pid=${BASHPID} |
23 |
> > |
24 |
> > if ! ___eapi_has_prefix_variables; then |
25 |
> > local EPREFIX= |
26 |
> > @@ -501,18 +502,22 @@ econf() { |
27 |
> > if [[ -n $CONFIG_SHELL && \ |
28 |
> > "$(head -n1 "$ECONF_SOURCE/configure")" =~ |
29 |
> ^'#!'[[:space:]]*/bin/sh([[:space:]]|$) ]] ; then |
30 |
> > # preserve timestamp, see bug #440304 |
31 |
> > - touch -r "$ECONF_SOURCE/configure" |
32 |
> "$ECONF_SOURCE/configure._portage_tmp_.$$" || die |
33 |
> > - sed -e |
34 |
> "1s:^#![[:space:]]*/bin/sh:#!$CONFIG_SHELL:" -i "$ECONF_SOURCE/configure" |
35 |
> || \ |
36 |
> > - die "Substition of shebang in |
37 |
> '$ECONF_SOURCE/configure' failed" |
38 |
> > - touch -r |
39 |
> "$ECONF_SOURCE/configure._portage_tmp_.$$" "$ECONF_SOURCE/configure" || die |
40 |
> > - rm -f "$ECONF_SOURCE/configure._portage_tmp_.$$" |
41 |
> > + touch -r "${ECONF_SOURCE}/configure" |
42 |
> "${ECONF_SOURCE}/configure._portage_tmp_.${pid}" || die |
43 |
> > + sed -i \ |
44 |
> > + -e |
45 |
> "1s:^#![[:space:]]*/bin/sh:#!$CONFIG_SHELL:" \ |
46 |
> > + "${ECONF_SOURCE}/configure" \ |
47 |
> > + || die "Substition of shebang in |
48 |
> '${ECONF_SOURCE}/configure' failed" |
49 |
> > + touch -r |
50 |
> "${ECONF_SOURCE}/configure._portage_tmp_.${pid}" |
51 |
> "${ECONF_SOURCE}/configure" || die |
52 |
> > + rm -f |
53 |
> "${ECONF_SOURCE}/configure._portage_tmp_.${pid}" |
54 |
> > fi |
55 |
> > if [ -e "${EPREFIX}"/usr/share/gnuconfig/ ]; then |
56 |
> > find "${WORKDIR}" -type f '(' \ |
57 |
> > -name config.guess -o -name config.sub ')' -print0 |
58 |
> | \ |
59 |
> > while read -r -d $'\0' x ; do |
60 |
> > __vecho " * econf: updating |
61 |
> ${x/${WORKDIR}\/} with ${EPREFIX}/usr/share/gnuconfig/${x##*/}" |
62 |
> > - cp -f |
63 |
> "${EPREFIX}"/usr/share/gnuconfig/"${x##*/}" "${x}" |
64 |
> > + # Make sure we do this atomically incase |
65 |
> we're run in parallel. #487478 |
66 |
> > + cp -f |
67 |
> "${EPREFIX}"/usr/share/gnuconfig/"${x##*/}" "${x}.${pid}" |
68 |
> > + mv -f "${x}.${pid}" "${x}" |
69 |
> > done |
70 |
> > fi |
71 |
> > |
72 |
> |
73 |
> |
74 |
> Sorry, my bash skills are not enough to review this stuff. Others will |
75 |
> have to reply :) |
76 |
> -- |
77 |
> Brian Dolbec <dolsen@g.o> |
78 |
> |