From mboxrd@z Thu Jan 1 00:00:00 1970 From: Danny Milosavljevic Subject: font-build-system vs fc-cache profile hook Date: Fri, 12 May 2017 00:19:22 +0200 Message-ID: <20170512001922.1d54fb2b@scratchpost.org> References: <20170205125841.hsywh3xuyoabt4vq@wasp> <20170511201500.xopertmlrwg4pvue@abyayala> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52006) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8wQk-0005bK-NQ for guix-devel@gnu.org; Thu, 11 May 2017 18:19:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d8wQh-0001AU-Jg for guix-devel@gnu.org; Thu, 11 May 2017 18:19:30 -0400 Received: from dd1012.kasserver.com ([85.13.128.8]:39442) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d8wQh-00018f-DV for guix-devel@gnu.org; Thu, 11 May 2017 18:19:27 -0400 In-Reply-To: <20170511201500.xopertmlrwg4pvue@abyayala> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Arun Isaac Cc: guix-devel@gnu.org Hi Arun, Hi ng0, On Thu, 11 May 2017 20:15:00 +0000 ng0 wrote: > I don't think anyone is working on a font-build-system. But this won't > solve the fc-cache problem as the reply by Mark suggests. I agree, it won't. For that, one could merge-install the fonts in a well-known location (that already happens) and then add a profile hook to guix/profiles.scm (%default-profile-hooks). But there's already a "fonts-dir-file" hook there - which was recently extended to actually traverse all the font dirs and invoke mkfontscale, mkfontdir in them. So for fixing the font problem it would first require someone to find out what exactly is missing. What does fc-cache do that mkfontdir and mkfontscale don't? Is it necessary to invoke all three? Then we could just invoke all three in the fonts-dir-file hook (or invoke fc-cache in a new hook?). Note that fc-cache needs to be invoked once per architecture, so it isn't quite as straightforward as it would seem (for example on x86, you'd potentially have to run it once for x86_64 and once for i386 - which means you'd have to find out which architectures are used in the profile). You can pass a list of "interesting" directories as command-line parameters to fc-cache. fc-cache supports both user caches and system caches. You'd have to find out which of those is more appropriate. Probably the system cache? So invoke fc-cache "--system-only" ? Also, can fc-cache handle the Guix timestamp-less directories? If not, it would have to be invoked with "--force" "--really-force" (the latter makes it unlink existing cache files, the former prevents it from trying to load cache files afterwards). Would that be slow? One cache dir is specified when building fontconfig, called FC_CACHEDIR, which can be specified when invoking configure: "--with-cache-dir=DIR" (defaults to LOCALSTATEDIR/cache/fontconfig). The Guix package for fontconfig overrides it to be /var/cache/fontconfig and I have a lot of files in there (I'm a GuixSD user). Not sure whether that's good. Why not put the cache into the profile and have an environment variable point there? Just using "/var" sounds unsafe for non-GuixSD users... what if the foreign operating system has incompatible files there? Also, reproducibility? On the other hand, user cachedirs are in the directory specified by environment variable XDG_CACHE_HOME. Each cache corresponds to a list of font directories - which are found by appending sysroot and an entry in the cache body. If sysroot is not set, just the entry in the cache body is used. I think the former is because the cache filename is a MD5SUM of the font directory name - which can lead to hash collisions. But later on, FcDirCacheUnlink just unlinks the cache of each directory specified (on really-force, for example) - so if you specify just one of the directories that would cause a collision it will silently invalidate the other one too (which you didn't specify). :P What are these cache files caching in the first place? Don't mkfontdir and mkfontscale already cache font family, variant etc? Also, reading the Arch bugtracker, if not running fc-cache, fontconfig is supposed to generate the cache into the user directory automatically when invoking an application that needs fontconfig fonts. Not sure how it can happen for them to be broken... In any case, invoking fc-cache --system-only can't hurt I guess. But first it would be good to strace some application with broken fonts and see what it's trying to open that fails.