NetBSD Problem Report #59960
From www@netbsd.org Mon Feb 2 20:30: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) 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 9C41B1A923E
for <gnats-bugs@gnats.NetBSD.org>; Mon, 2 Feb 2026 20:30:49 +0000 (UTC)
Message-Id: <20260202203048.609851A923F@mollari.NetBSD.org>
Date: Mon, 2 Feb 2026 20:30:48 +0000 (UTC)
From: bastie@users.noreply.github.com
Reply-To: bastie@users.noreply.github.com
To: gnats-bugs@NetBSD.org
Subject: wc - missing information in man file
X-Send-Pr-Version: www-1.0
X-From4GNATS: "bastie@users.noreply.github.com via gnats" <gnats-admin@NetBSD.org>
>Number: 59960
>Category: standards
>Synopsis: wc - missing information in man file
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: standards-manager
>State: closed
>Class: doc-bug
>Submitter-Id: net
>Arrival-Date: Mon Feb 02 20:35:00 +0000 2026
>Closed-Date: Mon Feb 02 21:17:54 +0000 2026
>Last-Modified: Mon Feb 02 21:23:57 +0000 2026
>Originator: Sebastian RItter
>Release:
>Organization:
none
>Environment:
I read the man page and the source code.
>Description:
The man page of wc tool do not note - in different to FreeBSD - that the only last "m or c" flag wins the race.
The source code do it:
https://github.com/NetBSD/src/blob/1d0f224e98c38ff44b6e8b5371ffa141595a286c/usr.bin/wc/wc.c#L93
...
case 'm':
dochar = true;
dobyte = 0;
break;
case 'c':
dochar = 0;
dobyte = true;
break;
The NetBSD documentation writes (https://man.netbsd.org/wc.1):
The following options are available:
...
-c The number of bytes in each input file is written to the standard
output.
-m The number of characters in each input file is written to the
standard output.
...
>How-To-Repeat:
RTFM and source code
>Fix:
Use FreeBSD note:
at -c: This will cancel out any prior usage of the -m option.
at -m This will cancel out any prior usage of the -c option.
or
implementation like GNU wc and remove the cancelation.
>Release-Note:
>Audit-Trail:
From: "Robert Elz" <kre@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/59960 CVS commit: src/usr.bin/wc
Date: Mon, 2 Feb 2026 21:16:02 +0000
Module Name: src
Committed By: kre
Date: Mon Feb 2 21:16:02 UTC 2026
Modified Files:
src/usr.bin/wc: wc.1
Log Message:
PR standards/49960 - note -c and -m are incompatible
Note, this is not really a standards issue, POSIX says:
If the -m option is specified, the number of characters shall
replace the <bytes> field in this format.
There is no output format in POSIX which permits both bytes and
characters to be specified, and since which value represents which
counter is determined entirely by position, which of bytes or
characters would come first if both were to be presented would be
indeterminate, so I won't be doing that.
Slightly different wording used than that suggested bty Sebastian Ritter
in the PR.
To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/wc/wc.1
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: kre@NetBSD.org
State-Changed-When: Mon, 02 Feb 2026 21:17:54 +0000
State-Changed-Why:
wc.1 updated to note that -c and -m are incompatible, and
the last given wins.
Since the SYNOPSIS already makes that clear, I don't believe a
pullup of this (even to -11) is needed.
>Unformatted:
(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.