gnu: webkitgtk: Expose all font locations to the bubblewrap sandbox.
[jackhill/guix/guix.git] / gnu / packages / patches / webkitgtk-bind-all-fonts.patch
1 Add fonts from all XDG_DATA_DIRS, not just XDG_DATA_HOME.
2
3 See <http://bugs.gnu.org/41174>.
4 Author: Leo Prikler <leo.prikler@student.tugraz.at>
5 Index: webkitgtk-2.28.2/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp
6 ===================================================================
7 --- a/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp
8 +++ b/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp
9 @@ -387,6 +387,7 @@ static void bindFonts(Vector<CString>& args)
10 const char* homeDir = g_get_home_dir();
11 const char* dataDir = g_get_user_data_dir();
12 const char* cacheDir = g_get_user_cache_dir();
13 + const char* const * dataDirs = g_get_system_data_dirs();
14
15 // Configs can include custom dirs but then we have to parse them...
16 GUniquePtr<char> fontConfig(g_build_filename(configDir, "fontconfig", nullptr));
17 @@ -403,6 +404,10 @@ static void bindFonts(Vector<CString>& args)
18 bindIfExists(args, fontHomeConfigDir.get());
19 bindIfExists(args, fontData.get());
20 bindIfExists(args, fontHomeData.get());
21 + for (auto dataDir = dataDirs; dataDir != nullptr && *dataDir != nullptr; dataDir++) {
22 + GUniquePtr<char> fontDataDir(g_build_filename(*dataDir, "fonts", nullptr));
23 + bindIfExists(args, fontDataDir.get());
24 + }
25 bindIfExists(args, "/var/cache/fontconfig"); // Used by Debian.
26 }