NetBSD Problem Report #59957
From www@netbsd.org Sun Feb 1 21:19:25 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) server-digest SHA256
client-signature RSA-PSS (2048 bits) client-digest SHA256)
(Client CN "mail.netbsd.org", Issuer "R13" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id E6FB31A923D
for <gnats-bugs@gnats.NetBSD.org>; Sun, 1 Feb 2026 21:19:24 +0000 (UTC)
Message-Id: <20260201211923.DE2C81A923E@mollari.NetBSD.org>
Date: Sun, 1 Feb 2026 21:19:23 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: newfs_msdos(8): missing NAME= syntax
X-Send-Pr-Version: www-1.0
X-From4GNATS: "campbell+netbsd@mumble.net via gnats" <gnats-admin@NetBSD.org>
>Number: 59957
>Category: bin
>Synopsis: newfs_msdos(8): missing NAME= syntax
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Feb 01 21:20:01 +0000 2026
>Last-Modified: Thu May 07 20:35:01 +0000 2026
>Originator: Taylor R Campbell
>Release: current, 11, 10, 9, ...
>Organization:
NAME=TheNetBSDFatdation
>Environment:
>Description:
# newfs_msdos NAME=a73530f3-554c-4523-8aff-8bbc2510d365
newfs_msdos: /dev/rNAME=a73530f3-554c-4523-8aff-8bbc2510d365: No such file or directory
But it works with newfs(8).
>How-To-Repeat:
as above
>Fix:
Yes, please!
>Audit-Trail:
From: ssszcmawo <ssszcmawo@gmail.com>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/59957 Add minimal support for NAME= syntax
Date: Sun, 1 Mar 2026 16:48:31 +0100
This patch implements minimal support for volume labels
I've tested this change locally on my system and it works
as intended. I hope you won't encounter any issues either.
>From 06cfd7be8f77e78db7bb3c895226020a6564ed62 Mon Sep 17 00:00:00 2001
From: ssszcmawo <belan2470@gmail.com>
Date: Sun, 1 Mar 2026 16:34:55 +0100
Subject: [PATCH] add support for labels
---
sbin/newfs_msdos/newfs_msdos.c | 42 ++++++++++++++++++++++++++++------
1 file changed, 35 insertions(+), 7 deletions(-)
diff --git a/sbin/newfs_msdos/newfs_msdos.c b/sbin/newfs_msdos/newfs_msdos.c
index 9f333b4f9..90bf786ce 100644
--- a/sbin/newfs_msdos/newfs_msdos.c
+++ b/sbin/newfs_msdos/newfs_msdos.c
@@ -46,6 +46,7 @@ __RCSID("$NetBSD: newfs_msdos.c,v 1.45 2017/02/16
22:42:25 christos Exp $");
#include <unistd.h>
#include <paths.h>
#include <errno.h>
+#include <fcntl.h>
#include <util.h>
#include "mkfs_msdos.h"
@@ -93,7 +94,13 @@ main(int argc, char *argv[])
static const char opts[] =
"@:NB:C:F:I:L:O:S:a:b:c:e:f:h:i:k:m:n:o:r:s:T:u:";
struct msdos_options o;
char *fname, *dtype;
- char buf[MAXPATHLEN];
+ const char* special;
+ const char* sname;
+ char specname[MAXPATHLEN];
+ char device[MAXPATHLEN];
+ char rawname[MAXPATHLEN];
+ int fd;
+ struct stat sb;
int ch;
memset(&o, 0, sizeof(o));
@@ -183,12 +190,33 @@ main(int argc, char *argv[])
argv += optind;
if (argc < 1 || argc > 2)
usage();
- fname = *argv++;
- if (!strchr(fname, '/') && !o.create_size) {
- snprintf(buf, sizeof(buf), "%sr%s", _PATH_DEV, fname);
- if (!(fname = strdup(buf)))
- err(1, NULL);
- }
+
+ memset(&sb, 0, sizeof(sb));
+
+ special = argv[0];
+
+ sname = getfsspecname(specname, sizeof(specname), special);
+ if (sname == NULL)
+ err(1, "%s: %s",special, specname);
+
+ special = getdiskrawname(rawname, sizeof(rawname), sname);
+ if (special == NULL)
+ special = sname;
+
+ fd = opendisk(special, O_RDWR, device,
+ sizeof(device),0);
+
+ if (fd < 0 || fstat(fd, &sb) == -1)
+ err(1, "%s: open for read", special);
+
+ special = device;
+
+ if (S_ISBLK(sb.st_mode))
+ errx(1, "%s is a block device. use raw device",
+ special);
+
+ fname = strdup(special);
+
dtype = *argv;
return mkfs_msdos(fname, dtype, &o);
}
--
2.47.3
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/59957 CVS commit: src/sbin
Date: Fri, 1 May 2026 16:39:27 -0400
Module Name: src
Committed By: christos
Date: Fri May 1 20:39:26 UTC 2026
Modified Files:
src/sbin/fsck: partutil.h
src/sbin/newfs: Makefile.common newfs.c
src/sbin/newfs_ext2fs: Makefile newfs_ext2fs.c
src/sbin/newfs_msdos: Makefile newfs_msdos.c
src/sbin/tunefs: Makefile tunefs.c
Added Files:
src/sbin/fsck: openspecial.c
Log Message:
PR/59957: Taylor R. Campbell: Centralize the disk open sequence from newfs
and tunefs to a new function "openspecial" and use it to fix this PR, and
the same issue with newfs_ext2fs.
To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sbin/fsck/openspecial.c
cvs rdiff -u -r1.3 -r1.4 src/sbin/fsck/partutil.h
cvs rdiff -u -r1.1 -r1.2 src/sbin/newfs/Makefile.common
cvs rdiff -u -r1.120 -r1.121 src/sbin/newfs/newfs.c
cvs rdiff -u -r1.7 -r1.8 src/sbin/newfs_ext2fs/Makefile
cvs rdiff -u -r1.11 -r1.12 src/sbin/newfs_ext2fs/newfs_ext2fs.c
cvs rdiff -u -r1.6 -r1.7 src/sbin/newfs_msdos/Makefile
cvs rdiff -u -r1.45 -r1.46 src/sbin/newfs_msdos/newfs_msdos.c
cvs rdiff -u -r1.14 -r1.15 src/sbin/tunefs/Makefile
cvs rdiff -u -r1.58 -r1.59 src/sbin/tunefs/tunefs.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Robert Elz" <kre@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/59957 CVS commit: src/sbin
Date: Sun, 3 May 2026 17:49:58 +0000
Module Name: src
Committed By: kre
Date: Sun May 3 17:49:58 UTC 2026
Modified Files:
src/sbin/fsck: openspecial.c partutil.h
src/sbin/newfs: newfs.c
src/sbin/newfs_ext2fs: newfs_ext2fs.c
src/sbin/newfs_msdos: newfs_msdos.c
src/sbin/tunefs: tunefs.c
Log Message:
Undo some of the previous, restore flexibility
This is related to PR bin/59957 (in that it is a continuation/
alteration of the previous fix). This was primarily designed
to (hopefully) fix the ~80 extra ATF test failures that the previous
solution caused, by allowing the utilities to work as they had
previously, rather than attempting to enforce one universal true
world order.
Change the openspecial() function to be findspecial() as it no longer
opens anything - but leave it in openspecial.c for several reasons:
First, it might make sense to recreate openspecial() for use in just
those utilities that want to do all that it did (just 2 of the four
that were modified to use it).
Also, this function (or functions) really should be moved to libutil,
rather than buried in sbin/fsck (which doesn't even use it/them at all
- though could perhaps use the findspecial() variant), and I didn't see
the point in deleting one file, creating another, only to delete that
new one in a few days.
And third, renaming it would have meant futzing with Makefiles which
I personally prefer not to get involved in whenever possible - and which
would also need to be done differently if the function(s) move to libutil.
The issues:
newfs_msdos wants to be able to create new files (at a point beyond where
the code was changed) so forcing an err() exit when the open of the
non-existing file failed broke things (that's the cause of perhaps all
of the test failures - certainly most).
tunefs has no need to enforce use of something other than a block device -
in fact, it is often better to use the block device (makes no difference
to efficiency, only the superblock is touched) and using the block device
provides a little extra protection against attempting to modify a mounted
filesystem (which would "work", but be undone the next time the in-core
superblock is flushed, leading to "what happened there, I know I checked
it had worked??" kinds of issues).
newfs and newfs_ext2fs could have continued using the openspecial()
function (and might get returned to that way again) if that function
gets recreated.
[ok:christos]
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sbin/fsck/openspecial.c
cvs rdiff -u -r1.4 -r1.5 src/sbin/fsck/partutil.h
cvs rdiff -u -r1.121 -r1.122 src/sbin/newfs/newfs.c
cvs rdiff -u -r1.12 -r1.13 src/sbin/newfs_ext2fs/newfs_ext2fs.c
cvs rdiff -u -r1.46 -r1.47 src/sbin/newfs_msdos/newfs_msdos.c
cvs rdiff -u -r1.59 -r1.60 src/sbin/tunefs/tunefs.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Robert Elz" <kre@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/59957 CVS commit: src/usr.sbin/dumpfs
Date: Thu, 7 May 2026 20:32:12 +0000
Module Name: src
Committed By: kre
Date: Thu May 7 20:32:12 UTC 2026
Modified Files:
src/usr.sbin/dumpfs: Makefile dumpfs.c
Log Message:
Fix dumpfs to allow NAME=wedge-label on command line
This is a follow-on from the PR bin/59957 changes, and is being
included with that PR so it is easier to locate all the tools that
have been changed this way, so they can all be updated again once
the new code is moved to libutil where it belongs, and out of src/sbin/fsck.
When handling of NAME=whatever was added to dumpfs, it was done
in a way where it could only work when dumpfs was used as
dumpfs mount-point
and /etc/fsck contained
NAME=whatever mount-point [rest of fstab entry]
That covers the vast majority of actual uses, but a simple
dumpfs NAME=whatever
should work as well (as it does in just about everything else now).
Using findspecial() (currently) from src/sbin/fsck/openspecial.c
allows that, and simplifies the dumpfs code considerably.
To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/dumpfs/Makefile
cvs rdiff -u -r1.70 -r1.71 src/usr.sbin/dumpfs/dumpfs.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.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-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.