Le 07/01/2016 22:09, Guillaume Munch a écrit :
Le 03/01/2016 09:46, Georg Baum a écrit :
We have a script for updating the docs, examples and templates
(development/tools/updatedocs.py), and one for updating the ui and bind
files (development/tools/updatelfuns.sh). Or did you man something else?


Is there a reason why the scripts do not have exec permissions? I
initially ran "sh updatelfuns.sh" and this failed, emptying a dozen of
files. After the second try I found that it requires bash, which would
have been chosen automatically if it had been possible to run
./updatelfuns.sh directly.


It is even more serious than I thought, because running it with sh has:
* copied every single file in the repository directory (including
untracked files) to file.old
* emptied hundreds of files (including untracked files)

Having to undo this is going to be a bit annoying but it could have been
worse. Thank you Richard for doing backups without even expecting that
this was going to happen :)

I do not wish to spend time finding out what exactly went wrong (if
someone wants to find out, my sh is Ubuntu's default which is dash) but
I suggest to add a check at the start of the script as per the attached
patch.

Is there any other script where I should add this check?


Guillaume
diff --git a/development/tools/updatelfuns.sh b/development/tools/updatelfuns.sh
index 04c8c02..f771328 100644
--- a/development/tools/updatelfuns.sh
+++ b/development/tools/updatelfuns.sh
@@ -1,5 +1,10 @@
 #!/bin/bash
 
+if [ -z "$BASH_VERSION" ]; then
+	echo "You must use bash to run this script";
+	exit 1;
+fi
+
 function do_convert {
 	for i in *; do 
 		if [ ! -f $i ]; then continue; fi

Reply via email to