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

Unbound variable error with set -u. #3402

Closed
tomchochola opened this issue Aug 2, 2024 · 0 comments
Closed

Unbound variable error with set -u. #3402

tomchochola opened this issue Aug 2, 2024 · 0 comments
Labels
bugs Oh no, something's broken :-(

Comments

@tomchochola
Copy link

Operating system and version:

nvm debug output:

nvm --version: v0.40.0
$SHELL: /bin/bash
$SHLVL: 1
whoami: 'tom'
${HOME}: /home/tom
${NVM_DIR}: '${HOME}/.nvm'
$PREFIX: ''
${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)'
uname -a: 'Linux 5.15.153.1-microsoft-standard-WSL2 #1 SMP Fri Mar 29 23:14:13 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux'
checksum binary: 'sha256sum'
OS version: Ubuntu 22.04.4 LTS
awk: /usr/bin/awk, GNU Awk 5.1.0, API: 3.0 (GNU MPFR 4.1.0, GNU MP 6.2.1)
curl: /usr/bin/curl, curl 7.81.0 (x86_64-pc-linux-gnu) libcurl/7.81.0 OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.5.18
wget: /usr/bin/wget, GNU Wget 1.21.2 built on linux-gnu.
git: /usr/bin/git, git version 2.34.1
grep: /usr/bin/grep (grep --color=auto), grep (GNU grep) 3.7
sed: /usr/bin/sed, sed (GNU sed) 4.8
cut: /usr/bin/cut, cut (GNU coreutils) 8.32
basename: /usr/bin/basename, basename (GNU coreutils) 8.32
rm: /usr/bin/rm, rm (GNU coreutils) 8.32
mkdir: /usr/bin/mkdir, mkdir (GNU coreutils) 8.32
xargs: /usr/bin/xargs, xargs (GNU findutils) 4.8.0
nvm current: system
which node: /usr/bin/node
which iojs:
which npm: /usr/bin/npm
npm config get prefix: /usr
npm root -g: /usr/lib/node_modules

nvm ls output:

->       system
iojs -> N/A (default)
node -> stable (-> N/A) (default)
unstable -> N/A (default)
lts/* -> lts/iron (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12 (-> N/A)
lts/fermium -> v14.21.3 (-> N/A)
lts/gallium -> v16.20.2 (-> N/A)
lts/hydrogen -> v18.20.4 (-> N/A)
lts/iron -> v20.16.0 (-> N/A)

How did you install nvm?

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash

What steps did you perform?

set -xeuo pipefail
if test -f .nvmrc; then curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash; source "${NVM_DIR}/nvm.sh" --no-use; nvm install; nvm use; fi

What happened?

+++ '[' -z v18 ']'
+++ local keys=
+++ local values=
+++ IFS=
+++ read -r line
+++ '[' -z v18 ']'
+++ '[' -z v18 ']'
+++ case "$line" in
+++ false
/root/.nvm/nvm.sh: line 552: unpaired_line: unbound variable
++ NVM_RC_VERSION=
++ return 1
++ '[' 1 -eq 1 ']'
++ '[' -z '' ']'
++ unset NVM_RC_VERSION
++ nvm --help
++ '[' 1 -lt 1 ']'
++ local DEFAULT_IFS
+++ nvm_echo t
+++ command printf '%s\n' t
+++ command tr t '\t'
++ DEFAULT_IFS=' 	

What did you expect to happen?

With configuration set -u the install script is not working properly. It throws error on unbound variable.

Is there anything in any of your profile files that modifies the PATH?

no

@ljharb ljharb closed this as completed in 01f9ec7 Aug 7, 2024
@ljharb ljharb added the bugs Oh no, something's broken :-( label Aug 7, 2024
ljharb added a commit that referenced this issue Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugs Oh no, something's broken :-(
Projects
None yet
Development

No branches or pull requests

2 participants