NetBSD Problem Report #59494
From greywolf@valentina.serenity.starwolf.com Sun Jun 29 21:54:40 2025
Return-Path: <greywolf@valentina.serenity.starwolf.com>
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 "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 5A71F1A923A
for <gnats-bugs@gnats.NetBSD.org>; Sun, 29 Jun 2025 21:54:40 +0000 (UTC)
Message-Id: <20250629214721.C09A715840@valentina.serenity.starwolf.com>
Date: Sun, 29 Jun 2025 14:47:21 -0700 (PDT)
From: greywolf@valentina.serenity.starwolf.com
Reply-To: greywolf@valentina.serenity.starwolf.com
To: gnats-bugs@NetBSD.org
Subject: mount -v too chatty/messy
X-Send-Pr-Version: 3.95
>Number: 59494
>Category: bin
>Synopsis: mount -v gives more information than is desired
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kre
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sun Jun 29 21:55:00 +0000 2025
>Last-Modified: Tue Jul 01 18:00:01 +0000 2025
>Originator: greywolf@valentina.serenity.starwolf.com
>Release: NetBSD 10.1 [build from 2025-05-03T11:27:00-0700]
>Organization:
--*greywolf;
>Environment:
System: NetBSD valentina.serenity.starwolf.com 10.1 NetBSD 10.1 (VALENTINA) #3: Sun Jun 29 12:09:29 PDT 2025 root@:/usr/src/sys/arch/amd64/compile/VALENTINA amd64
Architecture: x86_64
Machine: amd64
>Description:
I'm chagrined to even be saying this, so I'll just preface all
this with "In my opinion..."
mount -v prints out unnecessary information when mounting
filesystems; without the -v, it is silent, but with the -v it
prints the exec string and the filesystem read/write stats in
addition to the "{dev} on {dir} type {fstype}". ->I think<- the
exec string and the other stats should depend upon more -v flags,
and a single -v flag should just list the output.
If this is egregious, you have my apologies, but I would certainly
like to know why the decision was made such that output is pretty
much all-or-nothing.
Patch added; I did my best not to make it "an egregious hack".
>How-To-Repeat:
mount -v {pick a filesystem of your choice}
It shows the exec, the actual mount, and fsid/read/write stats.
>Fix:
--- mount.c.orig 2025-06-29 13:24:50.474675703 -0700
+++ mount.c 2025-06-29 13:54:58.344278494 -0700
@@ -200,6 +200,7 @@
rval = 1;
}
} else {
+ verbose += verbose? 1: 0;
if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0)
err(EXIT_FAILURE, "getmntinfo");
for (i = 0; i < mntsize; i++) {
@@ -464,7 +465,7 @@
argv[argc++] = name;
argv[argc] = NULL;
- if ((verbose && buf == NULL) || debug) {
+ if ((verbose > 1 && buf == NULL) || debug) {
(void)printf("exec:");
for (i = 0; i < argc; i++)
(void)printf(" %s", argv[i]);
@@ -581,6 +582,11 @@
sfp->f_mntonname, (int)sizeof(sfp->f_fstypename),
sfp->f_fstypename);
+ if (verbose <= 1) {
+ (void)printf("\n");
+ return;
+ }
+
flags = sfp->f_flag & MNT_VISFLAGMASK;
for (f = 0, o = optnames; flags && o <
&optnames[sizeof(optnames)/sizeof(optnames[0])]; o++)
@@ -600,18 +606,18 @@
else
(void)printf("%d", sfp->f_owner);
}
- if (verbose)
+ if (verbose > 1)
(void)printf("%sfsid: 0x%x/0x%x",
!f++ ? " (" /* ) */: ", ",
sfp->f_fsidx.__fsid_val[0], sfp->f_fsidx.__fsid_val[1]);
- if (verbose) {
+ if (verbose > 1) {
(void)printf("%s", !f++ ? " (" : ", ");
(void)printf("reads: sync %" PRIu64 " async %" PRIu64 "",
sfp->f_syncreads, sfp->f_asyncreads);
(void)printf(", writes: sync %" PRIu64 " async %" PRIu64 "",
sfp->f_syncwrites, sfp->f_asyncwrites);
- if (verbose > 1) {
+ if (verbose > 2) {
char buf[2048];
if (getmntargs(sfp, buf, sizeof(buf)))
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: bin-bug-people->kre
Responsible-Changed-By: kre@NetBSD.org
Responsible-Changed-When: Mon, 30 Jun 2025 23:20:00 +0000
Responsible-Changed-Why:
I am looking into this PR
From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@netbsd.org
Cc: greywolf@valentina.serenity.starwolf.com, netbsd-bugs@netbsd.org
Subject: Re: bin/59494: mount -v too chatty/messy
Date: Tue, 01 Jul 2025 06:24:26 +0700
I agree that something between silence and everything is probably
a good idea.
I plan on fixing this, but in a slightly less invasive way than was
suggested, but I believe with the same effect.
Here's the patch I am intending upon (somethng like, should anyone
want to test it) - so far this has not been near a compiler even!
kre
Index: mount.c
===================================================================
RCS file: /cvsroot/src/sbin/mount/mount.c,v
retrieving revision 1.107
diff -u -r1.107 mount.c
--- mount.c 7 Dec 2021 14:31:13 -0000 1.107
+++ mount.c 30 Jun 2025 23:21:45 -0000
@@ -69,7 +69,7 @@
#include "pathnames.h"
#include "mountprog.h"
-static int debug, verbose;
+static int debug, verbose, noise;
static void catopt(char **, const char *);
static const char *
@@ -170,6 +170,12 @@
(strcmp(type, FSTAB_RO) && \
strcmp(type, FSTAB_RW) && strcmp(type, FSTAB_RQ))
+ noise = 0;
+ if (argc > 0 && verbose) {
+ noise = 1;
+ verbose--;
+ }
+
rval = 0;
switch (argc) {
case 0:
@@ -419,7 +425,7 @@
*/
if (strncmp(name, sfp[i].f_mntonname, MNAMELEN) == 0 &&
strncmp(vfstype, mountedtype, cmplen) == 0) {
- if (verbose)
+ if (noise || verbose)
(void)printf("%s on %s type %.*s: "
"%s\n",
sfp[i].f_mntfromname,
@@ -555,7 +561,7 @@
}
if (buf == NULL) {
- if (verbose) {
+ if (verbose || noise) {
if (statvfs(name, &sf) == -1) {
warn("statvfs %s", name);
return 1;
From: "Robert Elz" <kre@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/59494 CVS commit: src/sbin/mount
Date: Tue, 1 Jul 2025 17:55:05 +0000
Module Name: src
Committed By: kre
Date: Tue Jul 1 17:55:05 UTC 2025
Modified Files:
src/sbin/mount: mount.8 mount.c
Log Message:
PR bin/59494
Cause "mount -v [spec] filesystem" to indicate only what was
mounted (and where), to obtain all the rest of the data that
used to be printed, -v must be given twice.
Implemented differently from the patch given in the PR from
greywolf, but the same idea.
While here, avoid the -d option, after indicating what mount
command would have been run, but wasn't, going on to attempt
to report statistics on the never mounted filesystem, and
instead getting those from the intended mount point.
Update the man page to match.
To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sbin/mount/mount.8
cvs rdiff -u -r1.107 -r1.108 src/sbin/mount/mount.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>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-2025
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.