From 6354fc38b80bf4324a039f63e322b0dbc763fd0a Mon Sep 17 00:00:00 2001 From: Akira TAGOH Date: Sep 11 2019 12:23:42 +0000 Subject: Fix the issue config can't be turned on when no user config dir is available. Resolves: rhbz#1750732 --- diff --git a/libeasyfc-fix-config.patch b/libeasyfc-fix-config.patch new file mode 100644 index 0000000..c973e26 --- /dev/null +++ b/libeasyfc-fix-config.patch @@ -0,0 +1,70 @@ +From 0729d8db8db8e6d237b33c454b90dbfc9337abf1 Mon Sep 17 00:00:00 2001 +From: Akira TAGOH +Date: Wed, 11 Sep 2019 12:16:03 +0000 +Subject: [PATCH] Fix an issue that config can't be turned on when config dir + isn't available + +https://bugzilla.redhat.com/show_bug.cgi?id=1750732 +--- + libeasyfc/ezfc-font-config.c | 38 ++++++++++++++++++++++++++++++++++++ + 1 file changed, 38 insertions(+) + +diff --git a/libeasyfc/ezfc-font-config.c b/libeasyfc/ezfc-font-config.c +index 9c8c0a0..bf163a9 100644 +--- a/libeasyfc/ezfc-font-config.c ++++ b/libeasyfc/ezfc-font-config.c +@@ -28,6 +28,7 @@ + #include + #include + #include "ezfc-font-config-private.h" ++#include "ezfc-error.h" + + /** + * SECTION: ezfc-font-config +@@ -256,6 +257,43 @@ ezfc_font_config_set_enable(ezfc_font_config_t *info, + break; + } + } ++ if (ll == NULL) { ++ const gchar *xdgcfgdir = g_get_user_config_dir(); ++ gchar *fcconfdir = g_build_filename(xdgcfgdir, "fontconfig", "conf.d", NULL); ++ ++ if (!g_file_test(fcconfdir, G_FILE_TEST_EXISTS)) { ++ g_mkdir_with_parents(fcconfdir, 0755); ++ } else { ++ if (!g_file_test(fcconfdir, G_FILE_TEST_IS_DIR)) { ++ g_set_error(error, EZFC_ERROR, EZFC_ERR_NO_CONFIG_DIR, ++ "Unable to create a config dir: %s", ++ fcconfdir); ++ retval = FALSE; ++ goto bail; ++ } ++ } ++ if (g_access(fcconfdir, W_OK) == 0) { ++ gchar *fn = g_path_get_basename(priv->name); ++ gchar *lfn = g_build_filename(fcconfdir, fn, NULL); ++ ++ if (symlink(priv->name, lfn) == -1) { ++ if (error) { ++ save_errno = errno; ++ g_set_error(error, G_FILE_ERROR, ++ g_file_error_from_errno(save_errno), ++ "%s", g_strerror(save_errno)); ++ } ++ } else { ++ g_free(priv->name); ++ priv->name = g_strdup(lfn); ++ priv->is_enabled = TRUE; ++ retval = TRUE; ++ } ++ g_free(fn); ++ g_free(lfn); ++ } ++ } ++ bail: + g_list_free(l); + } else { + if (g_file_test(priv->name, G_FILE_TEST_IS_SYMLINK)) { +-- +2.21.0 + diff --git a/libeasyfc.spec b/libeasyfc.spec index 032bc9a..7e643d8 100644 --- a/libeasyfc.spec +++ b/libeasyfc.spec @@ -1,12 +1,13 @@ Name: libeasyfc Version: 0.14.0 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Easy configuration generator interface for fontconfig License: LGPLv3+ URL: http://tagoh.bitbucket.org/libeasyfc/ Source0: https://bitbucket.org/tagoh/libeasyfc/downloads/%{name}-%{version}.tar.bz2 Patch0: %{name}-freetype.patch +Patch1: %{name}-fix-config.patch BuildRequires: glib2-devel gobject-introspection-devel libxml2-devel fontconfig-devel >= 2.12.93 harfbuzz-devel BuildRequires: gettext @@ -93,6 +94,10 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/*.la %{_datadir}/gir-*/Easyfc-*.gir %changelog +* Wed Sep 11 2019 Akira TAGOH - 0.14.0-6 +- Fix the issue config can't be turned on when no user config dir is available. + Resolves: rhbz#1750732 + * Thu Jul 25 2019 Fedora Release Engineering - 0.14.0-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild