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

Re: [PATCH 8/8] hook-list.h: add a generated list of hooks, like config-list.h

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Sep 24, 2021, 20:09 UTC
Message-ID
<877df53f4q.fsf@evledraar.gmail.com>
In-Reply-To
<8c7aaea3-afbc-1980-ac31-6c324eef5a94@web.de>
On Fri, Sep 24 2021, René Scharfe wrote:
Show 45 quoted lines
> Am 24.09.21 um 21:30 schrieb Ævar Arnfjörð Bjarmason:
>>
>> On Fri, Sep 24 2021, Phillip Wood wrote:
>>
>>> Hi Ævar
>>> On 23/09/2021 11:30, Ævar Arnfjörð Bjarmason wrote:
>>>> diff --git a/generate-hooklist.sh b/generate-hooklist.sh
>>>> new file mode 100755
>>>> index 00000000000..6d4e56d1a31
>>>> --- /dev/null
>>>> +++ b/generate-hooklist.sh
>>>> @@ -0,0 +1,18 @@
>>>> +#!/bin/sh
>>>> +#
>>>> +# Usage: ./generate-hooklist.sh >hook-list.h
>>>> +
>>>> +cat <<EOF
>>>> +/* Automatically generated by generate-hooklist.sh */
>>>> +
>>>> +static const char *hook_name_list[] = {
>>>> +EOF
>>>> +
>>>> +sed -n -e '/^~~~~*$/ {x; s/^.*$/	"&",/; p;}; x' \
>>>
>>> POSIX does not support using a semicolon after a closing brace [1],
>>> grepping our code base with
>>> 	git grep 'sed .*};' '*.sh'
>>> does not give any matches so I don't think we're using that pattern
>>> any where else. Replacing the semicolon with ' -e' would fix it.
>>>
>>> Best Wishes
>>>
>>> Phillip
>>
>> Does this fail on any system you're aware of? If so what OS/version (and
>> preferably version of "sed").
>
> I wasn't aware of that restriction and my gut feeling is that enforcing
> it in a sed implementation would be slightly harder than allowing "};".
>
>> René's downthread <d5f297d4-9c64-1ff9-8422-054979bf8cfa@web.de> seems to
>> suggest that this is fine.
>
> That said, I didn't mean to suggest that we keep using this construct,
> just that I couldn't find an implementation which would reject it.

I'll re-test without "};", my (seemingly incorrect) quick read of your E-Mail + my own testing was that semicolons were fine there, but maybe they're just accepted by most...

Show 7 quoted lines
>> Both beforehand and just now I've tested this on AIX, Solaris,
>> {Open,Net,Free}BSD, HP/UX, OSX and Linux (a few distros/versions).
>>
>> All of them are able to generate the same hook-list.h using this version
>> of the patch.
>
> Impressive list.

FWIW that's just the GCC Farm which is fairly easy to get access to for free software devlopment: https://cfarm.tetaneutral.net/machines/list/

The HP/UX box is a similar "private" setup mainly for Perl5 core development, I'm getting to use it to get git working there.

> but still it's probably better to move the last "x" to its own -e, to
> appease the POSIX spirits.  Small change..
*nod*, will test with some version of that.
Previous: René ScharfeNext: Phillip Wood
Message 15 of 39 in “Makefile: generate a hook-list.h, prep for config-based-hooks”
  1. 0/8 Makefile: generate a hook-list.h, prep for config-based-hooksÆvar Arnfjörð Bjarmason, Sep 23, 2021
  2. 1/8 Makefile: mark "check" target as .PHONYÆvar Arnfjörð Bjarmason, Sep 23, 2021
  3. 2/8 Makefile: stop hardcoding {command,config}-list.hÆvar Arnfjörð Bjarmason, Sep 23, 2021
  4. 3/8 Makefile: don't perform "mv $@+ $@" dance for $(GENERATED_H)Ævar Arnfjörð Bjarmason, Sep 23, 2021
  5. 4/8 Makefile: remove an out-of-date commentÆvar Arnfjörð Bjarmason, Sep 23, 2021
  6. 5/8 hook.[ch]: move find_hook() from run-command.c to hook.cÆvar Arnfjörð Bjarmason, Sep 23, 2021
  7. 6/8 hook.c: add a hook_exists() wrapper and use it in bugreport.cÆvar Arnfjörð Bjarmason, Sep 23, 2021
  8. 7/8 hook.c users: use "hook_exists()" instead of "find_hook()"Ævar Arnfjörð Bjarmason, Sep 23, 2021
  9. 8/8 hook-list.h: add a generated list of hooks, like config-list.hÆvar Arnfjörð Bjarmason, Sep 23, 2021
  10. Phillip WoodSep 24, 2021
  11. Junio C HamanoSep 24, 2021
  12. René ScharfeSep 24, 2021
  13. Ævar Arnfjörð BjarmasonSep 24, 2021
  14. René ScharfeSep 24, 2021
  15. Ævar Arnfjörð BjarmasonSep 24, 2021
  16. Phillip WoodSep 27, 2021
  17. Ævar Arnfjörð BjarmasonSep 27, 2021
  18. Mike HommeyNov 15, 2021
  19. Ævar Arnfjörð BjarmasonNov 15, 2021
  20. Mike HommeyNov 15, 2021
  21. Ævar Arnfjörð BjarmasonNov 15, 2021
  22. Mike HommeyNov 15, 2021
  23. Ævar Arnfjörð BjarmasonNov 16, 2021
  24. Junio C HamanoNov 17, 2021
  25. 0/8 Makefile: generate a hook-list.h, prep for config-based-hooksÆvar Arnfjörð Bjarmason, Sep 26, 2021
  26. 1/8 Makefile: mark "check" target as .PHONYÆvar Arnfjörð Bjarmason, Sep 26, 2021
  27. 2/8 Makefile: stop hardcoding {command,config}-list.hÆvar Arnfjörð Bjarmason, Sep 26, 2021
  28. 3/8 Makefile: don't perform "mv $@+ $@" dance for $(GENERATED_H)Ævar Arnfjörð Bjarmason, Sep 26, 2021
  29. 4/8 Makefile: remove an out-of-date commentÆvar Arnfjörð Bjarmason, Sep 26, 2021
  30. 5/8 hook.[ch]: move find_hook() from run-command.c to hook.cÆvar Arnfjörð Bjarmason, Sep 26, 2021
  31. 6/8 hook.c: add a hook_exists() wrapper and use it in bugreport.cÆvar Arnfjörð Bjarmason, Sep 26, 2021
  32. 7/8 hook.c users: use "hook_exists()" instead of "find_hook()"Ævar Arnfjörð Bjarmason, Sep 26, 2021
  33. 8/8 hook-list.h: add a generated list of hooks, like config-list.hÆvar Arnfjörð Bjarmason, Sep 26, 2021
  34. Junio C HamanoSep 27, 2021
  35. René ScharfeSep 27, 2021
  36. Junio C HamanoSep 27, 2021
  37. Phillip WoodSep 27, 2021
  38. Ævar Arnfjörð BjarmasonSep 27, 2021
  39. Phillip WoodSep 27, 2021

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.