From bb07d2e18a5d62a03a1053cd62d2ff9dc74026de Mon Sep 17 00:00:00 2001 From: Tim Hawes Date: Mon, 3 Aug 2026 20:55:42 -0400 Subject: [PATCH] versions: fix portability regression in --executables Commit 8037f226 introduced the `--executables` fast path using `xargs -r` and `basename -a`. Those options are unavailable on illumos and OpenBSD, breaking `pyenv rehash` on those platforms. Replace the GNU-specific invocation with a Bash 3.2-compatible implementation while preserving the direct executable discovery optimization. --- libexec/pyenv-versions | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libexec/pyenv-versions b/libexec/pyenv-versions index 1466209c..1630503c 100755 --- a/libexec/pyenv-versions +++ b/libexec/pyenv-versions @@ -45,12 +45,10 @@ if [[ -n "$executables" ]]; then # Fast path for rehash: skip filtering and link resolution. # Discover executables directly from the versions directory and # deduplicate their basenames. Use bash 3.2 conventions to keep code portable. - for path in \ - "$versions_dir"/*/bin/* \ - "$versions_dir"/*/envs/*/bin/* - do - printf '%s\n' "${path##*/}" - done | sort -u + paths=( "$versions_dir"/*/bin/* "$versions_dir"/*/envs/*/bin/* ) + if [ "${#paths[@]}" -gt 0 ]; then + printf '%s\n' "${paths[@]##*/}" | sort -u + fi shopt -u dotglob nullglob fi exit 0