Public bug reported:

fontconfig 2.17.1 drops absolute reject globs whenever the calling process's
working directory is a leading part of the glob. Ubuntu's own
/etc/fonts/conf.d/71-ubuntulegacy.conf (from fonts-ubuntu) rejects the 14
compatibility symlinks in /usr/share/fonts/truetype/ubuntu with absolute
globs, so it stops working for any process started from /, which includes
system services and some sandboxed helpers.

Steps to reproduce on 26.04 with fonts-ubuntu installed:

    cd ~ && fc-list -f '%{file}\n' | grep -c /truetype/ubuntu/
    cd / && fc-list -f '%{file}\n' | grep -c /truetype/ubuntu/
    cd / && fc-match -f '%{file}\n' Ubuntu

Observed on the reporting machine: 82 faces from the home directory, 232
from / (every named instance of the variable fonts listed again under
each compatibility symlink), and fc-match Ubuntu from / returns
/usr/share/fonts/truetype/ubuntu/Ubuntu-B.ttf. The same happens from
/usr, /usr/share/fonts, /usr/share/fonts/truetype and
/usr/share/fonts/truetype/ubuntu. From /var or the home directory the
rule works (82 faces, Ubuntu[wdth,wght].ttf).

Expected: the rule applies whatever the working directory.

Effect: applications started from / see duplicate Ubuntu faces in font
lists. The symlinks point at the same variable fonts, so glyphs are likely
the same; the rule exists to hide the duplicates. The same failure applies
to any user rule in ~/.config/fontconfig/conf.d that rejects files by
absolute path, where the rejected files can render differently (here: a
legacy Roboto release with broken weight metadata came back for processes
started from /).

Cause: upstream commit 8f54cb21 (the fix for upstream issue #442, "Deal with
glob string properly", merged 2025-01-06, first released in 2.16.0, so
2.16.0 through 2.18.3 are affected) strips the current directory name
from the front of every glob in FcConfigGlobAdd(), intending to undo the
prefix that FcStrCopyFilename() adds to relative globs. Absolute globs
lose their leading components whenever the current directory is a lexical
prefix; from /, FcStrCopyFilename(".") is an empty string, so every
absolute glob loses its leading /.

Fix: upstream commit f478a15206a27a130215f13d5cc1edab2ce9e229, "Do not strip
a current directory prefix off an absolute glob" (merge request !563,
2026-08-16), restricts the strip to relative globs. It is on upstream main
and not yet in a release (2.18.3 predates it). Please consider backporting
it to the 26.04 package.

Workaround: write reject globs with a leading wildcard
(*/truetype/ubuntu/Ubuntu-B.ttf), which survives the strip; with that
glob, Ubuntu-B.ttf is no longer listed from / or /usr.

Upstream references:

- https://gitlab.freedesktop.org/fontconfig/fontconfig/-/merge_requests/563
- https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/442

** Affects: fontconfig (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: resolute

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2174627

Title:
  Absolute <rejectfont> globs are ignored when the process runs from /,
  /usr or /usr/share/fonts; please backport upstream f478a152

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/fontconfig/+bug/2174627/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to