From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1017 invoked by alias); 19 Dec 2010 14:37:41 -0000 Received: (qmail 936 invoked by uid 22791); 19 Dec 2010 14:37:40 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-qy0-f176.google.com (HELO mail-qy0-f176.google.com) (209.85.216.176) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 19 Dec 2010 14:37:34 +0000 Received: by qyk10 with SMTP id 10so2045605qyk.0 for ; Sun, 19 Dec 2010 06:37:32 -0800 (PST) MIME-Version: 1.0 Received: by 10.229.241.13 with SMTP id lc13mr3087746qcb.190.1292769452285; Sun, 19 Dec 2010 06:37:32 -0800 (PST) Received: by 10.220.190.137 with HTTP; Sun, 19 Dec 2010 06:37:32 -0800 (PST) In-Reply-To: <20101219143051.GT7020@gmx.de> References: <20101202170032.GA19376@intel.com> <20101202180829.GA16143@gmx.de> <20101202182050.GB16143@gmx.de> <20101202182235.GC16143@gmx.de> <20101202183231.GD16143@gmx.de> <20101219143051.GT7020@gmx.de> Date: Sun, 19 Dec 2010 18:23:00 -0000 Message-ID: Subject: Re: PATCH: PR binutils/12283: bfd/doc doesn't support parallel build From: "H.J. Lu" To: Ralf Wildenhues Cc: binutils@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2010-12/txt/msg00556.txt.bz2 On Sun, Dec 19, 2010 at 6:30 AM, Ralf Wildenhues w= rote: > * Ralf Wildenhues wrote on Thu, Dec 02, 2010 at 07:32:31PM CET: >> > > * H.J. Lu wrote on Thu, Dec 02, 2010 at 07:16:07PM CET: >> > > > Failure is very random. There is a race condition. "make -j8" on a= 16core >> > > > machine can start making $(MKDOC) at the same time. How can move-i= f-change >> > > > be 100% atomic? > >> > Ahh, move-if-change is broken: it doesn't ignore mv -f failure when the >> > target is equal. =A0Let's fix move-if-change. >> >> Does this alternative (untested) patch fix the race? > > Have you had a chance to try this out? It doesn't fail. But I couldn't reproduce the old problem anymore. H.J. > Thanks, > Ralf > >> ChangeLog: >> 2010-12-02 =A0Ralf Wildenhues =A0 >> >> =A0 =A0 =A0 PR binutils/12283 >> =A0 =A0 =A0 * move-if-change: Ignore failure of 'mv -f' if the destinati= on >> =A0 =A0 =A0 is equal to the source afterwards. >> >> diff --git a/move-if-change b/move-if-change >> index ff74a55..1d2dd09 100755 >> --- a/move-if-change >> +++ b/move-if-change >> @@ -4,6 +4,8 @@ >> >> =A0usage=3D"$0: usage: $0 SOURCE DEST" >> >> +cmpprog=3D${CMPPROG-cmp} >> + >> =A0case $# in >> =A02) ;; >> =A0*) echo "$usage" >&2; exit 1;; >> @@ -18,5 +20,8 @@ done >> =A0if test -r "$2" && cmp -s "$1" "$2"; then >> =A0 =A0rm -f "$1" >> =A0else >> - =A0mv -f "$1" "$2" >> + =A0if mv -f "$1" "$2"; then :; else >> + =A0 =A0# Ignore failure due to a concurrent move-if-change. >> + =A0 =A0$cmpprog "$1" "$2" >/dev/null 2>&1 >> + =A0fi >> =A0fi > --=20 H.J.