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

Re: git column fails (or crashes) if padding is negative

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 12, 2024, 16:37 UTC
Message-ID
<xmqqh6id8wqi.fsf@gitster.g>
In-Reply-To
<3380df68-83fb-417b-a490-71614edc342f@app.fastmail.com>
"Kristoffer Haugsbakk" <code@khaugsbakk.name> writes:
Show 20 quoted lines
> On Fri, Feb 9, 2024, at 18:57, Junio C Hamano wrote:
>>  builtin/column.c | 2 ++
>>  column.c         | 4 ++--
>>  2 files changed, 4 insertions(+), 2 deletions(-)
>>
>> […]
>> diff --git c/column.c w/column.c
>> index ff2f0abf39..9cc703832a 100644
>> --- c/column.c
>> +++ w/column.c
>> @@ -189,7 +189,7 @@ void print_columns(const struct string_list *list,
>> unsigned int colopts,
>>  	memset(&nopts, 0, sizeof(nopts));
>>  	nopts.indent = opts && opts->indent ? opts->indent : "";
>>  	nopts.nl = opts && opts->nl ? opts->nl : "\n";
>> -	nopts.padding = opts ? opts->padding : 1;
>> +	nopts.padding = (opts && 0 < opts->padding) ? opts->padding : 1;
>
> If these two are meant to check the same condition as in
> `builtin/column.c`, shouldn’t it be `0 <= opts->padding`?
Good eyes.  Otherwise we lose the ability to set the padding to 0.
Previous: Kristoffer HaugsbakkNext: Kristoffer Haugsbakk
Message 5 of 32 in “git column fails (or crashes) if padding is negative”
  1. Tiago PascoalFeb 9, 2024
  2. Kristoffer HaugsbakkFeb 9, 2024
  3. Junio C HamanoFeb 9, 2024
  4. Kristoffer HaugsbakkFeb 11, 2024
  5. Junio C HamanoFeb 12, 2024
  6. column: disallow negative paddingKristoffer Haugsbakk, Feb 9, 2024
  7. Kristoffer HaugsbakkFeb 9, 2024
  8. Chris TorekFeb 10, 2024
  9. Kristoffer HaugsbakkFeb 11, 2024
  10. Junio C HamanoFeb 11, 2024
  11. Kristoffer HaugsbakkFeb 11, 2024
  12. column: disallow negative paddingKristoffer Haugsbakk, Feb 11, 2024
  13. Rubén JustoFeb 11, 2024
  14. Rubén JustoFeb 11, 2024
  15. Kristoffer HaugsbakkFeb 12, 2024
  16. Kristoffer HaugsbakkFeb 12, 2024
  17. Rubén JustoFeb 12, 2024
  18. 0/2 column: disallow negative paddingKristoffer Haugsbakk, Feb 13, 2024
  19. 1/2 column: disallow negative paddingKristoffer Haugsbakk, Feb 13, 2024
  20. 2/2 column: guard against negative paddingKristoffer Haugsbakk, Feb 13, 2024
  21. Junio C HamanoFeb 13, 2024
  22. Rubén JustoFeb 13, 2024
  23. Junio C HamanoFeb 13, 2024
  24. Rubén JustoFeb 13, 2024
  25. Kristoffer HaugsbakkFeb 13, 2024
  26. Junio C HamanoFeb 13, 2024
  27. Rubén JustoFeb 13, 2024
  28. tag: error when git-column failsRubén Justo, Feb 13, 2024
  29. Junio C HamanoFeb 14, 2024
  30. Rubén JustoFeb 13, 2024
  31. Kristoffer HaugsbakkFeb 13, 2024
  32. Junio C HamanoFeb 13, 2024

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.