git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git-prompt.sh: make $f local to __git_eread()

From
Jjguenther@gmail.com <jguenther@gmail.com>
Date
Dec 12, 2014, 21:59 UTC
Message-ID
<1418421596-7898-1-git-send-email-jguenther@gmail.com>
From: Justin Guenther <jguenther@gmail.com>

This function uses (non-local) $f to store the value of its first parameter. This can interfere with the user's environment.

Signed-off-by: Justin Guenther <jguenther@gmail.com>
---
 contrib/completion/git-prompt.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index c5473dc..729f769 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -270,7 +270,7 @@ __git_ps1_colorize_gitstring ()
 
 __git_eread ()
 {
-	f="$1"
+	local f="$1"
 	shift
 	test -r "$f" && read "$@" <"$f"
 }
-- 
2.2.0.37.g2035459
Message 1 of 1 in “git-prompt.sh: make $f local to __git_eread()”
  1. git-prompt.sh: make $f local to __git_eread()jguenther@gmail.com, Dec 12, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.