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

Re: Odd git overrflow bug?

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Jul 10, 2016, 21:21 UTC
Message-ID
<CA+55aFwvZqqSkphgL+UBqfXnSGAFEzmqyH83OMGnpco3ZVZUnA@mail.gmail.com>
In-Reply-To
<CA+55aFymKO5Bi2qZ-zaiZKQAk7RxusEMJ9Y0Gw6ywdznK+TaRQ@mail.gmail.com>

On Sun, Jul 10, 2016 at 2:05 PM, Linus Torvalds <torvalds@linux-foundation.org> wrote:

>
> I'm getting "extra" being -1 in strbuf_grow(). Let me dog deeper.
"dog deeper"? My typing skills are deteriorating.
Anyway, I dug deeper, and the reason is that "tabwidth" is -1, and then
 pretty.c:1669: strbuf_add_tabexpand():
        strbuf_addchars(sb, ' ', tabwidth - (width % tabwidth));
ends up having the number be -1.

I'm not sure why it doesn't happen in current git master, because that function is the same, and the logic around expand_tabs_in_log looks similar too.

That all came from
    fe37a9c586a6 (:pretty: allow tweaking tabwidth in --expand-tabs")

and I suspect the code just needs to protect against negative or zero, rather than just zero.

Junio?
              Linus
Previous: Linus TorvaldsNext: Linus Torvalds
Message 5 of 7 in “Odd git overrflow bug?”
  1. Linus TorvaldsJul 10, 2016
  2. Andreas SchwabJul 10, 2016
  3. Linus TorvaldsJul 10, 2016
  4. Linus TorvaldsJul 10, 2016
  5. Linus TorvaldsJul 10, 2016
  6. Linus TorvaldsJul 10, 2016
  7. Junio C HamanoJul 10, 2016

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.