Hi, I''m testing the cache dir. First, the following error message is not quite accurate anymore: [behdad@home fc-cache]$ fc-cache Can''t save cache in "/home/behdad/.fonts" Can''t save cache in "/home/behdad/.fonts/farsifonts-0.4" A simple fix is to change "in" to "for", or better, print out the cache directory (once?). As for creating the cache dir, the simplest way is: Index: fc-cache/Makefile.am ==================================================================RCS file: /cvs/fontconfig/fontconfig/fc-cache/Makefile.am,v retrieving revision 1.10.4.1 diff -u -p -r1.10.4.1 Makefile.am --- fc-cache/Makefile.am 9 Dec 2005 16:36:45 -0000 1.10.4.1 +++ fc-cache/Makefile.am 10 Dec 2005 07:17:34 -0000 @@ -29,6 +29,11 @@ SGML = ${FC_CACHE_SRC}/fc-cache.sgml AM_CPPFLAGS = -DPKGCACHEDIR=''"${pkgcachedir}"'' +pkgcache_DATA=stamp + +stamp: + touch $@ + INCLUDES=-I${top_srcdir} $(FREETYPE_CFLAGS) bin_PROGRAMS=fc-cache which abuses the install features of automake to create the directory. --behdad http://behdad.org/ "Commandment Three says Do Not Kill, Amendment Two says Blood Will Spill" -- Dan Bern, "New American Language"
Humm, and seems like a slash is missing somewhere: [behdad@home cache]$ pwd /home/behdad/.local/var/cache [behdad@home cache]$ ll total 48 drwxrwxr-x 2 behdad behdad 4096 Dec 10 02:16 fontconfig -rw-rw-r-- 1 behdad behdad 16384 Dec 10 02:16 fontconfig29cc395f695634896af6925bc549e484.cache-2 -rw-rw-r-- 1 behdad behdad 28672 Dec 10 02:16 fontconfig2a4a6418bbcce3c3e071c870ed3b6b61.cache-2 BTW, how are different users handled exactly? Isn''t it possible to harm other users? behdad On Sat, 10 Dec 2005, it was written:> Hi, > > I''m testing the cache dir. First, the following error message is > not quite accurate anymore: > > [behdad@home fc-cache]$ fc-cache > Can''t save cache in "/home/behdad/.fonts" > Can''t save cache in "/home/behdad/.fonts/farsifonts-0.4" > > A simple fix is to change "in" to "for", or better, print out the > cache directory (once?). > > As for creating the cache dir, the simplest way is: > > Index: fc-cache/Makefile.am > ==================================================================> RCS file: /cvs/fontconfig/fontconfig/fc-cache/Makefile.am,v > retrieving revision 1.10.4.1 > diff -u -p -r1.10.4.1 Makefile.am > --- fc-cache/Makefile.am 9 Dec 2005 16:36:45 -0000 1.10.4.1 > +++ fc-cache/Makefile.am 10 Dec 2005 07:17:34 -0000 > @@ -29,6 +29,11 @@ SGML = ${FC_CACHE_SRC}/fc-cache.sgml > > AM_CPPFLAGS = -DPKGCACHEDIR=''"${pkgcachedir}"'' > > +pkgcache_DATA=stamp > + > +stamp: > + touch $@ > + > INCLUDES=-I${top_srcdir} $(FREETYPE_CFLAGS) > > bin_PROGRAMS=fc-cache > > > which abuses the install features of automake to create the > directory. > > > --behdad > http://behdad.org/ > > "Commandment Three says Do Not Kill, Amendment Two says Blood Will Spill" > -- Dan Bern, "New American Language" > _______________________________________________ > Fontconfig mailing list > Fontconfig@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/fontconfig > >--behdad http://behdad.org/ "Commandment Three says Do Not Kill, Amendment Two says Blood Will Spill" -- Dan Bern, "New American Language"
On Sat, 2005-12-10 at 02:21 -0500, Behdad Esfahbod wrote:> Humm, and seems like a slash is missing somewhere: > > [behdad@home cache]$ pwd > /home/behdad/.local/var/cache > [behdad@home cache]$ ll > total 48 > drwxrwxr-x 2 behdad behdad 4096 Dec 10 02:16 fontconfig > -rw-rw-r-- 1 behdad behdad 16384 Dec 10 02:16 fontconfig29cc395f695634896af6925bc549e484.cache-2 > -rw-rw-r-- 1 behdad behdad 28672 Dec 10 02:16 fontconfig2a4a6418bbcce3c3e071c870ed3b6b61.cache-2 > > > BTW, how are different users handled exactly? Isn''t it possible > to harm other users?Rats. We need to keep the ''truely global'' cache directory separate from per-user cache directories. That''s annoying. /var/cache/fontconfig should be root writable, per-user caches should live ''elsewhere''. I don''t really want to create another per-user directory in their home directory, so perhaps we can stuff it in ~/.fonts/fontconfig ? -keith -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20051210/a1f55f08/attachment.pgp
Keith Packard wrote:> On Sat, 2005-12-10 at 02:21 -0500, Behdad Esfahbod wrote: > >>Humm, and seems like a slash is missing somewhere:I''ve added the slash and committed the Makefile.am patch. Thanks!>>BTW, how are different users handled exactly? Isn''t it possible >>to harm other users?To answer Behdad''s original question, fc-cache generates a cache for each font directory. If you run it as root, it''ll generate caches for all font directories on the system, while if you run it as a user, it''ll fail to generate caches for systemwide font directories. In principle, it should then generate caches for user-installed fonts (e.g. in ~/.fonts). Then fontconfig creates a ''global'' cache which contains any fonts which weren''t in a per-directory cache. This is slower.> Rats. We need to keep the ''truely global'' cache directory separate from > per-user cache directories. That''s annoying. > > /var/cache/fontconfig should be root writable, per-user caches should > live ''elsewhere''. I don''t really want to create another per-user > directory in their home directory, so perhaps we can stuff it in > ~/.fonts/fontconfig ?How about just: if you can''t create the cache file in /var/cache/fontconfig, then create it in its original location? Then when we try to open a cache file, we obviously need to try the original location first. This is not quite as good as separating per-user and root caches, but it may be good enough. Comments? pat
On Mon, 2005-12-12 at 08:45 -0500, Patrick Lam wrote:> How about just: if you can''t create the cache file in > /var/cache/fontconfig, then create it in its original location? Then > when we try to open a cache file, we obviously need to try the original > location first. This is not quite as good as separating per-user and > root caches, but it may be good enough. Comments?Yes, this seems right. -keith -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20051212/a1069192/attachment.pgp
Keith Packard wrote:> On Mon, 2005-12-12 at 08:45 -0500, Patrick Lam wrote: > > >>How about just: if you can''t create the cache file in >>/var/cache/fontconfig, then create it in its original location? Then >>when we try to open a cache file, we obviously need to try the original >>location first. This is not quite as good as separating per-user and >>root caches, but it may be good enough. Comments? > > > Yes, this seems right.I''ve committed this. It can be fooled if the original location contains a stale cache and the hashed location contains an up-to-date cache. Oh well! You''ll just have to use the global cache in that case. pat
Le lundi 12 d?cembre 2005 ? 08:45 -0500, Patrick Lam a ?crit :> How about just: if you can''t create the cache file in > /var/cache/fontconfig, then create it in its original location? Then > when we try to open a cache file, we obviously need to try the original > location first. This is not quite as good as separating per-user and > root caches, but it may be good enough. Comments?This may become problematic if a cache file already exists in the font directory. In this case, a new cache file will be created in /var/cache, but won''t be used as the other location is tried first. Regards, -- .''''`. Josselin Mouette /\./\ : :'' : josselin.mouette@ens-lyon.org `. `'' joss@debian.org `- Debian GNU/Linux -- The power of freedom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Ceci est une partie de message =?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20051219/8b468215/attachment.pgp
Josselin Mouette wrote:> Le lundi 12 d?cembre 2005 ? 08:45 -0500, Patrick Lam a ?crit : > >>How about just: if you can''t create the cache file in >>/var/cache/fontconfig, then create it in its original location? Then >>when we try to open a cache file, we obviously need to try the original >>location first. This is not quite as good as separating per-user and >>root caches, but it may be good enough. Comments? > > > This may become problematic if a cache file already exists in the font > directory. In this case, a new cache file will be created in /var/cache, > but won''t be used as the other location is tried first.In that case, the directory effectively won''t have a per-directory cache if the one in the font dir is stale. This is not a big disaster, as fontconfig will simply place that directory in the global cache. It''s suboptimal, to be sure, but I can''t think of a better solution. pat
Le lundi 19 d?cembre 2005 ? 21:45 -0500, Patrick Lam a ?crit :> > This may become problematic if a cache file already exists in the font > > directory. In this case, a new cache file will be created in /var/cache, > > but won''t be used as the other location is tried first. > > In that case, the directory effectively won''t have a per-directory cache > if the one in the font dir is stale. This is not a big disaster, as > fontconfig will simply place that directory in the global cache. It''s > suboptimal, to be sure, but I can''t think of a better solution.Indeed, it just means the package maintainers will have to clean the stale cache files in the post-installation scripts. Regards, -- .''''`. Josselin Mouette /\./\ : :'' : josselin.mouette@ens-lyon.org `. `'' joss@debian.org `- Debian GNU/Linux -- The power of freedom
On Tue, 2005-12-20 at 09:36 +0100, Josselin Mouette wrote:> Indeed, it just means the package maintainers will have to clean the > stale cache files in the post-installation scripts.fc-cache should probably do this automatically as a part of generating the new cache file. -keith -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20051220/1ce99a07/attachment.pgp
Keith Packard wrote:> On Tue, 2005-12-20 at 09:36 +0100, Josselin Mouette wrote: > >>Indeed, it just means the package maintainers will have to clean the >>stale cache files in the post-installation scripts. > > fc-cache should probably do this automatically as a part of generating > the new cache file.I''ve implemented code for fc-cache which will, if the cache is invalid (as in Josselin''s example), erase both the cache in the directory and in /var/cache. I''ll commit it shortly. pat
>>>>> "Patrick" == Patrick Lam <plam@MIT.EDU> writes:Patrick> I''ve implemented code for fc-cache which will, if the cache Patrick> is invalid (as in Josselin''s example), erase both the cache Patrick> in the directory and in /var/cache. I''ll commit it shortly. I haven''t looked to see whether you''ve commited it yet, and you''ve probably already thought if this, but do be sure to deal gracefully with dirs on filesystems which are mounted read-only. -JimC -- James H. Cloos, Jr. <cloos@jhcloos.com>