NetBSD Problem Report #53880

From www@NetBSD.org  Wed Jan 16 04:12:28 2019
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id A04827A1B1
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 16 Jan 2019 04:12:28 +0000 (UTC)
Message-Id: <20190116041227.C5E027A270@mollari.NetBSD.org>
Date: Wed, 16 Jan 2019 04:12:27 +0000 (UTC)
From: coypu@sdf.org
Reply-To: coypu@sdf.org
To: gnats-bugs@NetBSD.org
Subject: nameser_compat.h contains an old, outdated endian.h
X-Send-Pr-Version: www-1.0

>Number:         53880
>Category:       toolchain
>Synopsis:       nameser_compat.h contains an old, outdated endian.h
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gutteridge
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jan 16 04:15:00 +0000 2019
>Closed-Date:    Thu Apr 21 04:07:28 +0000 2022
>Last-Modified:  Thu Apr 21 04:07:28 +0000 2022
>Originator:     coypu
>Release:        NetBSD 8.99.25
>Organization:
>Environment:
NetBSD 8.99.25 powerpc (not mine)
>Description:
This showed up as a spurious error in a package that included nameser_compat.h first, before anything else

ftp://malus.urc.uninett.no/reports/2018Q3/20181111.1138/loudmouth-1.5.3/build.log

In file included from lm-resolver.c:25:0:
/usr/include/arpa/nameser_compat.h:85:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before string constant
   error "Undefined or invalid BYTE_ORDER";
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


alternative idea, replace block by another header providing _BYTE_ORDER.
Most minimal one is <machine/endian_machdep.h> but <endian.h> should be standard now.
>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: toolchain/53880: nameser_compat.h contains an old, outdated
 endian.h
Date: Wed, 16 Jan 2019 08:20:59 +0100

 On Wed, Jan 16, 2019 at 04:15:00AM +0000, coypu@sdf.org wrote:
 > alternative idea, replace block by another header providing _BYTE_ORDER.
 > Most minimal one is <machine/endian_machdep.h> but <endian.h> should be standard now.

 It is intended that way:

 #if (BSD >= 199103)
 # include <machine/endian.h>

 but of course BSD is likely not defined here.

 So: remove the ifdef mess and use <endian.h> unconditionally.

 Martin

From: "David H. Gutteridge" <david@gutteridge.ca>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: toolchain/53880: nameser_compat.h contains an old, outdated
 endian.h
Date: Sat, 27 Jun 2020 22:37:36 -0400

 Looking at other BSDs, OpenBSD removed that entire code block back in
 2005[1] (after first having merged nameser_compat.h into nameser.h),
 and it hasn't been present in FreeBSD since at least 1998. So the
 common approach is to just remove it, as Martin suggested.

 (They also both use _BYTE_ORDER/_BIG_ENDIAN/_LITTLE_ENDIAN/_PDP_ENDIAN
 rather than BYTE_ORDER/BIG_ENDIAN/LITTLE_ENDIAN/PDP_ENDIAN, as the
 former aren't guarded by specific macro definitions like _XOPEN_SOURCE
 or _NETBSD_SOURCE.)

 1. https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/include/arpa/nameser.h.diff?r1=1.10&r2=1.11&f=h

 Dave


Responsible-Changed-From-To: toolchain-manager->gutteridge
Responsible-Changed-By: gutteridge@NetBSD.org
Responsible-Changed-When: Thu, 21 Apr 2022 03:58:22 +0000
Responsible-Changed-Why:
I'll handle this.

From: "David H. Gutteridge" <gutteridge@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/53880 CVS commit: src/include/arpa
Date: Thu, 21 Apr 2022 04:03:54 +0000

 Module Name:	src
 Committed By:	gutteridge
 Date:		Thu Apr 21 04:03:54 UTC 2022

 Modified Files:
 	src/include/arpa: nameser_compat.h

 Log Message:
 nameser_compat.h: simplify logic to determine byte order

 There's really no need for all the complex #ifdefs present and, on top
 of that, it didn't even work correctly for all NetBSD architectures.
 Simply use endian.h and drop the rest. (Since there is no upstream for
 this code anymore, there's no concern about complicating future merges,
 either. This change is also consistent with what FreeBSD and OpenBSD
 did years ago.)

 Addresses PR toolchain/53880 (reported by maya@, originally encountered
 by me on macppc when building a package that pulls in nameser_compat.h
 before nameser.h by necessity -- necessity, that is, on another OS).


 To generate a diff of this commit:
 cvs rdiff -u -r1.8 -r1.9 src/include/arpa/nameser_compat.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: gutteridge@NetBSD.org
State-Changed-When: Thu, 21 Apr 2022 04:07:28 +0000
State-Changed-Why:
Issue addressed.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.