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

Re: [PATCH] builtin/config.c: compilation fix

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 9, 2013, 06:31 UTC
Message-ID
<CAPc5daVoNef=EVxt+HAnVP9vSuQdTVHC=CRyc7_tqygxoiZeng@mail.gmail.com>
In-Reply-To
<866829AC-DD63-462B-B12F-BF868D0ED5C0@gmail.com>
On Thu, Aug 8, 2013 at 10:38 PM, Kyle J. McKay <mackyle@gmail.com> wrote:
>> +       const char usage[] = "test-urlmatch-normalization [-p | -l] <url1>
Show 17 quoted lines
> Looks good to me except that there seems to be a missing part of the patch.
> Did you also mean to include:
>
> diff --git a/test-urlmatch-normalization.c b/test-urlmatch-normalization.c
> index 2603899b..39017c20 100644
> --- a/test-urlmatch-normalization.c
> +++ b/test-urlmatch-normalization.c
> @@ -42,7 +42,7 @@ int main(int argc, char **argv)
>         }
>
>         if (opt_p || opt_l)
> -               die(usage);
> +               die("%s", usage);
>
> That's not terribly important here since we know the string will never
> contain any '%' characters, but the comment on the patch led me to believe
> that test-urlmatch-normalization would also get the die() change.

It appears that "const char usage[] = ..." is enough to convince Gcc that usage _is_ a constant and can never contain anything funky. But I agree that the usage string could be updated, and I agree that it is prudent to do the same die("%s", ...) there.

Previous: Kyle J. McKay
Message 3 of 3 in “builtin/config.c: compilation fix”
  1. builtin/config.c: compilation fixJunio C Hamano, Aug 9, 2013
  2. Kyle J. McKayAug 9, 2013
  3. Junio C HamanoAug 9, 2013

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.