On Thu, Jul 23, 2009 at 2:18 AM, Dr. David Kirkby<[email protected]> wrote: > > William Stein wrote: >> On Thu, Jul 23, 2009 at 1:22 AM, Dr. David >> Kirkby<[email protected]> wrote: >>> I've noticed a couple of issues on Solaris, where it appears packages >>> have been installed properly (the $SAGE_HOME/spkg/installed/foobar is >>> created), but this has not actually happened. >>> >>> On one occasion 'cp -a' was called, which failed to copy files to >>> $SAGE_HOME/local/include, as '-a' is not an option on Solaris to the cp >>> command. Sun's 'cp' reported this as an error, but this did not cause >>> the 'make' to stop. >> >> After every single command in spkg-install one *must* check the error >> return value. That's why there is code like the following all over in >> them: >> >> if [ $? -ne 0 ]; then >> echo "blah went wrong" >> exit 1 >> fi >> >> Anywhere such code doesn't happen is a bug. > > Well, there are a lot of bugs then, as a lot of code I see does not > check every command. Checking at the end does not work. > > I just looked at one random package I've never looked at before - > (numpy-1.3.0.p1] > > This contains: > > cp ../patches/gnu.py numpy/distutils/fcompiler/gnu.py > cp ../patches/__init__.py numpy/distutils/fcompiler/__init__.py > > There are no checks. There is a check later: > > if [ $? -ne 0 ]; then > echo "Error building numpy." > exit 1 > fi > > but that does not help, as the following script I wrote shows. > > #!/bin/sh > # Try to do something which will fail as non-root > > touch /this-should-fail > pwd > if [ $? -ne 0 ]; then > echo "This script failed" > exit 1 > fi > > the 'touch' command gives an error, but the message "This script failed" > is *not* printed, as the 'pwd' command later succeeded. If I remove the > 'pwd' command, so it prints the error message. > > > > > Writing > > if [ $? -ne 0 ]; then > echo "This script failed" > exit 1 > fi > > > after every single command in spkg-install would make the code very long, >
Nonetheless, we should be checking the error code after every line executes, one way or another. Is there a way to automatically do this in bash? > > >>> It would be a good idea when creating new .spkg files that one actually >>> checks that at least a subset of the files that are supposed to be >>> installed in $SAGE_HOME/local, actually are installed - preferably all >>> of them if possible. >>> >>> Comments? >> >> That won't necessarily "prove" anything, since e.g., on doing an >> upgrade the files might appear to be installed, but in fact old >> versions are installed. >> >> William > > > True, but it might go some way. Perhaps modification times could be used > in some way. > > I don't claim to know a complete foolproof solution (fools are very > resourceful), but it's clear that there are things going wrong which are > not being noticed. With a log file of 20 MB or more, its not easy for a > human to look for the errors. > > > In Solaris, any time a package is installed with the pkgadd command, a > record is kept of the checksum of every file, the permissions of the > file so it is possible to determine if something has changed. I don't > know if it's practical to do similar in Sage. It certainly is. This might make the Sage package management system "too complicated" though. Right now it is still very simple. > It's very clear to me not every error in Sage is being caught during the > installation. Fixes very welcome. > > dave > > > > -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---
