Subject: Re: fc-cache problem with src/x11 build - reading host /etc/fonts?
To: None <current-users@netbsd.org>
From: Greg Troxel <gdt@ir.bbn.com>
List: current-users
Date: 06/30/2004 10:31:50
  Earlier I wrote:

  Passing -x to build.sh usually works (if /usr/xsrc is free of crud
  from previous non-build.sh builds), but I have run into situations
  where fc-cache fails during the build.  In those cases, running it by
  hand (using the tooldir version) seems to succeed, and then future
  builds are ok.

The problem was that my project's build scripts (which invoke build.sh
as a substep) clean the environment, and fc-cache loses if $HOME is
not defined, because it can't expand ~/.fonts.cache-1.  Not being able
to write that file (or not finding fonts in ~/.fonts) is not fatal, so
this shouldn't be either.

Since fc-cache is being used as a host tool, it should not only not
examine $HOME or look at/modify any files there, but it should also
not look in /etc/fonts.  Perhaps it needs a -nostdinc flag.

In the meantime, this patch (to xsrc) makes fc-cache not exit when
$HOME is not defined.  I just filed a PR but for some reason didn't
get an ack with the PR number.

Index: fccfg.c
===================================================================
RCS file: /NETBSD-CVS/xsrc/xfree/xc/extras/fontconfig/src/fccfg.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- fccfg.c	5 Mar 2004 14:26:13 -0000	1.1.1.1
+++ fccfg.c	29 Jun 2004 18:50:53 -0000	1.2
@@ -314,6 +314,15 @@
 {
     FcChar8    *new = FcStrCopyFilename (c);
     
+    /*
+     * During system builds, HOME might not be set, so expanding
+     * ~/.fonts.cache-1 might fail.  Use /dev/null instead for any
+     * string containing a ~.
+     */
+    if (!new)
+    {
+	new = FcStrCopyFilename ("/dev/null");    
+    }
     if (!new)
 	return FcFalse;
     if (config->cache)


-- 
        Greg Troxel <gdt@ir.bbn.com>