File 0897-erts-Make-the-HOME-environment-variable-optional-in-.patch of Package erlang
From a4dfa8d090d7997922fc895951c27b408dd44373 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20de=20Bretagne?=
<jerome.debretagne@gmail.com>
Date: Fri, 1 Nov 2019 14:54:01 +0100
Subject: [PATCH 1/3] erts: Make the HOME environment variable optional in
erlexec
Stop the assumption that every operating system or setup has a HOME
directory available (or a similar notion) with a corresponding
environment variable set. This assumption is not always accurate as
raised in ERL-476, for example on Android with its stricter model of
sandboxed applications.
---
erts/etc/common/erlexec.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/erts/etc/common/erlexec.c b/erts/etc/common/erlexec.c
index 07a66993de..9195441ae4 100644
--- a/erts/etc/common/erlexec.c
+++ b/erts/etc/common/erlexec.c
@@ -267,7 +267,7 @@ static WCHAR *latin1_to_utf16(char *str);
#endif
/*
- * Needed parameters to be fetched from the environment (Unix)
+ * Parameters to be fetched from the environment (Unix)
* or the ini file (Win32).
*/
@@ -275,7 +275,7 @@ static char* bindir; /* Location of executables. */
static char* rootdir; /* Root location of Erlang installation. */
static char* emu; /* Emulator to run. */
static char* progname; /* Name of this program. */
-static char* home; /* Path of user's home directory. */
+static char* home; /* Path of user's home directory, if any. */
static void
set_env(char *key, char *value)
@@ -600,7 +600,12 @@ int main(int argc, char **argv)
i = 1;
get_home();
- add_args("-home", home, NULL);
+ /* Add the home parameter when available. This is optional to support
+ systems that don't have the notion of a home directory and setups
+ that don't have the HOME environment variable set (ERL-476). */
+ if (home != NULL) {
+ add_args("-home", home, NULL);
+ }
add_epmd_port();
@@ -1642,8 +1647,6 @@ static void
get_home(void)
{
home = get_env("HOME");
- if (home == NULL)
- error("HOME must be set");
}
#endif
--
2.16.4