Skip to content

fix(r): stop R plots emitting a Fontconfig error into the caller's stderr - #2

Merged
zahangirbu merged 1 commit into
bu/mainfrom
fix/r-fontconfig
Dec 1, 2026
Merged

zahangirbu merged 1 commit into
bu/mainfrom
fix/r-fontconfig

Conversation

@zahangirbu

Copy link
Copy Markdown
Collaborator

Every R job that drew text returned "Fontconfig error: Cannot load default config file" alongside its real output.

NsJail mounts /usr but not /etc — api/config/sandbox.cfg has exactly two /etc entries, ld.so.cache and an inline hosts file — so fontconfig cannot reach /etc/fonts/fonts.conf. The fonts themselves were never missing: they live in /usr/share/fonts, which is mounted.

Fixed by carrying fonts.conf into the R tree, which is already mounted, and pointing FONTCONFIG_FILE at it, rather than by adding /etc/fonts to the jail's mount set. Widening what an untrusted-code jail can see is not worth doing for a config file. The copy is self-sufficient: every

it names is under /usr, and its only is conf.d with ignore_missing="yes".

Same shape as the /usr/bin/which fix already in api/Dockerfile.

Cosmetic only. Verified against sandbox-microvm:v1.11.0-6cdfe0c through /api/v2/execute, with and without the change as a control: the warning disappears and rendering is byte-identical — same text metrics, same PNG md5 376cf616d8d64863d3346d9e7559407f. The remaining "Error parsing /proc/self/maps" is pre-existing and unrelated.

build-packages.sh gets the same treatment to keep local builds faithful; its Rscript wrapper was also missing the LD_LIBRARY_PATH export that package-init.sh has had since the launcher fix, so that divergence closes here.

…derr

Every R job that drew text returned "Fontconfig error: Cannot load default
config file" alongside its real output.

NsJail mounts /usr but not /etc — api/config/sandbox.cfg has exactly two /etc
entries, ld.so.cache and an inline hosts file — so fontconfig cannot reach
/etc/fonts/fonts.conf. The fonts themselves were never missing: they live in
/usr/share/fonts, which is mounted.

Fixed by carrying fonts.conf into the R tree, which is already mounted, and
pointing FONTCONFIG_FILE at it, rather than by adding /etc/fonts to the jail's
mount set. Widening what an untrusted-code jail can see is not worth doing for
a config file. The copy is self-sufficient: every <dir> it names is under /usr,
and its only <include> is conf.d with ignore_missing="yes".

Same shape as the /usr/bin/which fix already in api/Dockerfile.

Cosmetic only. Verified against sandbox-microvm:v1.11.0-6cdfe0c through
/api/v2/execute, with and without the change as a control: the warning
disappears and rendering is byte-identical — same text metrics, same PNG md5
376cf616d8d64863d3346d9e7559407f. The remaining "Error parsing /proc/self/maps"
is pre-existing and unrelated.

build-packages.sh gets the same treatment to keep local builds faithful; its
Rscript wrapper was also missing the LD_LIBRARY_PATH export that
package-init.sh has had since the launcher fix, so that divergence closes here.
@zahangirbu
zahangirbu merged commit 6f9a0a2 into bu/main Dec 1, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant