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

Fix silly pathspec bug in git-ls-files

From
Linus Torvalds <torvalds@osdl.org>
Date
Aug 24, 2005, 00:14 UTC
Message-ID
<Pine.LNX.4.58.0508231711350.3317@g5.osdl.org>

The "verify_pathspec()" function doesn't test for ending NUL character in the pathspec, causing some really funky and unexpected behaviour. It just happened to work in the cases I had tested.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---
diff --git a/ls-files.c b/ls-files.c
--- a/ls-files.c
+++ b/ls-files.c
@@ -496,7 +496,7 @@ static void verify_pathspec(void)
 			char c = n[i];
 			if (prev && prev[i] != c)
 				break;
-			if (c == '*' || c == '?')
+			if (!c || c == '*' || c == '?')
 				break;
 			if (c == '/')
 				len = i+1;
Message 1 of 1 in “Fix silly pathspec bug in git-ls-files”
  1. Linus TorvaldsAug 24, 2005

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.