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

cd "$ROOTDIR" before any erl subscript runs in extended_bin #876

Open
kubantsev opened this issue Jul 8, 2021 · 2 comments
Open

cd "$ROOTDIR" before any erl subscript runs in extended_bin #876

kubantsev opened this issue Jul 8, 2021 · 2 comments

Comments

@kubantsev
Copy link

When using -sname node0 without hostname in vm.args and run relbin under sudo,
script's fun relx_get_nodename fails with inconsistent CWD:

[user@host] ~ » sudo -H -u test /opt/vendor/product/bin/relbin ping
…
+ NAME=node0@#{label=>{erl_prim_loader,file_error},report=>"File operation error: eacces. Target: .. Function: read_file_info. Process: code_server."}
#{label=>{erl_prim_loader,file_error},report=>"File operation error: eacces. Target: ./maps.beam. Function: get_file. Process: code_server."}
#{label=>{erl_prim_loader,file_error},report=>"File operation error: eacces. Target: ./inet_db.beam. Function: get_file. Process: code_server."}
#{label=>{erl_prim_loader,file_error},report=>"File operation error: eacces. Target: ./inet_config.beam. Function: get_file. Process: code_server."}
#{label=>{erl_prim_loader,file_error},report=>"File operation error: eacces. Target: ./inet_udp.beam. Function: get_file. Process: code_server."}
#{label=>{erl_prim_loader,file_error},report=>"File operation error: eacces. Target: ./inet.beam. Function: get_file. Process: code_server."}
…

line 700:

# User can specify an sname without @hostname
# This will fail when creating remote shell
# So here we check for @ and add @hostname if missing
case "${NAME}" in
    *@*) ;;                             # Nothing to do
    *)   NAME=${NAME}@$(relx_get_nodename);;  # Add @hostname
esac

# Export the variable so that it's available in the 'eval' calls
export NAME

# create a variable of just the hostname part of the nodename
RELX_HOSTNAME=$(echo "${NAME}" | cut -d'@' -f2)

test -z "$PIPE_DIR" && PIPE_BASE_DIR='/tmp/erl_pipes/'
PIPE_DIR="${PIPE_DIR:-/tmp/erl_pipes/$NAME/}"

cd "$ROOTDIR"
@tsloughter
Copy link
Member

Why do you say it is an inconsistent cwd?

If I'm reading the output right it seems there is a bug in the script, it is not properly exit'ing when relx_get_nodename fails, but instead setting the nodename to be the error message?

But the other issue looks like it can't read the beam files? You are trying to run the release as root?

@tsloughter
Copy link
Member

Oh, you are trying to run as user test. Does test have permission to read the beam files?

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

No branches or pull requests

2 participants