NetBSD Problem Report #38014

From jakllsch@spacerome.kollasch.net  Wed Feb 13 00:28:57 2008
Return-Path: <jakllsch@spacerome.kollasch.net>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id B6D0A63B293
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 13 Feb 2008 00:28:57 +0000 (UTC)
Message-Id: <20080213002855.4CC2277778@spacerome.kollasch.net>
Date: Wed, 13 Feb 2008 00:28:55 +0000 (UTC)
From: jakllsch@kollasch.net
Reply-To: jakllsch@kollasch.net
To: gnats-bugs@gnats.NetBSD.org
Subject: bswapXX()
X-Send-Pr-Version: 3.95

>Number:         38014
>Category:       lib
>Synopsis:       bswapXX() is now exposed
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 13 00:30:00 +0000 2008
>Closed-Date:    Wed Nov 27 23:49:39 +0000 2024
>Last-Modified:  Wed Nov 27 23:49:39 +0000 2024
>Originator:     Jonathan A. Kollasch
>Release:        NetBSD 4.0
>Organization:

>Environment:
System: NetBSD spacerome.kollasch.net 4.0 NetBSD 4.0 (SPACEROME) #6: Fri Feb 1 17:50:31 UTC 2008 root@spacerome.kollasch.net:/usr/src/sys/arch/macppc/compile/SPACEROME macppc
Architecture: powerpc
Machine: macppc
>Description:

bswap* functions are now exposed too easily.

This breaks qemu, heimdal, arla, and other things that expect
these apparently non-standard macros/functions to not be
exposed-by-default in the normal environment.

>How-To-Repeat:

compile (on NetBSD-3, Linux, NetBSD-4):

#include <stdlib.h>
int
main(int argc, char *argv[])
{
        unsigned int foo;
	foo = bswap32(0x76543210);
	return EXIT_SUCCESS;
}

>Fix:

Revert changes to src/sys/sys/bswap.h since netbsd-3?

>Release-Note:

>Audit-Trail:
From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: lib/38014: bswapXX()
Date: Mon, 8 Aug 2016 05:10:00 +0000

 On Wed, Feb 13, 2008 at 12:30:00AM +0000, jakllsch@kollasch.net wrote:
  > bswap* functions are now exposed too easily.
  > [to wit, via <stdlib.h> ]

 This is still true, but now years later I worry that changing it is as
 likely to break stuff as not changing it... thoughts anyone?

 -- 
 David A. Holland
 dholland@netbsd.org

From: coypu@sdf.org
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: lib/38014: bswapXX()
Date: Sun, 1 Sep 2019 23:43:03 +0000

 I still run into code needing to be patched for netbsd because of this
 change, e.g.
 pkgsrc/graphics/MesaLib/patches/patch-src_intel_isl_isl__tiled__memcpy.c

State-Changed-From-To: open->closed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Wed, 27 Nov 2024 23:49:39 +0000
State-Changed-Why:
bswap16/32/64 have been hidden as long as you define one of the
standard feature macros like _POSIX_C_SOURCE, _XOPEN_SOURCE, or
_ANSI_SOURCE, for a long time.  Applications which don't say what
standard API they want, well, can't really rely on what they get or
don't get.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.