Re: [PATCH] gdb: check for empty strings in get_standard_cache_dir/get_standard_config_dir

Simon Marchi via Gdb-patches
2021-01-07T21:15:05Z

On 2021-01-07 4:00 p.m., Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Simon> gdb_abspath doesn't handle empty strings, so handle this case in the
> Simon> callers. If a variable is defined but empty, I think it's reasonable in
> Simon> this case to just ignore it, as if it was not defined.
>
> Makes sense to me.
>
> For XDG, I read here:
>
> https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
>
> this:
>
> All paths set in these environment variables must be absolute. If an
> implementation encounters a relative path in any of these variables it
> should consider the path invalid and ignore it.
>
> So I suppose we could go a bit further here.
>
> Tom
>

Ok, I can try this as a follow-up patch, check that the path
is absolute using the IS_ABSOLUTE_PATH macro. Is a tilde path
considered absolute? Like

~/my-cache
~smarchi/my-cache

I suppose that it is, since it's just a shortcut for
/home/smarchi.

Simon