Hello Pedro, Le Mon, Nov 21, 2022 at 10:22:21PM +0000, Pedro Falcato a écrit : > On Mon, Nov 21, 2022 at 9:21 PM <tlaro...@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?
The problem is that which -a does not do what is required by the usage of whereis(1) in the script and what is indeed implemented in Linux whereis(1) (and not in the obsolescent NetBSD whereis(1)): look for "string*". "which -a python" or "which -a 'python*'" will return nothing. This is why I ended up with this solution that uses only POSIX sh(1) features and that is, if I'm not mistaken, an implementation of what is used. Best, -- Thierry Laronde <tlaronde +AT+ polynum +dot+ com> http://www.kergis.com/ http://kertex.kergis.com/ Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96543): https://edk2.groups.io/g/devel/message/96543 Mute This Topic: https://groups.io/mt/95182516/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-