From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by mx.groups.io with SMTP id smtpd.web11.24016.1669134152521021413 for ; Tue, 22 Nov 2022 08:22:32 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GYh5lXxQ; spf=pass (domain: gmail.com, ip: 209.85.214.174, mailfrom: pedro.falcato@gmail.com) Received: by mail-pl1-f174.google.com with SMTP id p12so14138243plq.4 for ; Tue, 22 Nov 2022 08:22:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=j/YBkKxmmt9xxNsQnj7Lm7LiX20DF5Or2sjh9gJ+DG0=; b=GYh5lXxQoGIdAbLLdqteo/HiZx/rpPY8ml5THz9p89tk607tChOhGs7vv0gdPCc+NG bSkLYHZfQi/7EDC/MKRrWsxVBvZmrCNwy51t4thFWQnox5BpzLhaJiKNj0B2/zNy5Sfm kT4p+2ImCvUNUtV/foTlUJ0G3nAIx2wFswQbn+DINbo+6KE6k2RVfzOIQc+y0cZarHqw v7r1PJEt+FMOsyWgB6TI32m9VXPviQ1U3i29xYK37xV8OLMsLDZJIDEbnd8wC91sMOaS YsLQ0pdzH8RXRSopxP10l11sDmdwSjqq3j0AGMZPvMO2jgRJaaSyOqcy1uQ6j7gpYR6K D+Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc: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=j/YBkKxmmt9xxNsQnj7Lm7LiX20DF5Or2sjh9gJ+DG0=; b=lvezy+3aiaS4um6MWISjQmrzpRuMq7P1aKqBzdZ7Wv9lRIv1IjiK+w6ZYVf+KrrBzN OexlxmMYA2UWVh5HdDUKxXOzPCj6Ud/HNzzXzLFXhCHCsBsf6PuXo1ZKc+KnpfE11p/v cApMiih+h8kC2Wyj8v8gYHepWnZLIt67KzqeATI283IxdD9npZDWL1uljh2Sm2VAcjmj Nk3zmuIG2g0W5rUSY+lXOT7rfYoTb6mukgCIdP7UfHvKPaq4GUUxUA7DqGpJow/k477a ZzZ/3KSrJD0mHU/Pn4vEL6yzQJWKFwfzPwm+Jz93XiTVOCHfFUEsGZh8kZK7Qzasw9Vy /tLg== X-Gm-Message-State: ANoB5pnDpZRYRNNKIiwwvuK1Q3y6CdIhnx1AzgkFCsN7e2hnDOBsfe6R 0Zt+3lTE2wJVaPqicuyw5yzI8oXBMwqH7nSjZXI= X-Google-Smtp-Source: AA0mqf4GqkV8zbTI62CHr7oUXU+FjseSaAmlF049sSXvUnRF4euxgZMd3BOjqy7rBf1BgUw25ny8bYJ1U0PIgL3SDZw= X-Received: by 2002:a17:90a:ea05:b0:20a:a1a8:3719 with SMTP id w5-20020a17090aea0500b0020aa1a83719mr26449783pjy.225.1669134151902; Tue, 22 Nov 2022 08:22:31 -0800 (PST) MIME-Version: 1.0 References: <0bb285e2-ca66-f78a-7da9-ffd13473b61a@quicinc.com> In-Reply-To: <0bb285e2-ca66-f78a-7da9-ffd13473b61a@quicinc.com> From: "Pedro Falcato" Date: Tue, 22 Nov 2022 16:22:20 +0000 Message-ID: Subject: Re: [edk2-devel] edksetup.sh: fix for non POSIX whereis(1) To: Rebecca Cran Cc: devel@edk2.groups.io, tlaronde@polynum.com Content-Type: multipart/alternative; boundary="00000000000034ec0a05ee1194da" --00000000000034ec0a05ee1194da Content-Type: text/plain; charset="UTF-8" On Tue, Nov 22, 2022 at 3:40 PM Rebecca Cran wrote: > On 11/21/22 15:22, Pedro Falcato wrote: > > > 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? > > > "command" seems to be the POSIX way to do this? > https://pubs.opengroup.org/onlinepubs/9699919799/ > > Though "whereis python3" shows the following on my system: > > python3: /usr/bin/python3.9-config /usr/bin/python3.9 /usr/bin/python3 > /usr/lib/python3.9 /usr/lib/python3 /etc/python3.9 /etc/python3 > /usr/local/lib/python3.9 /usr/include/python3.9 /usr/share/python3 > /usr/share/man/man1/python3.1.gz > > "which -a python3" returns: > > /usr/bin/python3 > /bin/python3 > > And "command -p -v" returns: > > /bin/python3 > > I don't know if we need all the results from "whereis"? > > -- > Rebecca Cran > I guess we could just use /bin/python3 (as in command -v python3) and readlink to find the actual version? In my local system "command -v python3" returns /usr/bin/python3 "readlink /usr/bin/python3" returns python3.10, which we could promptly parse into a version? I don't know how portable this is, but it's an idea. I definitely don't see the reason to iterate through every possible python3* in PATH. Pedro --00000000000034ec0a05ee1194da Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Tue, Nov 22, 2022 at 3:40 PM Rebecca C= ran <quic_rcran@quicinc.com> wrote:

--00000000000034ec0a05ee1194da--