Subject: xsrc/26127: build.sh -x fails if HOME is not set due to fc-cache
To: None <gnats-bugs@gnats.netbsd.org>
From: None <gdt@ir.bbn.com>
List: netbsd-bugs
Date: 06/30/2004 10:07:04
>Number: 26127
>Category: xsrc
>Synopsis: build.sh -x fails if HOME is not set due to fc-cache
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: xsrc-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Jun 30 14:31:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator: Greg Troxel
>Release: NetBSD 2.0_BETA
>Organization:
Greg Troxel <gdt@ir.bbn.com>
>Environment:
System: NetBSD 2.0_BETA
Architecture: i386
Machine: i386
>Description:
When running build.sh -x, fc-cache is built as a host tool, and used
to generate font caches in DESTDIR. If one has stripped the
environment, and in particular removed HOME, then fc-cache fails to
expand a cache file in ~ and exits with an error.
Since fc-cache is being used as a host tool, it should not only not
look in the user's homedir but also not look in /etc/fonts for config
files.
>How-To-Repeat:
Remove HOME from the environment and run a full build with -x.
>Fix:
The right fix arguably involves adding a flag (or conditional
compilation) to put fc-cache in a "host tool mode", avoiding looking
in $HOME and in /etc/fonts.
The following makes failure to expand files in ~ a soft error (which
the later failure to open them already was).
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)
>Release-Note:
>Audit-Trail:
>Unformatted: