From a29abad5007858df59160ac5d0b88eb449ae0a3e Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 1 Dec 2011 08:50:36 -0500 Subject: [PATCH] Avoid sourcing /etc/bash_completion twice for Debian-based distributions. On a system running Debian 5.0 (Lenny), running /etc/bash_completion once sets some variables (e.g. BASH_COMPLETION) and then makes them read-only. Running /etc/bash_completion again raises errors when it tries to reset these read-only variables, and the script bails, taking down all subsequent .bashrc processing with it. Work around this problem by only sourcing /etc/bash_completion if the BASH_COMPLETION variable is empty. Later versions of /etc/bash_completion avoid this issue by only setting the variables if they are empty. Versions affected: Debian 5.0 (Lenny) running /etc/bash_completion 20060301 Ubuntu 8.04.4 running /etc/bash_completion 20060301 Versions not affected: Ubuntu 9.04 running /etc/bash_completion 20080617.5 Ubuntu 10.04.2 running /etc/bash_completion 1.1 (2009) Ubuntu 10.04.3 running /etc/bash_completion 1.1 (2009) The fix should work with all the versions I've seen. --- src/.bashrc.d/20completion | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/.bashrc.d/20completion b/src/.bashrc.d/20completion index 0c50784..b99ebd9 100644 --- a/src/.bashrc.d/20completion +++ b/src/.bashrc.d/20completion @@ -20,7 +20,7 @@ elif [ "${OS}" = 'Debian' ] || [ "${OS}" = 'Ubuntu' ]; then # /etc/bash_completion # You won't need to enable this if you uncommented the appropriate # section in /etc/bash.bashrc. - if [ -f /etc/bash_completion ]; then + if [ -f /etc/bash_completion ] && [ -z "${BASH_COMPLETION}" ]; then . /etc/bash_completion fi fi -- 2.26.2