Bug 20411 - (antistress) fontconfig doesn't match FreeDesktop directories specs
(antistress)
fontconfig doesn't match FreeDesktop directories specs
Status: RESOLVED FIXED
Product: fontconfig
Classification: Unclassified
Component: conf
2.6
Other All
: medium normal
Assigned To: Akira TAGOH
Behdad Esfahbod
:
: 25378 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-03-01 10:03 UTC by antistress
Modified: 2012-05-17 19:24 UTC (History)
6 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description antistress 2009-03-01 10:03:36 UTC
i'm running Ubuntu Jaunty alpha and it seems that fontconfig places its configuration (or cache?) files in
/home/.fontconfig directory which doesn't match FreeDesktop directories specs :

The default for $XDG_CONFIG_HOME is $HOME/.config, the default for
$XDG_DATA_HOME is $HOME/.local/share. So all applications should look for
those environment variables and use those default values if the variables
are not set.

This is quite important since it's not possible to easily backup config
& data files if these files are not stored at the right place

See http://www.freedesktop.org/wiki/Specifications/basedir-spec
See also
http://ploum.frimouvy.org/?184-cleaning-user-preferences-keeping-user-data
(main post and comment#8)
Comment 1 Behdad Esfahbod 2009-07-22 10:02:36 UTC
I'm not sure where should we place the cache files according to the XDG specs.  Any idea?
Comment 2 antistress 2009-07-22 16:38:39 UTC
There is a single base directory relative to which user-specific non-essential (cached) data should be written. This directory is defined by the environment variable $XDG_CACHE_HOME. 
http://standards.freedesktop.org/basedir-spec/latest/ar01s02.html
Comment 3 Behdad Esfahbod 2009-07-24 11:59:36 UTC
Thanks.  Something to look into for 2.8
Comment 4 Akira TAGOH 2011-09-04 22:29:34 UTC
*** Bug 25378 has been marked as a duplicate of this bug. ***
Comment 5 Akira TAGOH 2012-03-12 03:20:14 UTC
The proposed patch for this:
http://cgit.freedesktop.org/~tagoh/fontconfig/commit/?h=bz20411

That would be nice if you can test that tree for this issue.
Comment 6 Akira TAGOH 2012-03-22 03:33:34 UTC
One concern on this patch is the config files can't be shared with other boxes keeps using older fontconfig. due to the change of the order of the directory to give it priority for storing the caches, "$XDG_CACHE_HOME" dir is created on older release.

Is it maybe better having the kind of 'prefix' attribute in <include>, <dir> and <cachedir> to set $XDG_{CACHE,CONFIG,DATA}_HOME? though it's hard to avoid creating new dir on older systems and can't share the updated caches.
Comment 7 Akira TAGOH 2012-04-25 02:50:50 UTC
another idea is to add "read-only" attribute and add new one after old one:

<cachedir>/var/cache/fontconfig</cachedir>
<cachedir read-only="yes">~/.fontconfig</cachedir>
<cachedir>$XDG_CACHE_HOME/fontconfig</cachedir>

in older version of fontconfig, ~/.fontconfig is still writable to update caches but not in new version. so this way can avoids creating '$XDG_CACHE_HOME' dir at the home dir.
Comment 8 william.jon.mccann 2012-05-03 10:43:33 UTC
I'm not sure we should be that concerned about sharing /etc configuration files between machines.
Comment 9 Josh Triplett 2012-05-06 19:10:05 UTC
(In reply to comment #8)
> I'm not sure we should be that concerned about sharing /etc configuration files
> between machines.

Agreed, and likewise with the cache directories themselves.  Just switch to the new location, and if a system has both an older and newer fontconfig, then they'll keep their caches in different places.
Comment 10 Akira TAGOH 2012-05-07 00:47:58 UTC
(In reply to comment #9)
> Agreed, and likewise with the cache directories themselves.  Just switch to the
> new location, and if a system has both an older and newer fontconfig, then
> they'll keep their caches in different places.

Well, there are no changes in the cache file format this time. the cache file itself is completely compatible with the older version. this is totally the configuration issue since fontconfig basically doesn't have hardcode path in the binary. and I'd avoid extra time to regenerate the cache files due to the changes of cache dir for the user space if any. this is why I want to keep the older places in the configuration somehow.

If we don't need to worry about creating '$XDG_CACHE_HOME' dir when using on older fontconfig, that's okay. though it still looks ugly to me.. even though I made this patch ;o)
Comment 11 Akira TAGOH 2012-05-16 03:24:29 UTC
Another try:
http://cgit.freedesktop.org/~tagoh/fontconfig/commit/?h=bz20411-2

That somewhat looks better to me than the previous one.
Comment 12 Akira TAGOH 2012-05-17 19:24:03 UTC
Okay, merged into master.