Subject: Making pkgsrc more robust
To: None <>
From: Roland Illig <>
List: tech-pkg
Date: 01/21/2006 12:49:26

to make pkgsrc (in general; especially the bulk builds) more robust 
against unforeseen errors, I'd like to add the command "set -e -u" at 
the top of every shell program that is used in the pkgsrc infrastructure.

The -e option terminates the program as soon as a command fails, which 
is much more often appropriate than just continuing. The current shell 
programs contain lots of lines like:

     cd "$some_directory"

So what should be done if the directory $some_directory is not accessible?

The -u option terminates the program as soon as an uninitialized 
variable is used. This prevents from spelling mistakes. If you want to 
use a possibly-undefined variable, you can provide a default value using 
${possibly_undefined_variable-default_value} instead of 

Together these two options will probably make pkgsrc break more often 
than before, but almost always at points where the error checking had 
not be done in the past. These points must be fixed anyway, so this is 
just a help to find them early.