about summary refs log tree commit diff
path: root/pkgs/shells/bash-completion
diff options
context:
space:
mode:
authorIvan Sorokin <vanyacpp@gmail.com>2015-02-12 22:18:17 +0300
committerIvan Sorokin <vanyacpp@gmail.com>2015-02-12 22:18:17 +0300
commit20ab4027da00019de2c2df5fb97f6dd1ae82de17 (patch)
tree20e886a9de6039216ae01ea806aec2d0d3e54a37 /pkgs/shells/bash-completion
parent41cca7d2d6ff612b7c248ed442b362ce20e3f51d (diff)
downloadnixlib-20ab4027da00019de2c2df5fb97f6dd1ae82de17.tar
nixlib-20ab4027da00019de2c2df5fb97f6dd1ae82de17.tar.gz
nixlib-20ab4027da00019de2c2df5fb97f6dd1ae82de17.tar.bz2
nixlib-20ab4027da00019de2c2df5fb97f6dd1ae82de17.tar.lz
nixlib-20ab4027da00019de2c2df5fb97f6dd1ae82de17.tar.xz
nixlib-20ab4027da00019de2c2df5fb97f6dd1ae82de17.tar.zst
nixlib-20ab4027da00019de2c2df5fb97f6dd1ae82de17.zip
bash-completion: fix bad array subscript error. Closes #6117
Diffstat (limited to 'pkgs/shells/bash-completion')
-rw-r--r--pkgs/shells/bash-completion/bash-4.3.patch22
-rw-r--r--pkgs/shells/bash-completion/default.nix2
2 files changed, 24 insertions, 0 deletions
diff --git a/pkgs/shells/bash-completion/bash-4.3.patch b/pkgs/shells/bash-completion/bash-4.3.patch
new file mode 100644
index 000000000000..e893b501d311
--- /dev/null
+++ b/pkgs/shells/bash-completion/bash-4.3.patch
@@ -0,0 +1,22 @@
+commit a9c556ccad819869a6a5d932aac0a75a99372f08
+Author: Barry Warsaw <barry@python.org>
+Date:   Wed Sep 17 19:32:43 2014 +0300
+
+    _init_completion: Handle cword < 0 (LP: #1289597)
+    
+    Previously only bash 4.3 seemed to provoke this, but now with the
+    empty command consistency tweak it occurs with earlier as well.
+
+diff --git a/bash_completion b/bash_completion
+index 7e01ae4..3bb4bc2 100644
+--- a/bash_completion
++++ b/bash_completion
+@@ -727,7 +727,7 @@ _init_completion()
+         fi
+     done
+ 
+-    [[ $cword -eq 0 ]] && return 1
++    [[ $cword -le 0 ]] && return 1
+     prev=${words[cword-1]}
+ 
+     [[ ${split-} ]] && _split_longopt && split=true
diff --git a/pkgs/shells/bash-completion/default.nix b/pkgs/shells/bash-completion/default.nix
index a189ed29d8cb..39f7073fcbbf 100644
--- a/pkgs/shells/bash-completion/default.nix
+++ b/pkgs/shells/bash-completion/default.nix
@@ -8,6 +8,8 @@ stdenv.mkDerivation rec {
     sha256 = "0kxf8s5bw7y50x0ksb77d3kv0dwadixhybl818w27y6mlw26hq1b";
   };
 
+  patches = [ ./bash-4.3.patch ];
+
   doCheck = true;
 
   meta = {