[PATCH] gdb: check for empty strings in get_standard_cache_dir/get_standard_config_dir
Andrew Burgess
andrew.burgess@embecosm.com
Fri Jan 8 09:45:24 GMT 2021
* Lancelot SIX via Gdb-patches <gdb-patches@sourceware.org> [2021-01-07 21:43:37 +0000]:
> Hi
> > 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 would be tempted to say that it is not (according to
> https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html it
> seems it is not).
I guess you're suggesting it's not because it doesn't start with a
slash?
However, isn't ~ expansion something a tool does, not a file system
thing?
So '~/my-cache' as a path is really asking to open ${CWD}/~/my-cache,
it's just that many tools actually choose to modify any incoming path
starting with ~.
So, is '~/my-cache' absolute? No, as an incoming request from the
user, I agree with you it is not. But, GDB attaches special meaning
to paths starting with ~, and converts them into absolute paths...
I think we already agreed not to change this behaviour anyway, so I
probably shouldn't even be writing this....
Thanks,
Andrew
More information about the Gdb-patches
mailing list