Re: git: 83bf6ab56829 - main - uname: switch machine to HW_MACHINE_ARCH

From: Warner Losh <imp_at_bsdimp.com>
Date: Sun, 11 Dec 2022 14:57:12 UTC
On Sun, Dec 11, 2022 at 7:37 AM Cy Schubert <Cy.Schubert@cschubert.com>
wrote:

> In message <202212111208.2BBC835O095410@gitrepo.freebsd.org>, Piotr Kubaj
> write
> s:
> > The branch main has been updated by pkubaj (ports committer):
> >
> > URL:
> https://cgit.FreeBSD.org/src/commit/?id=83bf6ab568293e325f437342cdb87a62
> > 6353e27c
> >
> > commit 83bf6ab568293e325f437342cdb87a626353e27c
> > Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
> > AuthorDate: 2022-12-11 03:01:44 +0000
> > Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
> > CommitDate: 2022-12-11 12:05:39 +0000
> >
> >     uname: switch machine to HW_MACHINE_ARCH
> >
> >     On powerpc64, powerpc64le and riscv64 some software wrongly assumes
> that
> >     it runs on powerpc or riscv (32-bit).
> >
> >     Differential revision:  https://reviews.freebsd.org/D35962
> >     Approved by:    alfredo, imp
> > ---
> >  lib/libc/gen/__xuname.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/lib/libc/gen/__xuname.c b/lib/libc/gen/__xuname.c
> > index fba5eaeebc88..bd328d4f880f 100644
> > --- a/lib/libc/gen/__xuname.c
> > +++ b/lib/libc/gen/__xuname.c
> > @@ -127,11 +127,11 @@ __xuname(int namesize, void *namebuf)
> >       }
> >       q += namesize;
> >
> > -     if ((p = getenv("UNAME_m")))
> > +     if ((p = getenv("UNAME_p")))
> >               strlcpy(q, p, namesize);
> >       else {
> >               mib[0] = CTL_HW;
> > -             mib[1] = HW_MACHINE;
> > +             mib[1] = HW_MACHINE_ARCH;
> >               len = namesize;
> >               oerrno = errno;
> >               if (sysctl(mib, 2, q, &len, NULL, 0) == -1) {
> >
>
> This probably needs to go into RELNOTES at some point. Though small it's
> significant enough to document.
>

It's also only for uname(3), not uname(1).

Warner