tpm2-tss icon indicating copy to clipboard operation
tpm2-tss copied to clipboard

int-log-compiler-common.sh: Remove dependency on which

Open salahcoronya opened this issue 9 months ago • 2 comments

See https://lwn.net/Articles/874049/

salahcoronya avatar May 03 '24 15:05 salahcoronya

Why use type -P ? The lwn article mentions command -v.

AndreasFuchsTPM avatar May 06 '24 07:05 AndreasFuchsTPM

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.

thesamesam avatar May 06 '24 07:05 thesamesam

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 ?

AndreasFuchsTPM avatar May 08 '24 12:05 AndreasFuchsTPM

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.

SoapGentoo avatar May 08 '24 15:05 SoapGentoo

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.

eli-schwartz avatar May 09 '24 22:05 eli-schwartz