NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

toolchain/54100: _HOST_ARCH on NetBSD/amd64 returns 'uname -m' not 'uname -p'



>Number:         54100
>Category:       toolchain
>Synopsis:       _HOST_ARCH on NetBSD/amd64 returns 'uname -m' not 'uname -p'
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 05 11:10:00 +0000 2019
>Originator:     Izumi Tsutsui
>Release:        NetBSD 8.0
>Organization:
>Environment:
System: NetBSD optiplex 8.0 NetBSD 8.0 (GENERIC) #0: Tue Jul 17 14:59:51 UTC 2018  mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
In <bsd.host.mk> ${_HOST_ARCH} for ${TOOLDIR} is
defined as the following:

---

.if !defined(HOST_OSTYPE)
_HOST_OSNAME!=	uname -s
_HOST_OSREL!=	uname -r
# For _HOST_ARCH, if uname -p fails, or prints "unknown", or prints
# something that does not look like an identifier, then use uname -m.
_HOST_ARCH!=	uname -p 2>/dev/null
_HOST_ARCH:=	${HOST_ARCH:tW:C/.*[^-_A-Za-z0-9].*//:S/unknown//}
.if empty(_HOST_ARCH)
_HOST_ARCH!=	uname -m
.endif
HOST_OSTYPE:=	${_HOST_OSNAME}-${_HOST_OSREL:C/\([^\)]*\)//g:[*]:C/ /_/g}-${_HOST_ARCH:C/\([^\)]*\)//g:[*]:C/ /_/g}
.MAKEOVERRIDES+= HOST_OSTYPE
.endif # !defined(HOST_OSTYPE)

---

So ${_HOST_ARCH} on NetBSD/amd64 should be "x86_64" as uname -p returns.
However on the NetBSD/amd64 host it returns "amd64".

>How-To-Repeat:

% uname -a
NetBSD optiplex 8.0 NetBSD 8.0 (GENERIC) #0: Tue Jul 17 14:59:51 UTC 2018  mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/amd64/compile/GENERIC amd64
% uname -p
x86_64
% uname -m
amd64
% cat Makefile 
.include <bsd.own.mk>

all:
        @echo _HOST_ARCH is ${_HOST_ARCH}
        @echo TOOLDIR is ${TOOLDIR}

% env USETOOLS=yes make all
_HOST_ARCH is amd64
TOOLDIR is /tooldir.NetBSD-8.0-amd64
% 


>Fix:

Something wrong (triggered by underscore?) in the following definition?
> _HOST_ARCH:=    ${HOST_ARCH:tW:C/.*[^-_A-Za-z0-9].*//:S/unknown//}

---
Izumi Tsutsui



Home | Main Index | Thread Index | Old Index