NetBSD Problem Report #59222

From www@netbsd.org  Wed Mar 26 17:20:29 2025
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)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id D245F1A923D
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 26 Mar 2025 17:20:28 +0000 (UTC)
Message-Id: <20250326172027.AAC731A923E@mollari.NetBSD.org>
Date: Wed, 26 Mar 2025 17:20:27 +0000 (UTC)
From: cryintothebluesky@gmail.com
Reply-To: cryintothebluesky@gmail.com
To: gnats-bugs@NetBSD.org
Subject: Build failure on Solaris-11.4 for src/sbin/newfs_udf/udf_core.c
X-Send-Pr-Version: www-1.0

>Number:         59222
>Category:       bin
>Synopsis:       Build failure on Solaris-11.4 for src/sbin/newfs_udf/udf_core.c
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 26 17:25:00 +0000 2025
>Last-Modified:  Thu Mar 27 07:55:01 +0000 2025
>Originator:     Sad Clouds
>Release:        NetBSD-10
>Organization:
>Environment:
SunOS t4-node1 5.11 11.4.42.111.0 sun4v sparc sun4v non-virtualized

>Description:
Building NetBSD-10 with build.sh fails:

/opt/netbsd/netbsd-10-src/sbin/newfs_udf/udf_core.c:717:51: error: 'NAME_MAX' undeclared (first use in this function)
  717 |                 assert(strlen((char *) (id+1)) <= NAME_MAX);
      |

Solaris does not define NAME_MAX and this macro is not portable. This may need #ifdef logic.
>How-To-Repeat:

>Fix:
diff -u src/sbin/newfs_udf/udf_core.c.orig src/sbin/newfs_udf/udf_core.c
--- src/sbin/newfs_udf/udf_core.c.orig  2025-03-26 08:46:46.591168084 +0000
+++ src/sbin/newfs_udf/udf_core.c       2025-03-26 15:09:53.582379006 +0000
@@ -714,7 +714,7 @@
        } else {
                /* assume 8bit char length byte latin-1 */
                assert(*id == 8);
-               assert(strlen((char *) (id+1)) <= NAME_MAX);
+               assert(strlen((char *) (id+1)) <= MAXNAMLEN);
                memcpy((char *) result, (char *) (id+1), strlen((char *) (id+1)));
        }
        free(raw_name);

>Audit-Trail:
From: Sad Clouds <cryintothebluesky@gmail.com>
To: gnats-bugs@netbsd.org
Cc: gnats-admin@netbsd.org
Subject: Re: bin/59222: Build failure on Solaris-11.4 for
 src/sbin/newfs_udf/udf_core.c
Date: Thu, 27 Mar 2025 07:52:38 +0000

 Actually, both NAME_MAX and MAXNAMLEN are not that portable and likely
 to cause this failure. One way to fix this would be with #ifndef

 #ifndef NAME_MAX
   #define NAME_MAX 255
 #endif

 or use pathconf(_PC_NAME_MAX, ...)

NetBSD Home
NetBSD PR Database Search

(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-2025 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.