[pacman-dev] bash scripts errexit and nounset options

Xavier shiningxc at gmail.com
Wed Mar 11 18:47:10 EDT 2009


I found this page while implementing the locking system for repo-add,
I stole some code from it :
http://www.davidpashley.com/articles/writing-robust-shell-scripts.html

It recommends using set -u and set -e, these both seem like a good idea to me.
Should we try to be consistent using these options in all the bash
scripts in pacman repo?
Several already use set -e, but not all of them. And none seem to use set -u.

While I find these two options useful, I wonder if it isn't a bad idea
to introduce them now, as it could cause more harm than good.
I guess that ideally, they would have been set from the beginning.
Adding them now could add some non obvious problems to code that
worked fine.

Anyway, if we agree these flags are indeed useful, they could at least
be considered when adding new scripts.


More information about the pacman-dev mailing list