Fix install directory for FVP crypto plugin. #577
Merged
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.
Before this patch, running get_fvps.sh --non-interactive would make a weirdly named directory in the user's home, with a name like "". or "." (depending on circumstances), with the crypto plugins installed in it.
Now --non-interactive installs the plugins under fvp/install in your git checkout of this repository, which is where they should have been.
The problem was because of this construction in get_fvps.sh:
INSTALLER_FLAGS_CRYPTO="... --basepath "$(dirname "$0")""
which has multiple shell errors. Firstly, the " around $0 are taken literally, so dirname is handed a path beginning with a double quote, which propagates into the path it returns. Secondly, the " around $(dirname) are also literal, but not reprocessed when $INSTALLER_FLAGS_CRYPTO is expanded on to the installer command line (because quote processing happens before variable expansion). The net effect is to give setup.bin a --basepath directory containing lots of confusing double quotes. For extra confusion, setup.bin appears to change directory to $HOME before interpreting that path, so you don't even get a strangely named directory under the FVP install directory – it appears in your home dir instead.
Since this script already commits to bash rather than plain POSIX sh, the sensible fix for the quoting issues is to use a bash array variable to accumulate the extra arguments, and expand it via "${INSTALLER_FLAGS_CRYPTO[@]}".
Also, the --basepath will need to be absolute rather than relative, to avoid confusion when setup.bin changes directory to $HOME. The easiest approach to that is to use the fact that we were already issuing a
cd $(dirname "$0")
command to change into the fvp directory: do that earlier, and then we can use$PWD
to retrieve the absolute path.This fixes --non-interactive. But another problem is that if you run setup.bin interactively, you'll have to enter the pathname by hand, and we don't give the user any guidance on what path to enter. So I've also updated the docs to explain the interactive installation more fully.
This is all very error-prone, so I've also extended run_fvp.py so that it actually finds and loads the crypto plugin. That way, if it hasn't been installed in the right place, we find that out early, and can figure out what went wrong.
(Finally, in this commit, I've also fixed a spelling error in one of the script's internal variables: CORSTONE, not CORSONE.)