Skip to content

fix: quote path when detecting min-required versions - #540

Open
vulragrag-star wants to merge 1 commit into
tfutils:masterfrom
vulragrag-star:fix/537-min-required-spaces-in-path
Open

vulragrag-star wants to merge 1 commit into
tfutils:masterfrom
vulragrag-star:fix/537-min-required-spaces-in-path

Conversation

@vulragrag-star

Copy link
Copy Markdown

Description

tfenv install min-required (and tfenv min-required / resolve-version) fails when the working directory path contains spaces (e.g. ~/My Drive/project).

bin/tfenv exports TFENV_DIR="${PWD}" before dispatching. In lib/tfenv-min-required.sh, ${path} was unquoted in the {*.tf,*.tf.json} globs, so bash word-split the path, no files were read, and version resolution came back empty.

This quotes "${path}" in both globs so spaced directories resolve correctly.

Issue Link

Closes #537

Testing

  • Reproduced on master: tfenv min-required in a directory whose path contains spaces → error / empty version
  • Same tree after this change → detects 1.6.0 and tfenv-resolve-version min-required1.6.0:^1.6.0$
  • Normal (no-space) path still detects min-required
  • New regression coverage in test/test_use_minrequired.sh (spaces path; no network install required for that case)
  • Full ./test/run.sh not run here (other cases need Terraform downloads)

Platform tested: Linux (box)

Quality Checklist

  • Shell quoting verified — path quoted around brace globs
  • Cross-platform considered — quoting/{} globs unchanged otherwise
  • No unintended changes to other commands
  • README.md updated (if user-facing change) — n/a
  • CHANGELOG.md updated (if notable change) — recommend a brief Fixed entry under the next release

Unquoted ${path}/{*.tf,*.tf.json} word-splits when TFENV_DIR or the
working directory contains spaces, so min-required resolution finds no
files and install/resolve fails. Quote the path in both globs and add a
regression test.
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

Successfully merging this pull request may close these issues.

tfenv install min-required fails silently when working directory path contains spaces

1 participant