Commit e83305b9 authored by Bastien Nocera's avatar Bastien Nocera

thumbnail: Fix slow thumbnailer due to missing font cache

On some distributions, the font cache doesn't live in /usr but in /var,
which we don't allow access to when sandboxing the thumbnailers. Bind
mount the fontconfig cache directory read-only if it lives outside /usr,
to speed up thumbnailer startup.

Closes: #90
parent 78a29e0e
Pipeline #54658 passed with stage
in 2 minutes and 48 seconds
......@@ -565,6 +565,10 @@ add_bwrap (GPtrArray *array,
}
}
/* fontconfig cache if necessary */
if (!g_str_has_prefix (FONTCONFIG_CACHE_PATH, "/usr/"))
add_args (array, "--ro-bind", FONTCONFIG_CACHE_PATH, FONTCONFIG_CACHE_PATH, NULL);
add_args (array,
"--proc", "/proc",
"--dev", "/dev",
......
......@@ -5,6 +5,7 @@ libargs = [
'-DGNOMELOCALEDIR="@0@"'.format(localedir),
'-DLIBLOCALEDIR="@0@"'.format(liblocaledir),
'-DISO_CODES_PREFIX="@0@"'.format(iso_codes_prefix),
'-DFONTCONFIG_CACHE_PATH="@0@"'.format(fontconfig_cache_path),
'-DXKB_BASE="@0@"'.format(xkb_base)
]
......
......@@ -42,6 +42,7 @@ glib_dep = dependency('glib-2.0', version: glib_req)
gio_dep = dependency('gio-2.0', version: glib_req)
gio_unix_dep = dependency('gio-unix-2.0', version: glib_req)
schemas_dep = dependency('gsettings-desktop-schemas', version: schemas_req)
fontconfig_dep = dependency('fontconfig')
xkb_config_dep = dependency('xkeyboard-config')
iso_codes_dep = dependency('iso-codes')
x_dep = dependency('x11')
......@@ -58,6 +59,7 @@ if supported_os.contains(host_os) and not unsupported_cpus.contains(host_cpu)
else
seccomp_dep = dependency('', required: false)
endif
fontconfig_cache_path = fontconfig_dep.get_pkgconfig_variable('cachedir')
xkb_base = xkb_config_dep.get_pkgconfig_variable('xkb_base')
iso_codes_prefix = iso_codes_dep.get_pkgconfig_variable('prefix')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment