summary refs log tree commit diff
path: root/gnu/packages/patches/bash-completion-directories.patch
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-03-18 18:11:02 +0100
committerLudovic Courtès <ludo@gnu.org>2015-03-18 18:11:02 +0100
commit381c540b937a5e6e8b7007c9c0271ee816bf5417 (patch)
tree27191f25f05bbfd48dbf47bbd29f72cb7521482f /gnu/packages/patches/bash-completion-directories.patch
parent49689377a3bab8da08436455ca14a0432fa0e95f (diff)
parentf401b1e9934a6594d6d7586922aa987e0b24839b (diff)
downloadguix-381c540b937a5e6e8b7007c9c0271ee816bf5417.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/packages/patches/bash-completion-directories.patch')
-rw-r--r--gnu/packages/patches/bash-completion-directories.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/gnu/packages/patches/bash-completion-directories.patch b/gnu/packages/patches/bash-completion-directories.patch
new file mode 100644
index 0000000000..1a3e2f55c5
--- /dev/null
+++ b/gnu/packages/patches/bash-completion-directories.patch
@@ -0,0 +1,33 @@
+Bash-completion is written with FHS in mind where completion scripts
+all get added to /usr/share/bash-completion/completions and are picked
+up by the dynamic completion loader from there---whether they are
+part of bash-completion or installed by another package.
+
+On Guix systems, we want not only to search within bash-completion's own
+directory, but also in the user's profile and in the system profile.
+This is what this patch does.
+
+--- bash-completion-2.1/bash_completion	2015-03-11 09:45:45.056846446 +0100
++++ bash-completion-2.1/bash_completion	2015-03-11 09:52:43.248159504 +0100
+@@ -1928,9 +1928,20 @@ _completion_loader()
+     local compfile=./completions
+     [[ $BASH_SOURCE == */* ]] && compfile="${BASH_SOURCE%/*}/completions"
+     compfile+="/${1##*/}"
++    local base="${1##*/}"
+ 
++    # Look for completion files in the user and global profiles and
++    # lastly in 'bash-completion' itself.
++    for file in                                                                 \
++        "$HOME/.guix-profile/share/bash-completion/completions/$base"           \
++        "$HOME/.guix-profile/etc/bash_completion.d/$base"                       \
++        "/run/current-system/profile/share/bash-completion/completions/$base"   \
++        "/run/current-system/profile/etc/bash_completion.d/$base"               \
++        "$compfile"
++    do
+     # Avoid trying to source dirs; https://bugzilla.redhat.com/903540
+-    [[ -f "$compfile" ]] && . "$compfile" &>/dev/null && return 124
++        [[ -f "$file" ]] && . "$file" &>/dev/null && return 124
++    done
+ 
+     # Need to define *something*, otherwise there will be no completion at all.
+     complete -F _minimal "$1" && return 124