NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/59029: cut(1) -n argument doesn't work (presently unsupported, though documented)
The following reply was made to PR bin/59029; it has been noted by GNATS.
From: "David H. Gutteridge" <david%gutteridge.ca@localhost>
To: gnats-bugs%netbsd.org@localhost, kre%munnari.OZ.AU@localhost
Cc:
Subject: Re: bin/59029: cut(1) -n argument doesn't work (presently
unsupported, though documented)
Date: Mon, 03 Mar 2025 20:00:19 -0500
On Thu, 13 Feb 2025 at 11:46:16 +0700, Robert Elz wrote:
[...]
> Neither the standard -b nor -c algorithm would get that right. If
you're
> looking for an implementation to import to improve ours, pick
FreeBSD's.
Yes, that's quite right. I looked at the AT&T "Advanced Software
Technology" code that's used in (open-sourced) Solaris (which I infer
is the origin of this) and FreeBSD's intent is to match that logic.
Given the NetBSD test input:
$ cat d_utf8.in=20
foo=C3=84:bar:=C3=84baz
Foo=C3=84:Bar:=C3=84Baz
FOo=C3=84:BAr:=C3=84BAz
FOO=C3=84:BAR:=C3=84BAZ
On implementations like Fedora/RHEL that equate -b -n to -c:
$ cut -b 5,6,7 d_utf8.in=20
=EF=BF=BD:b
=EF=BF=BD:B
=EF=BF=BD:B
=EF=BF=BD:B
$ cut -b 5,6,7 -n d_utf8.in=20
:ba
:Ba
:BA
:BA
$ cut -c 5,6,7 d_utf8.in=20
:ba
:Ba
:BA
:BA
On FreeBSD and Solaris:
$ cut -b 5,6,7 d_utf8.in=20
=EF=BF=BD:b
=EF=BF=BD:B
=EF=BF=BD:B
=EF=BF=BD:B
$ cut -b 5,6,7 -n d_utf8.in=20
=C3=84:b
=C3=84:B
=C3=84:B
=C3=84:B
$ cut -c 5,6,7 d_utf8.in=20
:ba
:Ba
:BA
:BA
I've pulled over the change sets from FreeBSD to apply to ours. (Still
adjusting/cleaning some things up.)
Thanks,
Dave
Home |
Main Index |
Thread Index |
Old Index