On Sun, Oct 4, 2009 at 11:02 AM, William Stein <wst...@gmail.com> wrote: > Hi, > > I just noticed that David Kirkby encouraged us to put "set -e"'s in > the Sage spkg-install's, and at the time when I was barely paying > attention it seemed like a good idea. So I was just refereeing 6990 > and noticed that the spkg-install's are now full of code like this: > > ---------------------- > # This tells Bash to exit the script if any statement returns a non-true > # value. > set -e > > # PATCH > > cp patches/ctypes__init__.py src/Lib/ctypes/__init__.py > if [ $? -ne 0 ]; then > echo "Error copying patched ctypes" > exit 1 > fi > -------------------------- > > Here's the problem. There is *no possible way* the code > > echo "Error copying patched ctypes" > exit 1 > > will ever get executed! If $? isn't 0, the script already > terminated. Thus by adding "set -e" we have made it so every single > error message that was carefully written to convey what the problem > was is no longer displayed. Sometimes the error messages are fairly > obvious from "set -e", as above, but sometimes they aren't at all. > > Also, some packages, e.g., ratpoints, attempt a build, and if a > failure occurs then attempt the same build but with different options. > If one were to blithely put "set -a" at the top of such an > spkg-install, the result would be to break it on some platforms. > This could happen in any number of other situations. > > So the upshot is that I'm extremely worried about this use of "set > -e". It seems good on the surface, but it has some serious hidden > costs. >
I also see that reading the new spkg-install at the bottom of #6990 that the author (Jason Grout) is very aware of the above issues, since he goes on to write: ----------------------------- # Do not exit script if there is an error, but instead print an # informative error message. This is helps in determining why the # configuration, compilation or installation failed. So put this before the # build() function. set +e build # This tells Bash to exit the script if any statement returns a non-true # value. set -e ----------------------------- So now all of you are aware too. William --~--~---------~--~----~------------~-------~--~----~ To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---