On 29/07/11 22:38, Dave Reisner wrote:
On Fri, Jul 29, 2011 at 07:01:29PM +1000, Allan McRae wrote:
On 29/07/11 03:14, Dave Reisner wrote:
On Thu, Jul 28, 2011 at 11:18:15AM -0500, Dan McGee wrote:
Allan or Dave, mind taking a look at this? We should show usage info, as rankmirrors and pacman-key do without args, instead of this silly behavior.
-Dan
dmcgee@galway ~/projects/pacman (master) $ ./scripts/repo-add ==> ERROR: '' does not have a valid archive extension.
We never check for $1 being unset before proceeding. Probably my mistake when I did some refactoring of repo-add.
dmcgee@galway ~/projects/pacman (master) $ ./scripts/pkgdelta ./scripts/pkgdelta: line 147: $1: unbound variable
'set -u' with 'set -e'? Ugly...
Care to explain why? Using this in our cleanup scripts would have prevented the Arch repos disappearing on more than one occasion....
Because the combination of these two flags causes scripts to fail in mysterious and unexpected ways. Also, it won't save you from set but empty vars, which I suspect would be just as dangerous as unset vars in the situation you allude to. Just validate the user inputs. It makes things more obvious to an outside reader of the code, as well as consumers of the script.
FYI, this is the story I am referring to: http://archlinux.me/brain0/2009/08/16/shit-happens-when-you-party-naked-or-u... I'm still a fan of keeping set -u and -e... It may not save you from everything, but it does stop some things. Allan