NetBSD Problem Report #57871
From www@netbsd.org Mon Jan 22 18:35:15 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_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 295B71A9238
for <gnats-bugs@gnats.NetBSD.org>; Mon, 22 Jan 2024 18:35:15 +0000 (UTC)
Message-Id: <20240122183513.7ED9C1A9239@mollari.NetBSD.org>
Date: Mon, 22 Jan 2024 18:35:13 +0000 (UTC)
From: netbsd.org@hacktivis.me
Reply-To: netbsd.org@hacktivis.me
To: gnats-bugs@NetBSD.org
Subject: CMSG_DATA uses u_char which is undefined when POSIX_C_SOURCE is set
X-Send-Pr-Version: www-1.0
>Number: 57871
>Category: lib
>Synopsis: CMSG_DATA uses u_char which is undefined when POSIX_C_SOURCE is set
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: lib-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jan 22 18:40:00 +0000 2024
>Closed-Date: Fri Aug 23 21:03:55 +0000 2024
>Last-Modified: Fri Aug 23 21:03:55 +0000 2024
>Originator: Haelwenn (lanodan) Monnier
>Release: 9.3
>Organization:
>Environment:
NetBSD build 9.3 NetBSD 9.3 (GENERIC) #0: Thu Aug 4 15:30:37 UTC 2022 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
As seen in https://github.com/akash-akya/exile (commit 71a21be) where it fails with the following error (CC=clang for enough information):
```
$ mix compile
clang -Wall -Werror -Wno-unused-parameter -pedantic -std=c99 -O2 -D_POSIX_C_SOURCE=200809L c_src/spawner.c -o priv/spawner
c_src/spawner.c:72:17: error: expected expression
memcpy((int *)CMSG_DATA(cmsg), fds, 3 * sizeof(int));
^
/usr/include/sys/socket.h:554:26: note: expanded from macro 'CMSG_DATA'
#define CMSG_DATA(cmsg) (__CASTV(u_char *, cmsg) + __CMSG_ASIZE)
^
/usr/include/sys/cdefs.h:620:29: note: expanded from macro '__CASTV'
#define __CASTV(__dt, __st) __CAST(__dt, __CAST(void *, __st))
^
/usr/include/sys/cdefs.h:617:34: note: expanded from macro '__CAST'
#define __CAST(__dt, __st) ((__dt)(__st))
^
c_src/spawner.c:72:17: error: use of undeclared identifier 'u_char'
/usr/include/sys/socket.h:554:34: note: expanded from macro 'CMSG_DATA'
#define CMSG_DATA(cmsg) (__CASTV(u_char *, cmsg) + __CMSG_ASIZE)
^
2 errors generated.
```
>How-To-Repeat:
$ git clone https://github.com/akash-akya/exile
$ git checkout 71a21be
$ clang -Wall -Werror -Wno-unused-parameter -pedantic -std=c99 -O2 -D_POSIX_C_SOURCE=200809L c_src/spawner.c -o priv/spawner
>Fix:
>Release-Note:
>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/57871 CVS commit: src/sys/sys
Date: Mon, 22 Jan 2024 13:50:46 -0500
Module Name: src
Committed By: christos
Date: Mon Jan 22 18:50:46 UTC 2024
Modified Files:
src/sys/sys: socket.h
Log Message:
PR/57871: Haelwenn Monnier: Don't use u_char because it is not defined in with
POSIX_C_SOURCE
To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/sys/socket.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->feedback
State-Changed-By: jkoshy@NetBSD.org
State-Changed-When: Sat, 03 Feb 2024 18:46:22 +0000
State-Changed-Why:
Fix committed in r1.132 of src/sys/sys/socket.h.
From: "Haelwenn (lanodan) Monnier" <netbsd.org@hacktivis.me>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: lib/57871 (CMSG_DATA uses u_char which is undefined when
POSIX_C_SOURCE is set)
Date: Sun, 4 Feb 2024 01:45:29 +0100
>State-Changed-From-To: open->feedback
Should be good, I applied the patch on my test system as verification.
State-Changed-From-To: feedback->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Tue, 23 Jul 2024 22:38:52 +0000
State-Changed-Why:
Feedback received, thanks! (And apologies for the gnats nagmail since then.)
Fixed in HEAD, needs pullup-10 and pullup-9, probably.
State-Changed-From-To: needs-pullups->pending-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Sun, 18 Aug 2024 01:12:33 +0000
State-Changed-Why:
pullup-9 #1871 https://releng.netbsd.org/cgi-bin/req-9.cgi?show=1871
pullup-10 #793 https://releng.netbsd.org/cgi-bin/req-10.cgi?show=793
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/57871 CVS commit: [netbsd-10] src/sys/sys
Date: Fri, 23 Aug 2024 16:20:35 +0000
Module Name: src
Committed By: martin
Date: Fri Aug 23 16:20:35 UTC 2024
Modified Files:
src/sys/sys [netbsd-10]: socket.h
Log Message:
Pull up following revision(s) (requested by riastradh in ticket #793):
sys/sys/socket.h: revision 1.132
PR/57871: Haelwenn Monnier: Don't use u_char because it is not defined in with
POSIX_C_SOURCE
To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.131.4.1 src/sys/sys/socket.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/57871 CVS commit: [netbsd-9] src/sys/sys
Date: Fri, 23 Aug 2024 16:21:28 +0000
Module Name: src
Committed By: martin
Date: Fri Aug 23 16:21:28 UTC 2024
Modified Files:
src/sys/sys [netbsd-9]: socket.h
Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1871):
sys/sys/socket.h: revision 1.132
PR/57871: Haelwenn Monnier: Don't use u_char because it is not defined in with
POSIX_C_SOURCE
To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.129.4.1 src/sys/sys/socket.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: pending-pullups->closed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Fri, 23 Aug 2024 21:03:55 +0000
State-Changed-Why:
fixed in HEAD, pulled up to 10, pulled up to 9
Thanks for the report!
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.