[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: move-if-change and parallel make
From: |
Paul Eggert |
Subject: |
Re: move-if-change and parallel make |
Date: |
Sat, 22 Jan 2011 12:07:08 -0800 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 |
On 01/22/2011 08:03 AM, Ralf Wildenhues wrote:
> -if test -r "$2" && cmp -s -- "$1" "$2"; then
> +if test -r "$2" && $cmpprog -- "$1" "$2" >/dev/null; 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 && rm -f -- "$1"
The two cmpprog invocations should be identical, but they're
not. Only one has "--", and only one redirects stderr.
The 1st cmppprog invocation is protected by a test -r,
but the second one is not. That doesn't sound right either.
Either both should be protected, or neither. For what
it's worth, install-sh doesn't have the test -r.