Hello, Akim and Tom! > Pavel> The problem happens quite often because install cannot > Pavel> overwrite running executable files and happily goes ahead and > Pavel> installs data files. I have been fooled by this two or three > Pavel> times. > > I can't reproduce it with ash. Could you write some documentation for > autoconf.texi? Thanks!
Sorry, it took me a while to reply. The problem _is_ generic, not Cygwin specific. It's just that on Cygwin you are much more likely to be unable to replace one file, but not the others, in the same directory. The problem can been reproduced on Red Hat Linux 7.3 (bash 2.05a, GNU make 3.79.1, Autoconf 2.53, Automake 1.6.3). /usr/local/bin/mc is a directory with permissions 000. make tries to install a file with that name, ignores the failure and finishes "successfully": [proski@marabou src]$ make install make[1]: Entering directory `/usr/local/src/mc.v0/src' /bin/sh ../config/mkinstalldirs /usr/local/bin /usr/bin/install -c mc /usr/local/bin/mc /usr/bin/install: cannot stat `/usr/local/bin/mc/mc': Permission denied /usr/bin/install -c mcmfmt /usr/local/bin/mcmfmt make install-exec-hook make[2]: Entering directory `/usr/local/src/mc.v0/src' make install_mcview make[3]: Entering directory `/usr/local/src/mc.v0/src' cd /usr/local/bin/ && rm -f mcview && ln -s mc mcview make[3]: Leaving directory `/usr/local/src/mc.v0/src' make install_mcedit make[3]: Entering directory `/usr/local/src/mc.v0/src' cd /usr/local/bin/ && rm -f mcedit && ln -s mc mcedit make[3]: Leaving directory `/usr/local/src/mc.v0/src' make[2]: Leaving directory `/usr/local/src/mc.v0/src' /bin/sh ../config/mkinstalldirs /usr/local/lib/mc/bin /usr/bin/install -c cons.saver /usr/local/lib/mc/bin/cons.saver make[1]: Leaving directory `/usr/local/src/mc.v0/src' [proski@marabou src]$ I don't understand the reference to "set -e". Take this makefile: default: for i in 0 1; do \ echo testing $$i; \ test $$i = 1; \ done Run make on the same pure GNU/Linux system: [proski@marabou shell-test]$ make for i in 0 1; do \ echo testing $i; \ test $i = 1; \ done testing 0 testing 1 [proski@marabou shell-test]$ There's no error. Now add "set -e", so that the makefile is now: default: set -e; \ for i in 0 1; do \ echo testing $$i; \ test $$i = 1; \ done [proski@marabou shell-test]$ make set -e; \ for i in 0 1; do \ echo testing $i; \ test $i = 1; \ done testing 0 make: *** [default] Error 1 [proski@marabou shell-test]$ Feel the difference. Sorry, I don't know if I was supposed to try it on BSD. Two important results (sorry if they are obvious): 1) make (even GNU make) executes scripts without implicit "set -e" - it just executes separate commandes separately and checks the exit code of each of them. "set -e" is not in effect for the shell. make does its best to emulate "set -e", but doesn't split commands on the same line. 2) Explicit exit should be used inside separate commands (separate from the point of view of make) if errors may not affect the exit code of the whole command. By the way, what if the user runs "make -k"? An "exit" would terminate the loop, even though the user wants make to do as much as possible. This would be especially bad if the loop is for subdirectories - a failure in the first of them would cause all other subdirectories to be skipped, and only local commands outside the loop would be executed. You can consider this as a low-priority feature request for Automake. Perhaps it can be done by examining $(MAKE) for GNU make. -- Regards, Pavel Roskin