tpm2-tss
tpm2-tss copied to clipboard
int-log-compiler-common.sh: Remove dependency on which
See https://lwn.net/Articles/874049/
Why use type -P
?
The lwn article mentions command -v
.
If the file relies on bash already, type -P
is mildly superior as it will ignore functions defined in the user's environment. I haven't checked if that's the case here.
Given the comment in https://github.com/tpm2-software/tpm2-tss/pull/2830 I'd prefer command -v
to have as few bash-specifics as possible in favor of posix.
Could you update the PR for me to merge ?
also, I think there's one more use of which: https://github.com/tpm2-software/tpm2-tss/blob/master/.ci/coverity.run#L62
Whilst this isn't needed for the build on our side, I think I'd be a good idea to get rid of all which
invocations, since distros might remove it in future.
Given the comment in #2830 I'd prefer
command -v
to have as few bash-specifics as possible in favor of posix. Could you update the PR for me to merge ?
I'm not attached to the use of type -P or bash, but just as a devil's advocate I would like to point out that you can have a policy that your tests use bash, and that's a project choice.
configure.ac has to be written in POSIX sh because the autotools don't let you choose the script interpreter shebang for your ./configure script -- it is always /bin/sh, never bash.