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

Breakage in master?

From
Erik Faye-Lund <kusmabite@gmail.com>
Date
Feb 2, 2012, 12:14 UTC
Message-ID
<CABPQNSbWu0r_gKGvCHk567pUtQiyDOCO8vFfrzPMFW1eUaj1nw@mail.gmail.com>

Something strange is going on in Junio's current 'master' branch (f3fb075). "git show" has started to error out on Windows with a complaint about our vsnprintf: ---8<---

$ git show
commit f3fb07509c2e0b21b12a598fcd0a19a92fc38a9d
Author: Junio C Hamano <gitster@pobox.com>
Date:   Tue Jan 31 22:31:35 2012 -0800
    Update draft release notes to 1.7.10
    Signed-off-by: Junio C Hamano <gitster@pobox.com>

fatal: BUG: your vsnprintf is broken (returned -1) ---8<---

"git status" is also behaving strange: ---8<--- $ git status # On branch master # Untracked files: # (use "git add <file>..." to include in what will be committed) # # ←[31mcompat/vcbuild/include/sys/resource.h←[m # ←[31mtemp.patch←[m # ←[31mtest.c←[m # ←[31mtest.patch←[m nothing added to commit but untracked files present (use "git add" to track) ---8<---

Yeah, the ANSI color codes are being printed verbatim, even though compat/winansi.c is supposed to convert these. "git -p status" works fine, as it pipes the ANSI codes directly through less.

But here's the REALLY puzzling part: If I add a simple, unused function to diff-lib.c, like this:

---8<---
diff --git a/diff-lib.c b/diff-lib.c
index fc0dff3..914a224 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -82,6 +82,11 @@ static int match_stat_with_submodule(struct
diff_options *diffopt,
 	return changed;
 }

+static unsigned int foo(const char *a, unsigned int b)
+{
+	return b;
+}
+
 int run_diff_files(struct rev_info *revs, unsigned int option)
 {
 	int entries, i;
---8<---

"git status" starts to error out with that same vsnprintf complaint!

---8<---
$ git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
fatal: BUG: your vsnprintf is broken (returned -1)
---8<---

Here's the stack-trace:
---8<---
Breakpoint 1, die (err=0x5268ec "BUG: your vsnprintf is broken (returned %d)")
    at usage.c:81
81      void NORETURN die(const char *err, ...)
(gdb) bt
#0  die (err=0x5268ec "BUG: your vsnprintf is broken (returned %d)")
    at usage.c:81
#1  0x00466314 in strbuf_vaddf (sb=0x28fb54,
    fmt=0x533ef4 "  (use \"git checkout -- <file>...\" to discard changes in wor
king directory)", ap=0x28fbac "+\025\026\002") at strbuf.c:221
#2  0x004cbb6f in status_vprintf (s=0x28fc38, at_bol=0,
    color=0x46c4f2 "\205└t\n\203─\020[^╔├\215v",
    fmt=0x533ef4 "  (use \"git checkout -- <file>...\" to discard changes in wor
king directory)", ap=0x28fbac "+\025\026\002", trail=0x533a89 "\n")
    at wt-status.c:44
#3  0x004cbe6b in status_printf_ln (s=0x28fc38, color=0x28fc70 "",
    fmt=0x533ef4 "  (use \"git checkout -- <file>...\" to discard changes in wor
king directory)") at wt-status.c:87
#4  0x004cced1 in wt_status_print (s=0x28fc38) at wt-status.c:176
#5  0x0041922e in cmd_status (argc=1, argv=0x319b4, prefix=0x0)
    at builtin/commit.c:1254
#6  0x004019d6 in handle_internal_command (argc=<value optimized out>,
    argv=<value optimized out>) at git.c:308
#7  0x00401c26 in main (argc=2, argv=0x319b0) at git.c:513
(gdb)
---8<---

This smells a bit like a smashed stack to me. Both issues happens in
roughly the same area of the call stack, and when adding an unused
function changes behavior, something really odd is going on ;)

I've bisected the issues down to 5e9637c (i18n: add infrastructure for
translating Git with gettext). Trying to apply my unused-function
patch on top of this commit starts giving the same "fatal: BUG: your
vsnprintf is broken (returned -1)" error. It's ancestor, bc1bbe0(Git
1.7.8-rc2), does not yield any of the issues.

I'm at a loss here. Does anyone have a hunch about what's going on?
Next: Jeff King
Message 1 of 12 in “Breakage in master?”
  1. Erik Faye-LundFeb 2, 2012
  2. Jeff KingFeb 2, 2012
  3. Erik Faye-LundFeb 3, 2012
  4. Joel C. SalomonFeb 3, 2012
  5. Erik Faye-LundFeb 3, 2012
  6. Joel C. SalomonFeb 3, 2012
  7. Erik Faye-LundFeb 4, 2012
  8. Fwd: Breakage in master?Erik Faye-Lund, Feb 5, 2012
  9. Johannes SchindelinFeb 2, 2012
  10. Torsten BögershausenFeb 2, 2012
  11. Johannes SixtFeb 2, 2012
  12. svnpenn@gmail.comFeb 9, 2012

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.