Debian Bug report logs - #578423
bash-completion: uses declare -r instead of set + readonly in /etc/bash_completion

version graph

Package: bash-completion; Maintainer for bash-completion is Gabriel F. T. Gomes <gabriel@debian.org>; Source for bash-completion is src:bash-completion (PTS, buildd, popcon).

Reported by: Julian Gilbey <jdg@debian.org>

Date: Mon, 19 Apr 2010 18:45:02 UTC

Severity: normal

Tags: fixed-upstream, patch

Found in version bash-completion/1:1.1-3

Fixed in version 1:1.99-1

Done: dapal@debian.org

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Bash Completion Maintainers <bash-completion-devel@lists.alioth.debian.org>:
Bug#578423; Package bash-completion. (Mon, 19 Apr 2010 18:45:04 GMT) (full text, mbox, link).


Acknowledgement sent to Julian Gilbey <jdg@debian.org>:
New Bug report received and forwarded. Copy sent to Bash Completion Maintainers <bash-completion-devel@lists.alioth.debian.org>. (Mon, 19 Apr 2010 18:45:05 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Julian Gilbey <jdg@debian.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: bash-completion: uses declare -r instead of set + readonly in /etc/bash_completion
Date: Mon, 19 Apr 2010 21:42:54 +0300
Package: bash-completion
Version: 1:1.1-3
Severity: normal
Tags: patch

Please apply the patch below.  The problem is that declare has a nasty
side-effect: it make variables local if they are called from within a
function.  I source my /etc/bash_completion in my .bashrc as:

sourceif() { test -r "$1" && . "$1"; }
[...]
sourceif /etc/bash_completion

meaning that if I move to a machine without bash-completion installed,
my profile will still work.

However, this means that bash4 is made local to the function, and
hence completion fails on filenames with spaces, as bash4 is unset by
the time the test is used.

This patch makes the bash* variables readonly without using the
localising declare function.

   Julian

--- /etc/bash_completion.orig	2010-04-19 21:32:50.000000000 +0300
+++ /etc/bash_completion	2010-04-19 21:37:43.000000000 +0300
@@ -59,7 +59,8 @@
 # features supported by bash 2.05 and higher
 if [ ${BASH_VERSINFO[0]} -eq 2 ] && [[ ${BASH_VERSINFO[1]} > 04 ]] ||
     [ ${BASH_VERSINFO[0]} -gt 2 ]; then
-    declare -r bash205=$BASH_VERSION 2>/dev/null || :
+    bash205=$BASH_VERSION
+    readonly bash205
     default="-o default"
     dirnames="-o dirnames"
     filenames="-o filenames"
@@ -68,18 +69,21 @@
 # features supported by bash 2.05b and higher
 if [ ${BASH_VERSINFO[0]} -eq 2 ] && [[ ${BASH_VERSINFO[1]} = "05b" ]] ||
     [ ${BASH_VERSINFO[0]} -gt 2 ]; then
-    declare -r bash205b=$BASH_VERSION 2>/dev/null || :
+    bash205b=$BASH_VERSION
+    readonly bash205b
     nospace="-o nospace"
 fi
 # features supported by bash 3.0 and higher
 if [ ${BASH_VERSINFO[0]} -gt 2 ]; then
-    declare -r bash3=$BASH_VERSION 2>/dev/null || :
+    bash3=$BASH_VERSION
+    readonly bash3
     bashdefault="-o bashdefault"
     plusdirs="-o plusdirs"
 fi
 # features supported by bash 4.0 and higher
 if [ ${BASH_VERSINFO[0]} -gt 3 ]; then
-    declare -r bash4=$BASH_VERSION 2>/dev/null || :
+    bash4=$BASH_VERSION
+    readonly bash4
     compopt=compopt
 fi
 


-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-3-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_GB.UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages bash-completion depends on:
ii  bash                          4.1-2      The GNU Bourne Again SHell

bash-completion recommends no packages.

bash-completion suggests no packages.

-- no debconf information




Added tag(s) fixed-upstream. Request was from David Paleino <dapal@debian.org> to control@bugs.debian.org. (Fri, 11 Jun 2010 13:45:11 GMT) (full text, mbox, link).


Bug closed, send any further explanations to Julian Gilbey <jdg@debian.org> Request was from David Paleino <dapal@debian.org> to control@bugs.debian.org. (Sat, 07 Jan 2012 23:48:09 GMT) (full text, mbox, link).


Bug Marked as fixed in versions 1:1.99-1. Request was from David Paleino <dapal@debian.org> to control@bugs.debian.org. (Sat, 07 Jan 2012 23:48:16 GMT) (full text, mbox, link).


Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Sun, 05 Feb 2012 07:35:40 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sun Jul 2 09:42:59 2023; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.