[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
Sat Aug 6 17:11:38 UTC 2011


Bugs item #313270, was changed at 2011-08-04 03:29 by Ville Skyttä
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

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

>Comment By: Ville Skyttä  (scop-guest)
Date: 2011-08-06 20:11

Message:
set -u safety is on our roadmap for bash-completion 3.0:
http://wiki.debian.org/Teams/BashCompletion/Proposals/Roadmap

For now I've applied the rpmcheck fix.  Completions for fink, launchctl, and open are not shipped by us so they need to be addressed somewhere else.

For future patches, please create them against the git master branch, and send them formatted with "git format-patch", see instructions in README shipped with bash-completion.

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

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