From f7280d116e24ccce822313d13f50f3c8d0748b06 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Mon, 16 Nov 2026 15:08:59 -0800 Subject: [PATCH] [Fix] `nvm_echo`: in pdksh and mksh, use `print`, not `/usr/bin/printf` pdksh (OpenBSD's `/bin/sh`) and mksh have no `printf` builtin, so every `nvm_echo` ran `/usr/bin/printf` with its text as an argument, which every local user can read (`ps`, `/proc//cmdline`). That text includes a symlinked `.nvmrc`'s content while it is parsed, so these shells still exposed it after 3a6403f9. --- nvm.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nvm.sh b/nvm.sh index 88360ca6..a1c1b47d 100755 --- a/nvm.sh +++ b/nvm.sh @@ -24,7 +24,13 @@ nvm_echo() { # shellcheck disable=SC3044 builtin printf %s\\n "$*" 2>/dev/null else - command printf %s\\n "$*" 2>/dev/null + case "${KSH_VERSION-}" in + # pdksh and mksh have no `printf` builtin; `/usr/bin/printf` would put the text in its arguments + *'PD KSH'* | *'MIRBSD KSH'* | *'LEGACY KSH'*) + print -r -- "$*" 2>/dev/null + ;; + *) command printf %s\\n "$*" 2>/dev/null ;; + esac fi }