leland@CS.COLUMBIA.EDU (Lee Woodbury) (04/12/89)
ifdef COMMENT Dear Roland McGrath (or whoever else is handling GNU-Make bugs): This Makefile demonstrates an apparent bug in 3.27 GNU-Make, as least as it is installed here (on VAXen, Sun 2's, Sun 3's, Sun 4). In general, the bug is this: A '-' (ignore error) is ignored if it is on the last command in a rule. Example: Here is a script of 'make' and 'make good' on this Makefile: $ make The following command breaks the make. cat xxx99xxx xxx99xxx: No such file or directory gmake: *** Error 1 (ignored) $ echo $? 1 $ make good The following command does not break the make. cat xxx99xxx xxx99xxx: No such file or directory gmake: *** Error 1 (ignored) See? $ echo $? 0 The '-' in the rule for target 'bad' has no effect. When the 'cat' fails, so does the make, even though gmake should ignore the failed cat and go on to make 'good'. Note that gmake does print the gmake: *** Error 1 (ignored) message after the 'cat $(DOES_NOT_EXIST)' fails. Furthermore, if another command is placed after the '-' command line, as in the rule for 'good' below, the make executes it. Looking briefly at the src, it looks like the problem may be at line 280 in commands.c, at the bottom of child_handler(): if (buf[0] != '\0' && !keep_going_flag) die (1); My guess is that this should be: if (buf[0] != '\0' && !keep_going_flag && !ignore_errors_flag) die (1); but I'm reluctant to make this change without knowing the rest of the code better. (If this conclusion is correct and complete, will you please confirm to me so we can make the changes locally without having to wait for the next release of GNU-Make? Thanks.) Also note that an earlier version of GNU-Make (don't know what version; -v option is not accepted) also installed here (on HP 9000/Series 300 workstations) does NOT exhibit this behavior; the '-' does inhibit termination by commands returning errors. Please feel free to contact me if I can provide any further detail. Lee Woodbury -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ARPANET/INTERNET leland@CS.COLUMBIA.EDU USENET: ...!rutgers!columbia!leland BITNET: leland%cs.columbia.edu@CUVMB USmail: 457 Computer Science Columbia University 500 West 120 Street New York, NY 10027-6699 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- endif # COMMENT DOES_NOT_EXIST=xxx99xxx .PHONY: bad good all: bad good bad: @echo "The following command breaks the make." -cat $(DOES_NOT_EXIST) good: @echo "The following command does not break the make." -cat $(DOES_NOT_EXIST) @echo "See?"