NetBSD Problem Report #60599
From www@netbsd.org Sat Aug 15 09:15:04 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 "YR2" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 1D98B1A923E
for <gnats-bugs@gnats.NetBSD.org>; Sat, 15 Aug 2026 09:15:04 +0000 (UTC)
Message-Id: <20260815091416.F04451A923E@mollari.NetBSD.org>
Date: Sat, 15 Aug 2026 09:14:16 +0000 (UTC)
From: rvp@SDF.ORG
Reply-To: rvp@SDF.ORG
To: gnats-bugs@NetBSD.org
Subject: getfsspecname(3) returns ESRCH instead of ENOENT
X-Send-Pr-Version: www-1.0
X-From4GNATS: "rvp@SDF.ORG via gnats" <gnats-admin@NetBSD.org>
>Number: 60599
>Category: lib
>Synopsis: getfsspecname(3) returns ESRCH instead of ENOENT
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: lib-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sat Aug 15 09:20:01 +0000 2026
>Last-Modified: Sun Aug 16 09:35:01 +0000 2026
>Originator: RVP
>Release: 11.99.7
>Organization:
>Environment:
NetBSD CoreBook.local 11.99.7 NetBSD 11.99.7 (COREBOOK_DIAG) #0: Sat Aug 15 04:21:15 UTC 2026 bld@CoreBook.local:/tmp/obj/usr/src/sys/arch/amd64/compile/COREBOOK_DIAG amd64
>Description:
The return value of getfsspecname(3) when a label cannot be looked up
is a bit confusing:
```
$ sudo mount -r NAME=doesnotexist /mnt
mount: no match for `doesnotexist': No such process
$
```
`No such process'? Wat? There be no "process" here, mon.
>How-To-Repeat:
As above.
>Fix:
---START patch---
--- lib/libutil/getfsspecname.c.orig 2018-12-27 21:35:48.000000000 +0000
+++ lib/libutil/getfsspecname.c 2026-08-13 02:15:29.812375998 +0000
@@ -135,13 +135,16 @@
goto out;
}
+ savee = 0;
for (dk = strtok(drives, " "); dk != NULL; dk = strtok(NULL, " ")) {
struct dkwedge_info dkw;
if (strncmp(dk, "dk", 2) != 0)
continue;
fd = opendisk(dk, O_RDONLY, buf, bufsiz, 0);
- if (fd == -1)
+ if (fd == -1) {
+ savee = errno;
continue;
+ }
if (ioctl(fd, DIOCGWEDGEINFO, &dkw) == -1) {
savee = errno;
snprintf(buf, bufsiz, "%s: getwedgeinfo", dk);
@@ -161,9 +164,11 @@
close(fd);
p = strstr(buf, "/r");
goto good;
- }
+ } else
+ savee = errno;
#endif
- savee = ESRCH;
+ if (savee == 0)
+ savee = ENOENT;
snprintf(buf, bufsiz, "no match for `%s'", vname);
out:
buf = NULL;
---END patch---
>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60599 CVS commit: src/lib/libutil
Date: Sun, 16 Aug 2026 05:34:54 -0400
Module Name: src
Committed By: christos
Date: Sun Aug 16 09:34:54 UTC 2026
Modified Files:
src/lib/libutil: getfsspecname.c
Log Message:
PR/60599: RVP: getfsspecname(3) returns ESRCH instead of ENOENT
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/libutil/getfsspecname.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
(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.