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

[PATCH 3/3] t/t5505-remote.sh: escape * to prevent interpretation by shell as glob

From
Brandon Casey <casey@nrlssc.navy.mil>
Date
Mar 19, 2010, 23:36 UTC
Message-ID
<CxNG4R6Vr07DvPgqJe5msXiOdQxDJcRUCjzNf-LPJNy2ozwVv3sxeG9yEQRNflvd8iDQ_qNtsIU@cipher.nrlssc.navy.mil>
In-Reply-To
<CxNG4R6Vr07DvPgqJe5msRW43WBM-kHscjWMfuzYM-XxJsVlLbOmNz_AdlMU4gEIvpsxQfdo7fc@cipher.nrlssc.navy.mil>
From: Brandon Casey <drafnel@gmail.com>

This test is supposed to check that git-remote correctly refuses to delete all non-push URLS when the all-encompassing '.*' regular expression is given. Since the '*' was not protected, it was interpreted by the shell as a file glob and expanded before being passed to git-remote. The call to git-remote still exited non-zero in this case, and the overall test still passed, but it exited non-zero because git-remote was passed the incorrect number of arguments, not for the reason it was supposed to fail.

Correct the test by escaping the '*'.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
---
 t/t5505-remote.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index e7afe9e..acfea06 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -662,7 +662,7 @@ test_expect_success 'remote set-url --add bbb' '
 '
 
 test_expect_success 'remote set-url --delete .*' '
-	test_must_fail git remote set-url --delete someremote .* &&
+	test_must_fail git remote set-url --delete someremote .\* &&
 	echo "YYY" >expect &&
 	echo baz >>expect &&
 	echo bbb >>expect &&
-- 
1.6.6.2
Previous: Brandon CaseyNext: Junio C Hamano
Message 4 of 5 in “t5505: remove unnecessary subshell invocations”
  1. 1/3 t5505: remove unnecessary subshell invocationsBrandon Casey, Mar 19, 2010
  2. 2/3 t5505: add missing &&Brandon Casey, Mar 19, 2010
  3. 3/3 t/t5505-remote.sh: escape * to prevent interpretation by shell as globBrandon Casey, Mar 20, 2010
  4. 3/3 t/t5505-remote.sh: escape * to prevent interpretation by shell as globBrandon Casey, Mar 19, 2010
  5. Junio C HamanoMar 20, 2010

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.