[PATCH] debuginfod-client: default to XDG cache.

Aaron Merey amerey@redhat.com
Fri Feb 28 00:01:00 GMT 2020


On Fri, Feb 21, 2020 at 3:09 PM Mark Wielaard <mark@klomp.org> wrote:
> I think the spec is slightly ambiguous whether or not you need to
> create all parents.
> https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
>
>    If, when attempting to write a file, the destination directory is
>    non-existant an attempt should be made to create it with permission
>    0700.
>
> But I think that means we should only create the cachedir (either
> $XDG_CACHE_HOME or $HOME/.cache). Which is what we are doing here. But
> I don't think we are expected to create all parents. I think it is
> reasonable to assume they already exist (it would almost always be
> $HOME anyway).
>
> Later in the code we create target_cache_path (the debuginfod_client
> subdir), again just as one directory (we made sure its parent exists).

Makes sense, I stuck with this approach in the revised patch I've attached.

Also I ended up not attempting to rename a cache at the old default location.
IMO it brings negligible benefits while adding extra complexity plus the risk
of confusing users is greater than if we just leave the old cache where it is.

> BTW. Looking at the code again I see this comment should be adjusted
> too:
>
>   /* set paths needed to perform the query
>
>      example format
>      cache_path:        $HOME/.debuginfod_cache
>      target_cache_dir:  $HOME/.debuginfod_cache/0123abcd
>      target_cache_path: $HOME/.debuginfod_cache/0123abcd/debuginfo
>      target_cache_path:
> $HOME/.debuginfod_cache/0123abcd/source#PATH#TO#SOURCE ?
>   */

Fixed.

Aaron
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-debuginfod-client-default-to-XDG-cache.patch
Type: text/x-patch
Size: 13409 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/elfutils-devel/attachments/20200228/252d198b/attachment.bin>


More information about the Elfutils-devel mailing list