summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-libs/glib/files/glib-2.30.1-homedir-env.patch')
-rw-r--r--dev-libs/glib/files/glib-2.30.1-homedir-env.patch61
1 files changed, 61 insertions, 0 deletions
diff --git a/dev-libs/glib/files/glib-2.30.1-homedir-env.patch b/dev-libs/glib/files/glib-2.30.1-homedir-env.patch
new file mode 100644
index 000000000000..30d44997c591
--- /dev/null
+++ b/dev-libs/glib/files/glib-2.30.1-homedir-env.patch
@@ -0,0 +1,61 @@
+Description: Handle the G_HOME environment variable to override the passwd entry
+ This will allow to fix various kinds of build failures due to restricted
+ build environments.
+Author: Josselin Mouette <joss@debian.org>
+Origin: vendor
+
+--- a/docs/reference/glib/running.sgml
++++ b/docs/reference/glib/running.sgml
+@@ -213,6 +213,22 @@
+ </para>
+ </formalpara>
+
++<formalpara id="G_HOME">
++ <title><envar>G_HOME</envar></title>
++
++ <para>
++ For various reasons, GLib applications ignore the <envar>HOME</envar>
++ environment variable on Unix systems and will use the user directory
++ as specified by the <filename>passwd</filename> entry, which is more
++ reliable.
++ </para>
++ <para>
++ The <envar>G_HOME</envar> environment variable will override any
++ other setting for the home directory. It is not meant for daily usage,
++ but it is useful in testing or building environments.
++ </para>
++</formalpara>
++
+ </refsect2>
+
+ <refsect2 id="setlocale">
+--- a/glib/gutils.c
++++ b/glib/gutils.c
+@@ -1626,11 +1626,14 @@
+ }
+ #endif /* !G_OS_WIN32 */
+
++ g_home_dir = g_strdup (g_getenv ("G_HOME"));
++
+ #ifdef G_OS_WIN32
+ /* We check $HOME first for Win32, though it is a last resort for Unix
+ * where we prefer the results of getpwuid().
+ */
+- g_home_dir = g_strdup (g_getenv ("HOME"));
++ if (!g_home_dir)
++ g_home_dir = g_strdup (g_getenv ("HOME"));
+
+ /* Only believe HOME if it is an absolute path and exists */
+ if (g_home_dir)
+@@ -1926,6 +1929,11 @@
+ * homedir = g_get_home_dir (<!-- -->);
+ * ]|
+ *
++ * However, to allow changing this value for testing and development
++ * purposes, the value of the <envar>G_HOME</envar> environment
++ * variable, if set, will override the <filename>passwd</filename>
++ * entry.
++ *
+ * Returns: the current user's home directory
+ */
+ G_CONST_RETURN gchar*