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

Setting HOME env variable when unset due to downstream failures [JIRA: TOOLS-138] #185

Merged
merged 1 commit into from
Sep 28, 2015

Conversation

drewkerrigan
Copy link
Contributor

Related issue here: basho/cuttlefish#193

"erlexec requires the HOME variable to be set.

sargun@ubuntu:/tmp/mesos/slaves/20150712-141616-35725601-5050-4054-S0/frameworks/riak-mesos-go3/executors/test-cluster-c16260e2-21d0-44f3-9139-59b3b0a05948-2465/runs/latest$ unset HOME
sargun@ubuntu:/tmp/mesos/slaves/20150712-141616-35725601-5050-4054-S0/frameworks/riak-mesos-go3/executors/test-cluster-c16260e2-21d0-44f3-9139-59b3b0a05948-2465/runs/latest/riak/bin$ ./riak config generate -l debug
erlexec: HOME must be set

The way that this manifests itself during normal Riak startups, if $HOME isn't set:

=====
===== LOGGING STARTED Sun Jul 12 14:36:54 PDT 2015
=====
erlexec: HOME must be set
Error generating config with cuttlefish
  run `riak config generate -l debug` for more information.

Can we automatically set $HOME, if it's not set already?"

I've addressed this with the following addition to env.sh:

# erlexec requires HOME to be set. The username needs to be a
# unquoted literal because of the tilde expansion, hence the
# usage of eval.
if [ -z "$HOME" ]; then
    export HOME=`eval echo "~$WHOAMI"`
fi

@jonmeredith
Copy link

Silly shells.

Would you mind using 'id -un' instead of whoami as I'm not sure whoami is IEEE1003.2/POSIX.2 (but don't have a copy of it handy to be sure).

@randysecrist
Copy link

@jonmeredith looks like WHOAMI is used in a few spots. Are you thinking about comprehensive change, or just for the localized to the HOME var?

@macintux
Copy link
Contributor

POSIX.2 is reportedly very similar to the Single UNIX Specification, where it appears who am i is specified but whoami is not.

http://pubs.opengroup.org/onlinepubs/007908799/

@jonmeredith
Copy link

Haha, teach me to look at just the diff and put my foot in it. If we're using whoami in other places successfully on our platforms I'm less concerned. Ideally we'd standardize on SUS/POSIX.2 commands.

@sargun
Copy link
Contributor

sargun commented Jul 13, 2015

Just curious, do we write to $HOME, anywhere in the code?

@drewkerrigan
Copy link
Contributor Author

@jonmeredith whoami has been used for quite some time in this script. I agree it should probably be changed to id -un, but perhaps for another PR, like this one: #186 :-)

@sargun I wasn't able to find any other places writing to the HOME env variable in the release code for Riak anyway, nor did I find anything reading from it. I think erlexec is the primary piece that requires it, which is used in a few of the scripts generated by this repo and rebar.

@DSomogyi
Copy link

DSomogyi commented Aug 7, 2015

create jira issue

@Basho-JIRA Basho-JIRA changed the title Setting HOME env variable when unset due to downstream failures Review submitted PR [JIRA: TOOLS-138] Aug 7, 2015
@Basho-JIRA
Copy link

Can this be prioritized in the next set of DevOps work?

_[posted via JIRA by Derek Somogyi]_

davidx added a commit that referenced this pull request Sep 28, 2015
Review submitted PR [JIRA: TOOLS-138]
@davidx davidx merged commit 0955b70 into develop Sep 28, 2015
@kuenishi kuenishi changed the title Review submitted PR [JIRA: TOOLS-138] Setting HOME env variable when unset due to downstream failures [JIRA: TOOLS-138] Sep 28, 2015
@Basho-JIRA
Copy link

this is merged [where is the close ticket button?]

_[posted via JIRA by David Andersen]_

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

Successfully merging this pull request may close these issues.

9 participants