-
-
Notifications
You must be signed in to change notification settings - Fork 15k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fontconfig: Only read versioned config dirs
Falling back to unversioned `/etc/fonts/conf.d` when versioned one does not exist is problematic since it only occurs on non-NixOS systems and those are likely to have a different version of fontconfig. When those versions use incompatible elements in the config, apps using fontconfig will crash. Instead, we are now falling back to the in-package `fonts.conf` file that loads both the versioned global `conf.d` directory and the in-package `conf.d` since using upstream settings on non-NixOS is preferable to not being able to use apps there. In fact, we would not even need to link `fonts.conf`, as the in-package `fonts.conf` will be always used unless someone creates the global one manually (the option is still retained if one wants to write a custom NixOS module and to avoid unnecessary stat call on NixOS). Additionally, since the `fonts.conf` will always load `conf.d` from the package, we no longer need to install them to sytem `/etc` in the module. This needed some mucking with `50-user.conf` which disables configs in user directories (a good thing IMO, NixOS module will turn it back on) but otherwise, it is cleaner. The files are still prioritized by their name, regardless of their location. See #73795 (comment) for more information.
- Loading branch information
Showing
4 changed files
with
39 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
commit 05c6adf8104b4321d3a3716a7b9feb6bf223ed0c (HEAD, nixpkgs) | ||
Author: Vladimír Čunát <[email protected]> | ||
Date: Tue Nov 4 12:24:25 2014 +0100 | ||
From 2ff9b53ce755be183ef9274f7dd3f9ac537173f6 Mon Sep 17 00:00:00 2001 | ||
From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= <[email protected]> | ||
Date: Tue, 4 Nov 2014 12:24:25 +0100 | ||
Subject: [PATCH] add check for /etc/fonts/@configVersion@/fonts.conf | ||
|
||
add check for /etc/fonts/@configVersion@/fonts.conf | ||
|
||
It's checked between FONTCONFIG_FILE and the usual /etc/fonts/fonts.conf. | ||
Also, hardcode /etc/fonts/fonts.conf to prevent accidental override. | ||
It's checked between FONTCONFIG_FILE and the in-package etc/fonts/fonts.conf. | ||
The latter is used so that on non-NixOS distributions, fontconfig works at least | ||
with upstream defaults, even when the global config is incompatible. | ||
|
||
Co-Authored-By: Jan Tojnar <[email protected]> | ||
--- | ||
src/fccfg.c | 7 ++++++- | ||
1 file changed, 6 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/src/fccfg.c b/src/fccfg.c | ||
index 6377fd7..e9eb10a 100644 | ||
index 342c996..98a1324 100644 | ||
--- a/src/fccfg.c | ||
+++ b/src/fccfg.c | ||
@@ -2070,8 +2070,13 @@ FcConfigFilename (const FcChar8 *url) | ||
@@ -2391,8 +2391,13 @@ FcConfigGetFilename (FcConfig *config, | ||
if (!url || !*url) | ||
{ | ||
url = (FcChar8 *) getenv ("FONTCONFIG_FILE"); | ||
|
@@ -22,7 +27,10 @@ index 6377fd7..e9eb10a 100644 | |
+ } | ||
if (!url) | ||
- url = (FcChar8 *) FONTCONFIG_FILE; | ||
+ url = (FcChar8 *) "/etc/fonts/fonts.conf"; | ||
+ url = (FcChar8 *) FONTCONFIG_PATH "/" FONTCONFIG_FILE; | ||
} | ||
file = 0; | ||
|
||
-- | ||
2.26.2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters