Skip to content
Myr

[Fix] fix same owner for root when install from binary

Before adoption: this commit came in with the history the project adopted, so no landing records it.

GNU Tar has `--preserve-permissions` as a default enabled when executed as the superuser (root). This will cause the binaries to be installed using the permissions (owner and group) as defined in the tarball. The argument `--no-same-owner` prevents this and will install the binaries as the effective owner/group just like when nvm is executed as a non superuser. Updated the install from binary test from the installation_node test suite because this test is run in a docker container as root. Without --no-same-owner this test will fail beause the binaries of node v0.10.7 are owned by isaacs/admin in the tarball.

authored by Dick Marinus · committed by Jordan Harband · parent 3e4b0f0 · Browse files · 2 files+3 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+3 added−1 removed

  • tests:+2 added−0 removed
  • other:+1 added−1 removed

2 files+3 added−1 removed

modified:test/installation_node/install from binary+2 added
15 unmodified lines
1617# Check18[ -d ../../$NVM_TEST_VERSION ]19nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION || die "'nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed"20[ -O "${NVM_DIR}/${NVM_TEST_VERSION}/bin/node" ] || die "Extracted file is not owned by effective user"21[ -G "${NVM_DIR}/${NVM_TEST_VERSION}/bin/node" ] || die "Extracted file is not owned by effective group"2223# ensure default is set24NVM_CURRENT_DEFAULT="$(nvm_alias default)"25[ "$NVM_CURRENT_DEFAULT" = "$NVM_TEST_VERSION" ] || die "wrong default alias: $(nvm alias)"
modified:nvm.sh+1 added-1 removed
2612 unmodified lines
2613 else2614 command "${tar}" -x${tar_compression_flag}f "${TARBALL}" -C "${TMPDIR}" -s '/[^\/]*\///' || return 12615 fi2616 else2617 command "${tar}" -x${tar_compression_flag}f "${TARBALL}" -C "${TMPDIR}" --strip-components 1 || return 12617 command "${tar}" -x${tar_compression_flag}f "${TARBALL}" -C "${TMPDIR}" --strip-components 1 --no-same-owner || return 12618 fi2619}26202621nvm_get_make_jobs() {
2203 unmodified lines