joe@fluke.UUCP (Joe Kelsey) (09/20/84)
We just received the new SGS from AT&T. We also just put the sources for the Documenter's Workbench on our system. The make files for both of these systems have a lot of if conditionals in them. Unfortunately, make and sh interact badly on these conditions. The problem is the shell flag -e. This is supposed to cause non-interactive shells to exit on the first bad command. Make uses this flag (it calls the shell with -ce unless we are ignoring errors). Now, when the shell executes the command line, if the command on the if statement returns FALSE, the shell will exit immediately WITHOUT taking the ELSE branch. You can work around this problem by preceding the make file lines containing the offending if statements with a -, but that is not really acceptable. My question is: is this a bug in sh or a bug in make? If it is a bug in make, then should I fix it by just never using the -e flag or should I try something else? If it is a bug in sh, I don't think there is enough context available to really properly handle this case. If you still don't follow the problem, try the following: sh -ce "if false; then echo 'true'; else echo 'false'; fi" then try it without the -e flag. Compare the results. What SHOULD the results be? I think the problem is in the shell, but I'm not sure how to really fix it. I could either turn off the -e flag while executing the command list associated with the if, then turn it back right after. Or, I could set a variable saying "we're in an if - ignore errors". Which would be better? /Joe
gwyn@BRL-VLD.ARPA (09/30/84)
From: Doug Gwyn (VLD/VMB) <gwyn@BRL-VLD.ARPA> You don't say what shell you have, but I suspect it is an older version of the Bourne shell. "if" conditions work just fine in the DWB makefiles that we have, using System V user-mode software.