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@xxxxxxxxx> Date: Tue Jan 31 22:31:35 2012 -0800 Update draft release notes to 1.7.10 Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx> 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? -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html