public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [Bug debuginfod/25502] New: debuginfod client should default to XDG cache
@ 2020-02-04 15:39 tromey at sourceware dot org
  2020-02-06 20:46 ` [Bug debuginfod/25502] " mark at klomp dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: tromey at sourceware dot org @ 2020-02-04 15:39 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=25502

            Bug ID: 25502
           Summary: debuginfod client should default to XDG cache
           Product: elfutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: debuginfod
          Assignee: unassigned at sourceware dot org
          Reporter: tromey at sourceware dot org
                CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

The debuginfod client defaults its cache to:

static const char *cache_default_name = ".debuginfod_client_cache";
static const char *cache_path_envvar = DEBUGINFOD_CACHE_PATH_ENV_VAR;
[...]

  if (getenv(cache_path_envvar))
    strcpy(cache_path, getenv(cache_path_envvar));
  else
    {
      if (getenv("HOME"))
        sprintf(cache_path, "%s/%s", getenv("HOME"), cache_default_name);
      else
        sprintf(cache_path, "/%s", cache_default_name);
    }



That is, $HOME/.debuginfod_client_cache in the usual setup.

I think it would be better if this followed the XDG
base directory spec instead. 
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

In this case, this text applies:

 $XDG_CACHE_HOME defines the base directory relative to which user specific
non-essential data files should be stored. If $XDG_CACHE_HOME is either not set
or empty, a default equal to $HOME/.cache should be used. 

I would suggest a subdirectory of this, like .../debuginfod_client

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug debuginfod/25502] debuginfod client should default to XDG cache
  2020-02-04 15:39 [Bug debuginfod/25502] New: debuginfod client should default to XDG cache tromey at sourceware dot org
@ 2020-02-06 20:46 ` mark at klomp dot org
  2020-02-06 20:53 ` mark at klomp dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mark at klomp dot org @ 2020-02-06 20:46 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=25502

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at klomp dot org

--- Comment #1 from Mark Wielaard <mark at klomp dot org> ---
This seems like a good idea. But since we already have code in production that
uses the current cache dir I think we need to honor that if it exists.

So the lookup would be something like:
- If $DEBUGINFOD_CACHE_PATH set use that.
- If $HOME set and $HOME/.debuginfod_client_cache exists use that.
- If $HOME not set and /.debuginfod_client_cache exists use that.
- If $XDG_CACHE_HOME set use $XDG_CACHE_HOME/.debuginfod_client
- If $HOME set use $HOME/.cache/.debuginfod_client
- Use /.cache/debuginfod

I assume we need to create the $HOME/.cache or /.cache dir if it doesn't exist
yet.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug debuginfod/25502] debuginfod client should default to XDG cache
  2020-02-04 15:39 [Bug debuginfod/25502] New: debuginfod client should default to XDG cache tromey at sourceware dot org
  2020-02-06 20:46 ` [Bug debuginfod/25502] " mark at klomp dot org
@ 2020-02-06 20:53 ` mark at klomp dot org
  2020-02-07 22:37 ` tromey at sourceware dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mark at klomp dot org @ 2020-02-06 20:53 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=25502

--- Comment #2 from Mark Wielaard <mark at klomp dot org> ---
What about the Default database file? Currently $HOME/.debuginfod.sqlite

Should that go under $XDG_DATA_HOME/debuginfod/ ?
And then probably not as hidden file?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug debuginfod/25502] debuginfod client should default to XDG cache
  2020-02-04 15:39 [Bug debuginfod/25502] New: debuginfod client should default to XDG cache tromey at sourceware dot org
  2020-02-06 20:46 ` [Bug debuginfod/25502] " mark at klomp dot org
  2020-02-06 20:53 ` mark at klomp dot org
@ 2020-02-07 22:37 ` tromey at sourceware dot org
  2020-02-11 21:19 ` amerey at redhat dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at sourceware dot org @ 2020-02-07 22:37 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=25502

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to Mark Wielaard from comment #2)
> What about the Default database file? Currently $HOME/.debuginfod.sqlite
> 
> Should that go under $XDG_DATA_HOME/debuginfod/ ?
> And then probably not as hidden file?

If the file can be deleted and then re-created without difficulty,
then it should go in the cache directory as well.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug debuginfod/25502] debuginfod client should default to XDG cache
  2020-02-04 15:39 [Bug debuginfod/25502] New: debuginfod client should default to XDG cache tromey at sourceware dot org
                   ` (2 preceding siblings ...)
  2020-02-07 22:37 ` tromey at sourceware dot org
@ 2020-02-11 21:19 ` amerey at redhat dot com
  2020-02-18 12:15 ` mark at klomp dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: amerey at redhat dot com @ 2020-02-11 21:19 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=25502

Aaron Merey <amerey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amerey at redhat dot com
           Assignee|unassigned at sourceware dot org   |amerey at redhat dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug debuginfod/25502] debuginfod client should default to XDG cache
  2020-02-04 15:39 [Bug debuginfod/25502] New: debuginfod client should default to XDG cache tromey at sourceware dot org
                   ` (3 preceding siblings ...)
  2020-02-11 21:19 ` amerey at redhat dot com
@ 2020-02-18 12:15 ` mark at klomp dot org
  2020-02-18 18:18 ` amerey at redhat dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mark at klomp dot org @ 2020-02-18 12:15 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=25502

