Gentoo Archives: gentoo-portage-dev

From: Mike Frysinger <vapier@g.o>
To: gentoo-portage-dev@l.g.o
Subject: [gentoo-portage-dev] [PATCH] econf: update config.{sub,guess} atomically to avoid races
Date: Tue, 17 Dec 2013 23:23:25
Message-Id: 1387322606-3867-1-git-send-email-vapier@gentoo.org
1 URL: https://bugs.gentoo.org/487478
2 ---
3 bin/phase-helpers.sh | 4 +++-
4 1 file changed, 3 insertions(+), 1 deletion(-)
5
6 diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
7 index ec48c94..59c053a 100644
8 --- a/bin/phase-helpers.sh
9 +++ b/bin/phase-helpers.sh
10 @@ -512,7 +512,9 @@ econf() {
11 -name config.guess -o -name config.sub ')' -print0 | \
12 while read -r -d $'\0' x ; do
13 __vecho " * econf: updating ${x/${WORKDIR}\/} with ${EPREFIX}/usr/share/gnuconfig/${x##*/}"
14 - cp -f "${EPREFIX}"/usr/share/gnuconfig/"${x##*/}" "${x}"
15 + # Make sure we do this atomically incase we're run in parallel. #487478
16 + cp -f "${EPREFIX}"/usr/share/gnuconfig/"${x##*/}" "${x}.$$"
17 + mv -f "${x}.$$" "${x}"
18 done
19 fi
20
21 --
22 1.8.4.3

Replies