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

[PATCH 2/3] config: set help text for --bool-or-int

From
Jeff King <peff@peff.net>
Date
Mar 7, 2009, 17:14 UTC
Message-ID
<1236446046-18319-3-git-send-email-peff@peff.net>
In-Reply-To
<1236446046-18319-1-git-send-email-peff@peff.net>

The conversion to parse_opt left this as NULL; on glibc systems, the usage message prints

   --bool-or-int   (null)
and on other ones, segfaults.
Signed-off-by: Jeff King <peff@peff.net>
---
I found this by running t1300 on a non-glibc system. I guess printing
(null) is friendlier for real code, but for the test suite, it would be
much more convenient to have it segfault to detect the bug. This is not
the first such error we've had that I've caught in the same way.
 builtin-config.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin-config.c b/builtin-config.c
index b11a096..1a3baa1 100644
--- a/builtin-config.c
+++ b/builtin-config.c
@@ -68,7 +68,7 @@ static struct option builtin_config_options[] = {
 	OPT_GROUP("Type"),
 	OPT_BIT(0, "bool", &types, "value is \"true\" or \"false\"", TYPE_BOOL),
 	OPT_BIT(0, "int", &types, "value is decimal number", TYPE_INT),
-	OPT_BIT(0, "bool-or-int", &types, NULL, TYPE_BOOL_OR_INT),
+	OPT_BIT(0, "bool-or-int", &types, "value is --bool or --int", TYPE_BOOL_OR_INT),
 	OPT_GROUP("Other"),
 	OPT_BOOLEAN('z', "null", &end_null, "terminate values with NUL byte"),
 	OPT_END(),
-- 
1.6.2.195.g44251.dirty
Previous: Jeff KingNext: Felipe Contreras
Message 3 of 9 in “config --bool-or-int fixes”
  1. 0/3 config --bool-or-int fixesJeff King, Mar 7, 2009
  2. 1/3 t1300: use test_must_fail as appropriateJeff King, Mar 7, 2009
  3. 2/3 config: set help text for --bool-or-intJeff King, Mar 7, 2009
  4. Felipe ContrerasMar 7, 2009
  5. Jeff KingMar 7, 2009
  6. Felipe ContrerasMar 9, 2009
  7. Jeff KingMar 10, 2009
  8. 3/3 document config --bool-or-intJeff King, Mar 7, 2009
  9. Jeff KingMar 7, 2009

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.