All of lore.kernel.org
 help / color / mirror / Atom feed
* Bug: global bash variable leak on __gitcompappend
@ 2015-04-07  8:42 Marcio Almada
  0 siblings, 0 replies; only message in thread
From: Marcio Almada @ 2015-04-07  8:42 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 329 bytes --]

Hi,

This is how to reproduce the bug:

```
git checkout [tab-tab]
echo $x # outputs the name of the last branch on completion list
```

Or more directly:

```
__gitcompappend "something"
echo $x # outputs 'something'
```

No big deal, but it's annoying to know that `$x` is lurking.

Cheers,
Márcio Almada.

[-- Attachment #2: 0001-fix-global-bash-variable-leak-on-__gitcompappend.patch --]
[-- Type: text/x-patch, Size: 740 bytes --]

From 9ff849272f80f5e21a681995ed9aecfffcaf2a87 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?M=C3=A1rcio=20Almada?= <marcio3w@gmail.com>
Date: Tue, 7 Apr 2015 05:11:35 -0300
Subject: [PATCH] fix global bash variable leak on __gitcompappend

---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index fbe5972..5944c82 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -186,7 +186,7 @@ fi
 
 __gitcompappend ()
 {
-	local i=${#COMPREPLY[@]}
+	local x i=${#COMPREPLY[@]}
 	for x in $1; do
 		if [[ "$x" == "$3"* ]]; then
 			COMPREPLY[i++]="$2$x$4"
-- 
1.9.3


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-04-07  8:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-07  8:42 Bug: global bash variable leak on __gitcompappend Marcio Almada

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.