[Bash-completion-devel] Bug#648319: bash-completion: /etc/bash_completion script doesn't do the job

Jonathan Nieder jrnieder at gmail.com
Wed Jan 11 22:20:22 UTC 2012


Ville Skyttä wrote:

>                                  I guess Debian will have to implement
> something like the readlink anyway for backwards compatibility reasons

Hmm.  I'd rather see the Debian package's behavior remain consistent
with upstream.  How about this?
---
 debian/bash-completion.preinst            |   12 +++++++++++
 debian/changelog                          |    9 ++++++++
 debian/extra/bash_completion              |    1 +
 debian/install                            |    1 +
 debian/links                              |    1 -
 debian/patches/00-fix_symlink_issue.patch |   30 -----------------------------
 debian/patches/series                     |    1 -
 7 files changed, 23 insertions(+), 32 deletions(-)
 create mode 100644 debian/bash-completion.preinst
 create mode 100644 debian/extra/bash_completion
 delete mode 100644 debian/patches/00-fix_symlink_issue.patch
 delete mode 100644 debian/patches/series

diff --git a/debian/bash-completion.preinst b/debian/bash-completion.preinst
new file mode 100644
index 00000000..f0563d4f
--- /dev/null
+++ b/debian/bash-completion.preinst
@@ -0,0 +1,12 @@
+#!/bin/sh
+set -e
+
+if dpkg --compare-versions "$2" lt-nl 1:1.99-4 &&
+   dpkg --compare-versions "$2" ge 1:1.99-2 &&
+   [ -L /etc/bash_completion ]&&
+   [ "$(readlink /etc/bash_completion)" = \
+     /usr/share/bash-completion/bash_completion ]; then
+    rm -f /etc/bash_completion
+fi
+
+#DEBHELPER#
diff --git a/debian/changelog b/debian/changelog
index 45e53fa2..23746b1f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+bash-completion (1:1.99-4) UNRELEASED; urgency=low
+
+  * Replace /etc/bash_completion symlink with a shim script
+  * Remove no longer needed symlink-issue patch
+  * Remove /etc/bash_completion symlink to make room for shim script
+    on upgrade from versions 1:1.99-2 and 1:1.99-3.
+
+ -- Jonathan Nieder <jrnieder at gmail.com>  Wed, 11 Jan 2012 16:00:35 -0600
+
 bash-completion (1:1.99-3) unstable; urgency=low
 
   * Fixed issue when loading completions from the /etc/bash_completion
diff --git a/debian/extra/bash_completion b/debian/extra/bash_completion
new file mode 100644
index 00000000..41ffe595
--- /dev/null
+++ b/debian/extra/bash_completion
@@ -0,0 +1 @@
+. /usr/share/bash-completion/bash_completion
diff --git a/debian/install b/debian/install
index bcda3394..d8b573a7 100644
--- a/debian/install
+++ b/debian/install
@@ -1,2 +1,3 @@
+debian/extra/bash_completion			/etc/
 debian/extra/debhelper/dh_bash-completion	/usr/bin/
 debian/extra/debhelper/bash_completion.pm	/usr/share/perl5/Debian/Debhelper/Sequence/
diff --git a/debian/links b/debian/links
index 773dcddb..9a638a9a 100644
--- a/debian/links
+++ b/debian/links
@@ -1,2 +1 @@
 usr/share/doc/bash-completion/README.gz	usr/share/doc/bash/README.bash_completion.gz
-usr/share/bash-completion/bash_completion etc/bash_completion
diff --git a/debian/patches/00-fix_symlink_issue.patch b/debian/patches/00-fix_symlink_issue.patch
deleted file mode 100644
index 5ee60661..00000000
--- a/debian/patches/00-fix_symlink_issue.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From: Jonathan Nieder <jrnieder at gmail.com>
-Subject: fix issue when loading bash-completion from a symlink
-Forwarded: not-needed
-
----
- bash_completion |    6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
---- bash-completion.orig/bash_completion
-+++ bash-completion/bash_completion
-@@ -1916,7 +1916,8 @@ _minimal()
- _completion_loader()
- {
-     local compdir=./completions
--    [[ $BASH_SOURCE == */* ]] && compdir="${BASH_SOURCE%/*}/completions"
-+    local compscript=$(readlink -f $BASH_SOURCE)
-+    [[ $compscript == */* ]] && compdir="${compscript%/*}/completions"
- 
-     # Try basename.
-     . "$compdir/${1##*/}" &>/dev/null && return 124
-@@ -1937,7 +1938,8 @@ _xfunc()
-     shift
-     declare -F $1 &>/dev/null || {
-         local compdir=./completions
--        [[ $BASH_SOURCE == */* ]] && compdir="${BASH_SOURCE%/*}/completions"
-+        local compscript=$(readlink -f $BASH_SOURCE)
-+        [[ $compscript == */* ]] && compdir="${compscript%/*}/completions"
-         . "$compdir/$srcfile"
-     }
-     "$@"
diff --git a/debian/patches/series b/debian/patches/series
deleted file mode 100644
index 4f77fe94..00000000
--- a/debian/patches/series
+++ /dev/null
@@ -1 +0,0 @@
-00-fix_symlink_issue.patch
-- 
1.7.8.3






More information about the Bash-completion-devel mailing list