Skip to content

Fix "command not found: -e" from unset tool path variables - #549

Open
danish-a1 wants to merge 1 commit into
moovweb:masterfrom
danish-a1:fix/548-unset-tool-paths
Open

Fix "command not found: -e" from unset tool path variables#549
danish-a1 wants to merge 1 commit into
moovweb:masterfrom
danish-a1:fix/548-unset-tool-paths

Conversation

@danish-a1

Copy link
Copy Markdown

scripts/function/tools defines LS_PATH, TR_PATH, SED_PATH, GREP_PATH, EGREP_PATH, SORT_PATH, HEAD_PATH and HEXDUMP_PATH, and is loaded only by scripts/functions. scripts/env/use and scripts/env/pkgset-use never sourced that file, so on those code paths every variable expanded empty and each command lost its argv[0] -- "gvm use" printed a flood of "gvm_pseudohash_encode:25: command not found: -e" (zsh attributes the error to the enclosing case statement, hence the misleading line number).

Source scripts/functions from both env scripts, which also fixes the bare $LS_PATH / $SORT_PATH / $GREP_PATH / $HEAD_PATH pipelines in their fuzzy version matching.

scripts/templates/binary sourced "$GVM_ROOT/scripts/functions/tools", a path that does not exist -- the directory is scripts/function, singular. Generated binary wrappers always ran with an empty $GREP_PATH. Corrected.

Add ${VAR:-tool} fallbacks in _bash_pseudo_hash, gvm_export_path and gvm_environment_sanitize so the files documented as standalone-sourceable keep working when tools has not been loaded.

Bump VERSION to 1.0.23 and document installing from source (SRC_REPO, branch argument, local clone) in the README.

Fixes #548

scripts/function/tools defines LS_PATH, TR_PATH, SED_PATH, GREP_PATH,
EGREP_PATH, SORT_PATH, HEAD_PATH and HEXDUMP_PATH, and is loaded only by
scripts/functions. scripts/env/use and scripts/env/pkgset-use never sourced
that file, so on those code paths every variable expanded empty and each
command lost its argv[0] -- "gvm use" printed a flood of
"gvm_pseudohash_encode:25: command not found: -e" (zsh attributes the error
to the enclosing case statement, hence the misleading line number).

Source scripts/functions from both env scripts, which also fixes the bare
$LS_PATH / $SORT_PATH / $GREP_PATH / $HEAD_PATH pipelines in their fuzzy
version matching.

scripts/templates/binary sourced "$GVM_ROOT/scripts/functions/tools", a path
that does not exist -- the directory is scripts/function, singular. Generated
binary wrappers always ran with an empty $GREP_PATH. Corrected.

Add ${VAR:-tool} fallbacks in _bash_pseudo_hash, gvm_export_path and
gvm_environment_sanitize so the files documented as standalone-sourceable keep
working when tools has not been loaded.

Bump VERSION to 1.0.23 and document installing from source (SRC_REPO, branch
argument, local clone) in the README.

Fixes moovweb#548
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.

gvm use fails with "command not found: -e": scripts/env/use never sources scripts/functions, leaving $HEXDUMP_PATH and friends empty

1 participant