NetBSD Problem Report #60764
From www@netbsd.org Tue Sep 22 12:41:49 2026
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 "YR1" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 2E0641A923B
for <gnats-bugs@gnats.NetBSD.org>; Tue, 22 Sep 2026 12:41:49 +0000 (UTC)
Message-Id: <20260922124148.475471A923C@mollari.NetBSD.org>
Date: Tue, 22 Sep 2026 12:41:48 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: err(3): unclear whether exit or _exit
X-Send-Pr-Version: www-1.0
X-From4GNATS: "campbell+netbsd@mumble.net via gnats" <gnats-admin@NetBSD.org>
>Number: 60764
>Category: lib
>Synopsis: err(3): unclear whether exit or _exit
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: lib-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Sep 22 12:45:00 +0000 2026
>Originator: Taylor R Campbell
>Release: current, 11, 10, ...
>Organization:
The ErrorBSD Exitation, Inc.
>Environment:
>Description:
The man page says:
> The err(), verr(), errc(), verrc(), errx(), and verrx()
> functions do not return, but instead cause the program to
> terminate with the status value given by the argument status.
> It is often appropriate to use the value EXIT_FAILURE,
> defined in <stdlib.h>, as the status argument given to these
> functions.
But do they run atexit() functions and destructors?
This isn't clear from the man page, but by code inspection,
they appears to:
57 __dead void
58 verrc(int eval, int code, const char *fmt, va_list ap)
59 {
60 (void)fprintf(stderr, "%s: ", getprogname());
61 if (fmt != NULL) {
62 (void)vfprintf(stderr, fmt, ap);
63 (void)fprintf(stderr, ": ");
64 }
65 (void)fprintf(stderr, "%s\n", strerror(code));
==> 66 exit(eval);
67 }
https://nxr.netbsd.org/xref/src/lib/libc/gen/verrc.c?r=1.3#66
>How-To-Repeat:
man page inspection
>Fix:
1. Clarify the man page.
2. Consider adding variants that use _exit instead? E.g., for
use in child processes.
(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.