From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by mx.groups.io with SMTP id smtpd.web10.4188.1669069353145036002 for ; Mon, 21 Nov 2022 14:22:33 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QY+qFJQl; spf=pass (domain: gmail.com, ip: 209.85.216.42, mailfrom: pedro.falcato@gmail.com) Received: by mail-pj1-f42.google.com with SMTP id w4-20020a17090ac98400b002186f5d7a4cso11993869pjt.0 for ; Mon, 21 Nov 2022 14:22:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=OLN+HZnEZ2T3VcRQLhso/tGLmqpcAIvTfGBoJxIAPd4=; b=QY+qFJQlcxk08KKuDX4ArDgmodvPskhsJZ6OLnG0ZchaKtI0YYw0awTyx2fWCk39wt CrbyYJIM/Fpg21qsae9wMrvZOSxpsEKgnS43EuPyK2B5+juc81TzEVn9AtrB560PRHEU dVZdIlYs6TsocEicMf+IRp7+feVO2ik+JB2NR+cWlF5yLTosv/U8qio2RfOVvTgs3yYX 6NvbL/SnT84abcg2UcqNEb7yynzQGj+89m48MruommKV56Di1wvFjgc4wvaNU0lLml/V E3koYzP/jtFRLOgBsM9h9v/IT3gJmB5HiBZpIojsScwhpaq9oTYeHUkNUhing/msfu6L P3UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=OLN+HZnEZ2T3VcRQLhso/tGLmqpcAIvTfGBoJxIAPd4=; b=LkYMTDP+HlUjLwd9/d2cvRe9Lt7IRm7KwttvVOcOl2hriaNiEJrh0AocWuLABmJuP+ 2ynLrntiNSwloWNR36sWr0S+bT7Dmj8JelQeUnmvikEwGjVzoLRSRDDv8XR1RexgONZo FgbOA+KbNCQYQ7mNd0VwwuXlPZS6kziw3zKT63NWTj5SCTLzNNQZU2wIkUvwxnc6pKqx ksNVTmhWjz4W/5j2joZUu9BU50zOqofMGxAIMnVw8m3+bWZqtMULfTbrM1EwK/5O/k1J WeZS4cbvbOpi5oBqF/ZnDs7YL/oosn1Id5qdcwM9FuLdIr17up5skop4BqfM74r0BNWp FwvQ== X-Gm-Message-State: ANoB5plLUDQPcdSwYg/EuwlaxFpQBsHp5AIMwCC1DnLtcHgFV4qUBNzR 12+JzLiykoqF6UVoqDfY7l3xEEBWUoo/Mo8Gt6fXDa+FYzKpYA== X-Google-Smtp-Source: AA0mqf455ESoDJb1KiQxLywYi0BfQ6RRAGalPsuh7hYJabjFemv372U5O+LjfsjHBq4fvL5FKIeYGu+BTRr0l1jd6/A= X-Received: by 2002:a17:90a:ea05:b0:20a:a1a8:3719 with SMTP id w5-20020a17090aea0500b0020aa1a83719mr22582559pjy.225.1669069352248; Mon, 21 Nov 2022 14:22:32 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: "Pedro Falcato" Date: Mon, 21 Nov 2022 22:22:21 +0000 Message-ID: Subject: Re: [edk2-devel] edksetup.sh: fix for non POSIX whereis(1) To: devel@edk2.groups.io, tlaronde@polynum.com Content-Type: multipart/alternative; boundary="000000000000d8aabe05ee027d1b" --000000000000d8aabe05ee027d1b Content-Type: text/plain; charset="UTF-8" On Mon, Nov 21, 2022 at 9:21 PM 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 --000000000000d8aabe05ee027d1b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, Nov 21, 2022 at 9:21 PM <tlaronde@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()
=C2=A0 =C2=A0fi
=C2=A0}

+# whereis(1) is not a POSIX utility and, for example, its implementation +# in NetBSD is different form the Linux one.
+#
+function whereis()
+{
+=C2=A0 (
+=C2=A0 =C2=A0 IFS=3D:
+=C2=A0 =C2=A0 for dir in $PATH; do
+=C2=A0 =C2=A0 =C2=A0 eval ls $dir/${1}* 2>/dev/null || true
+=C2=A0 =C2=A0 done
+=C2=A0 )
+}
Hi Thierry,

First of= all, thanks for the patch! I had noticed this problem when running edksetu= p.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 PO= SIX, as which isn't POSIX either, and your solution seems... hacky?
=
=C2=A0
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
--000000000000d8aabe05ee027d1b--