Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERL-476: HOME environment variable currently required #4244

Closed
OTP-Maintainer opened this issue Sep 2, 2017 · 5 comments
Closed

ERL-476: HOME environment variable currently required #4244

OTP-Maintainer opened this issue Sep 2, 2017 · 5 comments
Labels

Comments

@OTP-Maintainer
Copy link

Original reporter: okeuday
Affected version: Not Specified
Component: erts
Migrated from: https://bugs.erlang.org/browse/ERL-476


The Erlang VM is currently checking files in the user's home directory, and needs to get the HOME environment variable to do this.  When an Erlang release is ran with some process management like openrc-run, it has a cleaner environment without environment variables like HOME (it isn't using a login shell).  The current situation requires that the HOME environment variable be set, even if it really should not be used, and it seems like the best current approach is to set it as HOME="/" to avoid this problem.

However, it is better if the Erlang VM tolerates the absence of the HOME environment variable and avoids the user home directory checks.  This problem may relate to both the erlexec executable and erl.
@OTP-Maintainer
Copy link
Author

rickard said:

This is not something that we can prioritize in the near future. If you investigate the issue, and submit a solution as a PR we will have a look at it.

@OTP-Maintainer
Copy link
Author

jeromedebretagne said:

One case for which this is an issue is when running Erlang on Android. There is no HOME environment variable defined by the system and in fact the notion of a home directory doesn't even exist on this OS due to its stricter model of sandboxed applications. Even when the -setcookie flag is used, launching an Erlang node will still fail until HOME is manually defined and added, whereas the home directory notion seems to be used mainly to fetch and/or create the $HOME/erlang.cookie file according to the documentation.

Which solution would be recommended, for a PR to be acceptable?

1/ Make the HOME environment variable simply optional, as long as all the other behaviors depending on HOME are also optional (either with a fallback or with an option to be set manually) as it is the case already for the cookie definition with -setcookie?

2/ Define a simple default value as done on Windows, such as the HOME="/" current workaround mentioned by Michael, knowing that it won't necessarily work nor be used anyway in the cases where the environment variable doesn't exist?

3/ Set HOME to the current working directory if the environment variable doesn't exist?

4/ Another approach?

@OTP-Maintainer
Copy link
Author

okeuday said:

I believe the best approach is #1, to make the HOME environment variable use optional.  However, the decision to go that route requires approval from the OTP team.

@OTP-Maintainer
Copy link
Author

jeromedebretagne said:

Hi Rickard, Hi Michael,

For info, I've submitted a PR about this issue here: https://github.com/erlang/otp/pull/2390

@OTP-Maintainer
Copy link
Author

jeromedebretagne said:

This issue is now resolved, the PR I had proposed a few months ago (see the previous comment) has just been merged into master:

[https://github.com/erlang/otp/commit/d1801731a5109fe8d515bc02b41960671d388f29]

I don't seem to have the rights to change the Status though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant