git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] completion: don't leak variable from the prompt into environment
@ 2011-11-09 10:02 SZEDER Gábor
  2011-11-09 13:11 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: SZEDER Gábor @ 2011-11-09 10:02 UTC (permalink / raw)
  To: git, Junio C Hamano, Shawn O. Pearce; +Cc: SZEDER Gábor

Commit e5b8eebc (completion: fix issue with process substitution not
working on Git for Windows, 2011-10-26) introduced a new variable in
__git_ps1_show_upstream(), but didn't declare it as local to prevent
it from leaking into the environment.
---
 contrib/completion/git-completion.bash |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index b3571ab4..d18895b1 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -110,7 +110,7 @@ __git_ps1_show_upstream ()
 	local upstream=git legacy="" verbose=""
 
 	# get some config options from git-config
-	output="$(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n ')"
+	local output="$(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n ')"
 	while read key value; do
 		case "$key" in
 		bash.showupstream)
-- 
1.7.8.rc0.107.g695cb

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] completion: don't leak variable from the prompt into environment
  2011-11-09 10:02 [PATCH] completion: don't leak variable from the prompt into environment SZEDER Gábor
@ 2011-11-09 13:11 ` Junio C Hamano
  2011-11-09 13:26   ` SZEDER Gábor
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2011-11-09 13:11 UTC (permalink / raw)
  To: SZEDER Gábor; +Cc: git, Junio C Hamano, Shawn O. Pearce

SZEDER Gábor <szeder@ira.uka.de> writes:

> Commit e5b8eebc (completion: fix issue with process substitution not
> working on Git for Windows, 2011-10-26) introduced a new variable in
> __git_ps1_show_upstream(), but didn't declare it as local to prevent
> it from leaking into the environment.
> ---

Thanks; I'd consider this signed-off?

>  contrib/completion/git-completion.bash |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index b3571ab4..d18895b1 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -110,7 +110,7 @@ __git_ps1_show_upstream ()
>  	local upstream=git legacy="" verbose=""
>  
>  	# get some config options from git-config
> -	output="$(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n ')"
> +	local output="$(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n ')"
>  	while read key value; do
>  		case "$key" in
>  		bash.showupstream)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] completion: don't leak variable from the prompt into environment
  2011-11-09 13:11 ` Junio C Hamano
@ 2011-11-09 13:26   ` SZEDER Gábor
  0 siblings, 0 replies; 3+ messages in thread
From: SZEDER Gábor @ 2011-11-09 13:26 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Shawn O. Pearce

Hi,

On Wed, Nov 09, 2011 at 05:11:26AM -0800, Junio C Hamano wrote:
> SZEDER Gábor <szeder@ira.uka.de> writes:
> 
> > Commit e5b8eebc (completion: fix issue with process substitution not
> > working on Git for Windows, 2011-10-26) introduced a new variable in
> > __git_ps1_show_upstream(), but didn't declare it as local to prevent
> > it from leaking into the environment.
> > ---
> 
> Thanks; I'd consider this signed-off?

Oops, yeah, sorry.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>


Just for the record:  I pointed this out when the patch was discussed
on the list, and proposed a better solution:

  http://thread.gmane.org/gmane.comp.version-control.git/184229/focus=184290

but apparently only after that patch was already merged.  Since we are
in -rc phase, this patch below chooses the less intrusive solution
(i.e. it declares the variable as local instead of eliminating it by
using the command substitution as here string).


Gábor


> 
> >  contrib/completion/git-completion.bash |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> > index b3571ab4..d18895b1 100755
> > --- a/contrib/completion/git-completion.bash
> > +++ b/contrib/completion/git-completion.bash
> > @@ -110,7 +110,7 @@ __git_ps1_show_upstream ()
> >  	local upstream=git legacy="" verbose=""
> >  
> >  	# get some config options from git-config
> > -	output="$(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n ')"
> > +	local output="$(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n ')"
> >  	while read key value; do
> >  		case "$key" in
> >  		bash.showupstream)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-11-09 13:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-09 10:02 [PATCH] completion: don't leak variable from the prompt into environment SZEDER Gábor
2011-11-09 13:11 ` Junio C Hamano
2011-11-09 13:26   ` SZEDER Gábor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).