[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
'compile' script calls mv in a way that fails
From: |
Bruno Haible |
Subject: |
'compile' script calls mv in a way that fails |
Date: |
Sat, 3 Oct 2009 14:40:17 +0200 |
User-agent: |
KMail/1.9.9 |
Hi,
When automake's 'compile' script is called for files in the current directory,
it invokes 'mv' in a way that fails.
Using automake 1.11 and autoconf 2.64.
How to reproduce:
Check out a recent gnulib.
$ ./gnulib-tool --create-testdir --dir=$HOME/data/tmp/testdir3 mbscasestr
$ cd /tmp
$ cat > oldcc <<\EOF
#!/bin/sh
case " $* " in
*" -c "*)
case " $* " in
*" -o "*)
echo "oldcc: -o and -c incompatible" 1>&2
exit 1
;;
esac
;;
esac
exec gcc "$@"
EOF
$ chmod a+x oldcc
$ cd /tmp/testdir3
$ ./configure CC=/tmp/oldcc
$ make
...
make[4]: Entering directory `/tmp/testdir3/gllib'
source='localcharset.c' object='localcharset.o' libtool=no \
DEPDIR=.deps depmode=none /bin/sh ../build-aux/depcomp \
/tmp/testdir3/build-aux/compile /tmp/oldcc -DHAVE_CONFIG_H -I. -I..
-g -O2 -c -o localcharset.o localcharset.c
mv: `localcharset.o' and `localcharset.o' are the same file
When GNU mv produces this error message, it also errs out with exit code 1.
Here is a proposed patch (tested):
2009-10-03 Bruno Haible <address@hidden>
* lib/compile: Don't attempt to move the generated file to its target
destination when it is already at the target destination. Avoids an mv
failure.
*** automake/lib/compile.bak 2009-10-03 14:26:24.000000000 +0200
--- automake/lib/compile 2009-10-03 14:29:07.000000000 +0200
***************
*** 123,132 ****
"$@"
ret=$?
! if test -f "$cofile"; then
! mv "$cofile" "$ofile"
! elif test -f "${cofile}bj"; then
! mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
--- 123,134 ----
"$@"
ret=$?
! if test "$ofile" != "$cofile"; then
! if test -f "$cofile"; then
! mv "$cofile" "$ofile"
! elif test -f "${cofile}bj"; then
! mv "${cofile}bj" "$ofile"
! fi
fi
rmdir "$lockdir"
- 'compile' script calls mv in a way that fails,
Bruno Haible <=