--- Comment #4 from Mark Wielaard <mark at klomp dot org> ---
(In reply to Tom Tromey from comment #3)
> (In reply to Mark Wielaard from comment #2)
> > What about the Default database file? Currently $HOME/.debuginfod.sqlite
> > 
> > Should that go under $XDG_DATA_HOME/debuginfod/ ?
> > And then probably not as hidden file?
> 
> If the file can be deleted and then re-created without difficulty,
> then it should go in the cache directory as well.

It could be, if the database is gone then it can be recreated from scratch. But
it might take a lot of work depending on how many packages/dirs you want to
index.

On the other hand if the database is important it might be explicitly be given
on the command line.

Any other opinions on where the default .debuginfod.sqlite should go (and how
it should be named)?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug debuginfod/25502] debuginfod client should default to XDG cache
  2020-02-04 15:39 [Bug debuginfod/25502] New: debuginfod client should default to XDG cache tromey at sourceware dot org
                   ` (4 preceding siblings ...)
  2020-02-18 12:15 ` mark at klomp dot org
@ 2020-02-18 18:18 ` amerey at redhat dot com
  2020-02-18 18:52 ` tromey at sourceware dot org
  2020-02-28 15:28 ` amerey at redhat dot com
  7 siblings, 0 replies; 9+ messages in thread
From: amerey at redhat dot com @ 2020-02-18 18:18 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=25502

Aaron Merey <amerey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

--- Comment #5 from Aaron Merey <amerey at redhat dot com> ---
(In reply to Mark Wielaard from comment #4)
> (In reply to Tom Tromey from comment #3)
> > (In reply to Mark Wielaard from comment #2)
> > If the file can be deleted and then re-created without difficulty,
> > then it should go in the cache directory as well.
> 
> It could be, if the database is gone then it can be recreated from scratch.
> But it might take a lot of work depending on how many packages/dirs you want
> to index.
> 
> On the other hand if the database is important it might be explicitly be
> given on the command line.
> 
> Any other opinions on where the default .debuginfod.sqlite should go (and
> how it should be named)?

According to the XDG spec, XDG_CACHE_HOME is meant for "non-essential data".
I'm not 100% sure what constitutes essential data here but if a server is able
to rebuild its database after a wipe and continue functioning as it previously
did, then I suppose the database isn't essential in this sense (even if it
might take a while to rebuild).

I think it's fair to default to XDG_CACHE_HOME since if the database is
particularly important to a user they'll probably just specify its location
like Mark said.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug debuginfod/25502] debuginfod client should default to XDG cache
  2020-02-04 15:39 [Bug debuginfod/25502] New: debuginfod client should default to XDG cache tromey at sourceware dot org
                   ` (5 preceding siblings ...)
  2020-02-18 18:18 ` amerey at redhat dot com
@ 2020-02-18 18:52 ` tromey at sourceware dot org
  2020-02-28 15:28 ` amerey at redhat dot com
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at sourceware dot org @ 2020-02-18 18:52 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=25502

--- Comment #6 from Tom Tromey <tromey at sourceware dot org> ---
> I think it's fair to default to XDG_CACHE_HOME since if the database is
> particularly important to a user they'll probably just specify its location
> like Mark said.

FWIW I only really care about the behavior on the client side.
I think for a server making a database, it would be reasonable to just
require the user specify some location; or default to ".".  IMO there's
no real reason to use some XDG directory in this situation.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug debuginfod/25502] debuginfod client should default to XDG cache
  2020-02-04 15:39 [Bug debuginfod/25502] New: debuginfod client should default to XDG cache tromey at sourceware dot org
                   ` (6 preceding siblings ...)
  2020-02-18 18:52 ` tromey at sourceware dot org
@ 2020-02-28 15:28 ` amerey at redhat dot com
  7 siblings, 0 replies; 9+ messages in thread
From: amerey at redhat dot com @ 2020-02-28 15:28 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=25502

Aaron Merey <amerey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Aaron Merey <amerey at redhat dot com> ---
commit e93959021933a8d8cca8c9968b8ccf8f018d36cd
Author: Aaron Merey <amerey@redhat.com>
Date:   Thu Feb 27 18:10:01 2020 -0500

    debuginfod-client: default to XDG cache.

    PR25502: debuginfod client should default to XDG cache

    Location of client cache now defaults to $XDG_CACHE_HOME/debuginfod_client.
    If XDG_CACHE_HOME is not set then fallback to
$HOME/.cache/debuginfod_client.
    Also maintain backwards compatibility with the previous default path-
    if $HOME/.debuginfod_client_cache exists, use that instead of the new
    defaults.

    Signed-off-by: Aaron Merey <amerey@redhat.com>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-02-28 15:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-04 15:39 [Bug debuginfod/25502] New: debuginfod client should default to XDG cache tromey at sourceware dot org
2020-02-06 20:46 ` [Bug debuginfod/25502] " mark at klomp dot org
2020-02-06 20:53 ` mark at klomp dot org
2020-02-07 22:37 ` tromey at sourceware dot org
2020-02-11 21:19 ` amerey at redhat dot com
2020-02-18 12:15 ` mark at klomp dot org
2020-02-18 18:18 ` amerey at redhat dot com
2020-02-18 18:52 ` tromey at sourceware dot org
2020-02-28 15:28 ` amerey at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).