[Bash-completion-devel] [bash-completion-Bugs][313270] "set -u" crashes bash_completion

bash-completion-bugs at alioth.debian.org bash-completion-bugs at alioth.debian.org
Thu Aug 4 00:29:34 UTC 2011


Bugs item #313270, was opened at 2011-08-04 00:29
You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=313270&group_id=100114

Status: Open
Priority: 3
Submitted By: Nobody (None)
Assigned to: Nobody (None)
Summary: "set -u" crashes bash_completion 
Distribution: --Distribution-Agnostic--
Originally reported in: None
Milestone: None
Status: None
Original bug number: 


Initial Comment:
Anonymous message posted by pdbj at mac.com

When the shell has "set -u" or "set -o nounset", which cause references to unset variables to error, bash_completion errors in two ways:

1.  On sourcing bash_completion:

$ env -i bash --login --noprofile --norc

bash-3.2$ set -u ; . /sw/etc/bash_completion
bash: BASH_COMPLETION_DEBUG: unbound variable
bash: BASH_COMPLETION: unbound variable
bash: BASH_COMPLETION_DIR: unbound variable
bash: BASH_COMPLETION_COMPAT_DIR: unbound variable
bash: BASH_COMPLETION: unbound variable
bash: list[@]: unbound variable
bash: BASH_COMPLETION_COMPAT_DIR: unbound variable
bash: BASH_COMPLETION_DIR: unbound variable
bash: BASH_COMPLETION: unbound variable

2.  When trying to complete:

bash-3.2$ ls <tab>bash: !ref: unbound variable
bash: !ref: unbound variable
bash: words[i]: unbound variable

This is in

$ bash --version
GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)
Copyright (C) 2007 Free Software Foundation, Inc.

with bash_completion 1.3.

Patch attached.  Most of the issues are in the bash_completion file itself.  A few files in bash_completion.d/ make reference to undefined variables on the complete line, for example fink:

complete $filenames -F _fink fink

I've removed these variable references, since I can't see that they are set anywhere.  If they are used in some cases, these should be restored as "${filenames:-}", etc.

Thanks,
Peter

----------------------------------------------------------------------

You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=313270&group_id=100114



More information about the Bash-completion-devel mailing list