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, 19:30 UTC
- Message-ID
- <87fstt3gzd.fsf@evledraar.gmail.com>
- In-Reply-To
- <92471ff9-7573-c3e4-e9fd-63a5cbf5738f@gmail.com>
On Fri, Sep 24 2021, Phillip Wood wrote:
Show 29 quoted lines
> 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
>
> PhillipDoes this fail on any system you're aware of? If so what OS/version (and preferably version of "sed").
René's downthread <d5f297d4-9c64-1ff9-8422-054979bf8cfa@web.de> seems to suggest that this is fine.
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.