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

Re: [PATCH v2] bugreport: reject positional arguments

From
DSDragan Simic <dsimic@manjaro.org>
Date
Oct 26, 2023, 03:52 UTC
Message-ID
<8c82a138faa28a3c5d15a52b1d9c2c0f@manjaro.org>
In-Reply-To
<CAPig+cT4G9vdu+se9Fbbs0TRCyPoAYFgVtkSwph_U=sWf-kQ9g@mail.gmail.com>
On 2023-10-26 05:43, Eric Sunshine wrote:
Show 13 quoted lines
> On Wed, Oct 25, 2023 at 8:55 PM <emilyshaffer@google.com> wrote:
>> diff --git a/builtin/bugreport.c b/builtin/bugreport.c
>> @@ -126,6 +126,12 @@ int cmd_bugreport(int argc, const char **argv, 
>> const char *prefix)
>> +       if (argc) {
>> +               if (argv[0])
>> +                       error(_("unknown argument `%s'"), argv[0]);
>> +               usage(bugreport_usage[0]);
>> +       }
> 
> Can it actually happen that argc is non-zero but argv[0] is NULL? (I
> don't have parse-options in front of me to check.) If not, then the
> extra `if (argv[0])` conditional may confuse future readers.

According to https://stackoverflow.com/a/2794171/22330192 it can't, but argv[0] can be a zero-length string.

Previous: Eric SunshineNext: Eric Sunshine
Message 6 of 28 in “git bugreport with invalid CLI argument does not report error”
  1. SheikOct 25, 2023
  2. Emily ShafferOct 25, 2023
  3. Eric SunshineOct 25, 2023
  4. bugreport: reject positional argumentsemilyshaffer@google.com, Oct 26, 2023
  5. Eric SunshineOct 26, 2023
  6. Dragan SimicOct 26, 2023
  7. Eric SunshineOct 26, 2023
  8. Dragan SimicOct 26, 2023
  9. bugreport: reject positional argumentsemilyshaffer@google.com, Oct 26, 2023
  10. Eric SunshineOct 26, 2023
  11. Phillip WoodOct 27, 2023
  12. Junio C HamanoOct 30, 2023
  13. Junio C HamanoOct 30, 2023
  14. Junio C HamanoOct 30, 2023
  15. Junio C HamanoOct 30, 2023
  16. Phillip WoodOct 30, 2023
  17. Junio C HamanoOct 30, 2023
  18. Junio C HamanoOct 31, 2023
  19. 0/2 Deprecate test_i18ngrep furtherJunio C Hamano, Oct 31, 2023
  20. 1/2 test framework: further deprecate test_i18ngrepJunio C Hamano, Oct 31, 2023
  21. 2/2 tests: teach callers of test_i18ngrep to use test_grepJunio C Hamano, Oct 31, 2023
  22. Phillip WoodNov 1, 2023
  23. Junio C HamanoNov 1, 2023
  24. 0/2 bugreport: reject positional argumentsemilyshaffer@google.com, Oct 26, 2023
  25. Eric SunshineOct 26, 2023
  26. 1/2 t0091-bugreport: stop using i18ngrepemilyshaffer@google.com, Oct 26, 2023
  27. Junio C HamanoOct 29, 2023
  28. 2/2 bugreport: reject positional argumentsemilyshaffer@google.com, Oct 26, 2023

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.