Re: [PATCH 3/5] meson: correct path to system config/attribute files
- From
Ramsay Jones <ramsay@ramsayjones.plus.com>
- Date
- May 8, 2025, 23:16 UTC
- Message-ID
- <90deee16-18a0-47e6-9111-a0c467404386@ramsayjones.plus.com>
- In-Reply-To
- <xmqqr00y4vvd.fsf@gitster.g>
On 08/05/2025 22:48, Junio C Hamano wrote:
Show 31 quoted lines
> Ramsay Jones <ramsay@ramsayjones.plus.com> writes:
>
>> - '-DETC_GITATTRIBUTES="' + get_option('gitattributes') + '"',
>> - '-DETC_GITCONFIG="' + get_option('gitconfig') + '"',
>> ...
>> +system_attributes = get_option('gitattributes')
>> +if system_attributes != ''
>> + libgit_c_args += '-DETC_GITATTRIBUTES="' + system_attributes + '"'
>> +else
>> + libgit_c_args += '-DETC_GITATTRIBUTES="' + get_option('sysconfdir') + '/gitattributes"'
>> +endif
>
> Just out of curiosity (because this cannot be a regression, since
> the original removed one used the same constructs).
>
> I am guessing from the presence of double quote around the value
> that these strings are not directly used to invoke the compiler
> without involving any shell (in other words, you wouldn't want these
> quotes if you are shoving these strings in argv[] yourself to feed
> execv()).
>
> How does the above, and get_option() in particular, cope with a
> pathname that has letters with special meanings to the shell when
> they appear inside double-quote pair (like backquote or backslash or
> even a dollar sign)? On the Makefile side we give VAR_SQ for a raw
> variable VAR and use the latter to write something like
>
> -DETC_GITATTRIBUTES='"$(ETC_GITATTRIBUTES_SQ)"'
>
> to make sure we won't be broken by them. Is Meson giving us an
> equivalent to us for free by simply using get_option() here?Err ... no, meson is somewhat broken here, for example see [0]. To be fair, it could simply be that I am too dumb to understand what meson is doing (and I haven't really studied the documentation or the code).
Hopefully, someone who knows meson will be able to answer your question.
[0] https://lore.kernel.org/git/a5795bfa-cc02-4c9a-b7d2-4924a94cd0db@ramsayjones.plus.com/
Thanks.
ATB, Ramsay Jones