PATCH: PR binutils/12283: bfd/doc doesn't support parallel build

H.J. Lu hjl.tools@gmail.com
Sun Dec 19 18:23:00 GMT 2010


On Sun, Dec 19, 2010 at 6:30 AM, Ralf Wildenhues <Ralf.Wildenhues@gmx.de> wrote:
> * 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-if-change
>> > > > be 100% atomic?
>
>> > Ahh, move-if-change is broken: it doesn't ignore mv -f failure when the
>> > target is equal.  Let'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  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
>>
>>       PR binutils/12283
>>       * move-if-change: Ignore failure of 'mv -f' if the destination
>>       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 @@
>>
>>  usage="$0: usage: $0 SOURCE DEST"
>>
>> +cmpprog=${CMPPROG-cmp}
>> +
>>  case $# in
>>  2) ;;
>>  *) echo "$usage" >&2; exit 1;;
>> @@ -18,5 +20,8 @@ done
>>  if test -r "$2" && cmp -s "$1" "$2"; then
>>    rm -f "$1"
>>  else
>> -  mv -f "$1" "$2"
>> +  if mv -f "$1" "$2"; then :; else
>> +    # Ignore failure due to a concurrent move-if-change.
>> +    $cmpprog "$1" "$2" >/dev/null 2>&1
>> +  fi
>>  fi
>



-- 
H.J.



More information about the Binutils mailing list