The script to generate opengis bindings is very dangerous if used carelessly.
Line 2 tests the variable PYXB_ROOT for emptiness and assigns to it a hardcoded value referring to /home/pab. Line 4 then depends on a file ${PYXB_ROOT}/maintainer/bundlesupport.sh to define other useful variables, notably SCHEMA_DIR and RAW_DIR. Lines 9–13 are supposed to change to ${SCHEMA_DIR} and delete the remaining files before regenerating them.
However, if /home/pab is not there (as would be the case on the machine of an unsuspecting user who decided to test the development version), or is inaccessible, or the expected files are missing, ${SCHEMA_DIR} ends up expanding to an empty string. Line 10 changes to the user’s home directory and line 12 proceeds to remove any and all files and subdirectories it can reach. I lost my collection of helper scripts in ~/bin, my (not very important) ~/Documents and a good chunk of ~/Downloads before I realized something very wrong is going on and hit ^C.
As a fix, I strongly suggest including set -e as the second line of each shell script (the first being the shebang line, #!/bin/sh) and structuring the scripts so that expected errors are suitably suppressed with ||:.
Sorry for the trouble. I'll add some failsafe code to the maintainer scripts before the next release.
commit ad1fa6f3c62e2e5caf2bdd03311e9b7b4f5fa833
Author: Peter A. Bigot <pabigot@…>
Date: Tue Jun 12 18:20:33 2012 -0500