Re: [PATCH] Update bash completions to prevent unbound variable errors.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday 2009 January 12 14:40:30 Adeodato Simó wrote:
>* Boyd Stephen Smith Jr. [Mon, 12 Jan 2009 14:35:35 -0600]:
>> >The attached patch replaces things like
>> >
>> >         if [ -z "$1" ]
>> >
>> >with
>> >
>> >         if [ -z "${1-}" ]
>>
>> That looks ugly to me.  Any reason we shouldn't just "set +u" at the top
>> of the script?
>
>`set +u` affects the shell globally, not just to the sourced file. If
>you do that, you must be aware that you'll be preventing people from
>running their shell in `set -u` mode. (Merely stating a fact here, not
>giving any opinion.)

I'm not familiar with bash completion exception as a user, I didn't realize 
all these functions had to be sourced into the current shell.

Well, if the user want to run in "set -u" mode preventing it is bogus, IMO.  
We could use subshells and unset at the top of _git and _gitk functions, that 
would be only a +6/-4 patch.  It would also not be something future 
contributors have to think (much) about.
-- 
Boyd Stephen Smith Jr.                     ,= ,-_-. =. 
bss@xxxxxxxxxxxxxxxxx                     ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' 
http://iguanasuicide.net/                      \_/     

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux