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.