Package: bash-completion
Version: 1:2.1-4
Tags: patch

/etc/profile.d/bash_completion accesses some variables like $BASH and
$PS1 that may be unset, which will produce a warning or error if the
(POSIX-standard) 'nounset' option is enabled.  See #776154 for details.
E.g.,
        $ set -u
        $ . /etc/profile.d/bash_completion.sh
        bash: BASH_COMPLETION_COMPAT_DIR: unbound variable

A patch is attached, which prevents errors when not loading completions
(i.e. in non-bash shells; but some of the completion scripts use unbound
variables).  I also quoted bmajor and bminor to guard against weird IFS
values.

- Michael


-- System Information:
Debian Release: 8.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: arm64

Kernel: Linux 3.16.0-4-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages bash-completion depends on:
ii  bash  4.3-11+b1
ii  dpkg  1.17.22

bash-completion recommends no packages.

bash-completion suggests no packages.

-- no debconf information
--- bash_completion.sh.orig	2015-01-24 13:22:04.380023295 -0500
+++ bash_completion.sh	2015-01-24 13:23:23.758283088 -0500
@@ -1,9 +1,9 @@
 # Check for interactive bash and that we haven't already been sourced.
-if [ -n "$BASH_VERSION" -a -n "$PS1" -a -z "$BASH_COMPLETION_COMPAT_DIR" ]; then
+if [ -n "${BASH_VERSION-}" -a -n "${PS1-}" -a -z "${BASH_COMPLETION_COMPAT_DIR-}" ]; then
 
 # Check for recent enough version of bash.
 bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.}
-if [ $bmajor -gt 4 ] || [ $bmajor -eq 4 -a $bminor -ge 1 ]; then
+if [ "$bmajor" -gt 4 ] || [ "$bmajor" -eq 4 -a "$bminor" -ge 1 ]; then
     [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" ] && \
         . "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion"
     if shopt -q progcomp && [ -r /usr/share/bash-completion/bash_completion ]; then

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Bash-completion-devel mailing list
Bash-completion-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/bash-completion-devel

Reply via email to