[pacman-dev] Scripts bombing with no args

Allan McRae allan at archlinux.org
Fri Jul 29 05:01:29 EDT 2011


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 at 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 at 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....

> I've got fixes for both on my 'scripts-fixup' branch
>
> https://github.com/falconindy/pacman/commit/e99b6a131ea08829da26d62d498c33f3129683e3
> https://github.com/falconindy/pacman/commit/e42d97b7370c9e30d9ae66a33f42d27460eaf137

why not:

case ${1:-""} in

which fixes the issue and leaves nounset.

Allan


More information about the pacman-dev mailing list