[packages/password-store] bash_completion: do not leak variables to globals scope

glen glen at pld-linux.org
Wed Sep 12 22:18:27 CEST 2018


commit ce60572199da324689c898701e20a833a2044118
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Wed Sep 12 23:17:38 2018 +0300

    bash_completion: do not leak variables to globals scope

 bashcomp-noleak.patch | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++
 password-store.spec   |  2 ++
 2 files changed, 55 insertions(+)
---
diff --git a/password-store.spec b/password-store.spec
index 31b3efe..90c3912 100644
--- a/password-store.spec
+++ b/password-store.spec
@@ -6,6 +6,7 @@ License:	GPL v2+
 Group:		Applications
 Source0:	https://git.zx2c4.com/password-store/snapshot/%{name}-%{version}.tar.xz
 # Source0-md5:	db2d49af9e666cc5ef6aa1c61ae5c045
+Patch0:		bashcomp-noleak.patch
 URL:		https://www.passwordstore.org/
 BuildRequires:	rpmbuild(macros) >= 1.720
 BuildRequires:	tar >= 1:1.22
@@ -68,6 +69,7 @@ password-store.
 
 %prep
 %setup -q
+%patch0 -p1
 
 rm contrib/emacs/.gitignore
 
diff --git a/bashcomp-noleak.patch b/bashcomp-noleak.patch
new file mode 100644
index 0000000..6267473
--- /dev/null
+++ b/bashcomp-noleak.patch
@@ -0,0 +1,53 @@
+commit 983efbbfd3848ed719b30407d4cc632b01dd9385
+Author: Elan Ruusamäe <glen at pld-linux.org>
+Date:   Wed Sep 12 23:12:56 2018 +0300
+
+    bash_completion: do not leak variables to globals scope
+    
+    Signed-off-by: Elan Ruusamäe <glen at pld-linux.org>
+
+diff --git a/src/completion/pass.bash-completion b/src/completion/pass.bash-completion
+index bbe9d0c..08f3401 100644
+--- a/src/completion/pass.bash-completion
++++ b/src/completion/pass.bash-completion
+@@ -5,10 +5,10 @@
+ # This file is licensed under the GPLv2+. Please see COPYING for more information.
+ 
+ _pass_complete_entries () {
+-	prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store/}"
++	local prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store/}"
+ 	prefix="${prefix%/}/"
+-	suffix=".gpg"
+-	autoexpand=${1:-0}
++	local suffix=".gpg"
++	local autoexpand=${1:-0}
+ 
+ 	local IFS=$'\n'
+ 	local items=($(compgen -f $prefix$cur))
+@@ -17,7 +17,7 @@ _pass_complete_entries () {
+ 	# it is a directory, then don't add a space to the completion
+ 	local firstitem=""
+ 	# Use counter, can't use ${#items[@]} as we skip hidden directories
+-	local i=0
++	local i=0 item
+ 
+ 	for item in ${items[@]}; do
+ 		[[ $item =~ /\.[^/]*$ ]] && continue
+@@ -27,7 +27,7 @@ _pass_complete_entries () {
+ 		if [[ ${#items[@]} -eq 1 && $autoexpand -eq 1 ]]; then
+ 			while [[ -d $item ]]; do
+ 				local subitems=($(compgen -f "$item/"))
+-				local filtereditems=( )
++				local filtereditems=( ) item2
+ 				for item2 in "${subitems[@]}"; do
+ 					[[ $item2 =~ /\.[^/]*$ ]] && continue
+ 					filtereditems+=( "$item2" )
+@@ -59,7 +59,7 @@ _pass_complete_entries () {
+ }
+ 
+ _pass_complete_folders () {
+-	prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store/}"
++	local prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store/}"
+ 	prefix="${prefix%/}/"
+ 
+ 	local IFS=$'\n'
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/password-store.git/commitdiff/ce60572199da324689c898701e20a833a2044118



More information about the pld-cvs-commit mailing list