fix(build.func): expand glob in SSH key "Scan Folder/Glob" so it can find keys#15873
Merged
tremor021 merged 2 commits intoJul 19, 2026
Merged
Conversation
The advanced SSH key source menu offers "folder — Scan another folder (path or glob)", but the input was split with read -r -a, which performs no pathname expansion (the surrounding shopt -s nullglob has no effect on read). ssh_build_choices_from_files() then ran [[ -f ... ]] against the literal pattern (or the directory itself), so every folder or glob input ended in "No keys found" and the option could never import a key. Expand the pattern with compgen -G instead (same idiom as community-scripts#15841) and treat a directory input as dir/*, so both advertised input forms work. Co-Authored-By: Claude <noreply@anthropic.com>
asylumexp
requested changes
Jul 19, 2026
does the same thing as proposed PR but in less lines
asylumexp
approved these changes
Jul 19, 2026
tremor021
approved these changes
Jul 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
✍️ Description
The advanced-install SSH key menu offers "folder — Scan another folder (path or glob)", but the input is split with:
readperforms no pathname expansion (nullglobhas no effect on it), so_scan_filesholds the literal pattern andssh_build_choices_from_files()runs[[ -f ... ]]against it. Both advertised inputs therefore always fail: a glob like/root/.ssh/*.pubis tested as a literal filename, and a plain folder fails-fbecause it is a directory. The option unconditionally ends in "No keys found" and has never been able to import a key (behavior introduced in #9540).This PR expands the pattern with
compgen -G— the same glob-existence idiom as #15841 — and treats a directory input asdir/*, so both input forms shown in the input box work.Standalone repro (folder containing
one.pub,two backup.pub,known_hosts):shellcheck findings on
misc/build.func: 34 before, 34 after (no new findings);bash -nclean under bash 5.2. Testing scope: verified via the standalone repro (buggy and fixed blocks lifted verbatim) and shellcheck; not run through the full whiptail flow on a live Proxmox host.Disclosure: this fix was prepared with AI assistance (Claude); the bug, repro, and diff were verified by running the shown commands.
🔗 Related Issue
Fixes # (none filed — found via shellcheck-guided audit; behavior introduced in #9540)
✅ Prerequisites (X in brackets)
🛠️ Type of Change (X in brackets)
README,AppName.md,CONTRIBUTING.md, or other docs.