[edk2-devel] edksetup.sh: fix for non POSIX whereis(1)

Pedro Falcato pedro.falcato at gmail.com
Mon Nov 21 22:22:21 UTC 2022


On Mon, Nov 21, 2022 at 9:21 PM <tlaronde at polynum.com> wrote:

> diff --git a/edksetup.sh b/edksetup.sh
> index 06d2f041e6..46b295c430 100755
> --- a/edksetup.sh
> +++ b/edksetup.sh
> @@ -105,6 +105,19 @@ function SetupEnv()
>    fi
>  }
>
> +# whereis(1) is not a POSIX utility and, for example, its implementation
> +# in NetBSD is different form the Linux one.
> +#
> +function whereis()
> +{
> +  (
> +    IFS=:
> +    for dir in $PATH; do
> +      eval ls $dir/${1}* 2>/dev/null || true
> +    done
> +  )
> +}
>
Hi Thierry,

First of all, thanks for the patch! I had noticed this problem when running
edksetup.sh on a POSIX but not quite Linux system before.

I kind of dislike your solution. Does NetBSD ship /bin/which by default? I
think replacing whereis with "which -a" would be a lot better.
I don't think there's a 100% standard way to do this in POSIX, as which
isn't POSIX either, and your solution seems... hacky?

Also, please send patches in the standard git format (git commit -s + git
format-patch + git send-email with the proper CCs to the maintainers, see
the proper guides for more details).

Thanks,
Pedro


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96523): https://edk2.groups.io/g/devel/message/96523
Mute This Topic: https://groups.io/mt/95182516/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/edk2-devel-archive/attachments/20221121/692d5ea1/attachment.htm>


More information about the edk2-devel-archive mailing list