From: "Serge E. Hallyn" <serge@hallyn.com>
To: Alejandro Colomar <alx@kernel.org>
Cc: linux-man@vger.kernel.org, "Serge E. Hallyn" <serge@hallyn.com>,
Mark Harris <mark.hsj@gmail.com>,
"G. Branden Robinson" <g.branden.robinson@gmail.com>,
Douglas McIlroy <douglas.mcilroy@dartmouth.edu>
Subject: Re: [PATCH v2 1/4] man/man3/str*.3: NAME: Explain the names
Date: Sun, 26 Jul 2026 21:39:34 -0500 [thread overview]
Message-ID: <ambE5rIikTuHudR4@mail.hallyn.com> (raw)
In-Reply-To: <amUw8ArFwmnsIKl1@devuan>
On Sun, Jul 26, 2026 at 12:09:19AM +0200, Alejandro Colomar wrote:
> Hi Serge,
>
> On 2026-07-24T13:52:10-0500, sergeh@kernel.org wrote:
> > On Wed, Jul 08, 2026 at 05:09:10PM +0200, Alejandro Colomar wrote:
> > > Reported-by: "Serge E. Hallyn" <serge@hallyn.com>
> > > Cc: Mark Harris <mark.hsj@gmail.com>
> > > Cc: "G. Branden Robinson" <g.branden.robinson@gmail.com>
> > > Cc: Douglas McIlroy <douglas.mcilroy@dartmouth.edu>
> > > Signed-off-by: Alejandro Colomar <alx@kernel.org>
> >
> > Most of these look good to me, just a few notes:
>
> Thanks!
>
> [...]
> > > @@ -6,7 +6,7 @@
> > > .\"
> > > .TH strdup 3 (date) "Linux man-pages (unreleased)"
> > > .SH NAME
> > > -strdup, strndup \- duplicate a string
> > > +strdup, strndup \- string duplicate
> >
> > string [bounded] duplicate
> > maybe?
>
> I think for consistency with the other strn*() functions, the following
> would be better:
>
> string [nonstring] duplicate
>
> [...]
> > > @@ -6,7 +6,7 @@
> > > .\"
> > > .TH strfry 3 (date) "Linux man-pages (unreleased)"
> > > .SH NAME
> > > -strfry \- randomize a string
> > > +strfry \- string fry
> >
> > Maybe at least 'string fry (randomize)' ? Because while stirfry
> > is amusing, it's confusing if you haven't heard it before.
>
> Hmmm, randomize seems to generous, and one may think it is kind of
> a shred(1), while it isn't. Maybe 'string fry (reorder)'?
>
> [...]
> > > @@ -5,10 +5,7 @@
> > > .\"
> > > .TH strncat 3 (date) "Linux man-pages (unreleased)"
> > > .SH NAME
> > > -strncat
> > > -\-
> > > -append non-null bytes from a source array to a string,
> > > -and null-terminate the result
> > > +strncat \- nonstring catenate
> >
> > why nonstring? The source string doesn't *have* to be a string,
> > but can be, right?
>
> Yup, it can be a string, although it would be useless (if you want
> a string, you can use strcat(3)).
If the destination is 10 bytes long and has a 5 character string now,
and the source is a valid string that's 15 characters long, it's still
not safe to use strcat.
> > (IIRC, you define a nonstring as an array
> > of given length that doesn't necessarily end in \0? I could be
> > mis-remembering)
>
> Yes, a nonstring is a character array that doesn't necessarily end in
> \0. That's why a string is a valid nonstring, but not the other way
> around.
>
> > string bounded concatente maybe?
>
> Nope; that's what makes people misunderstand these functions, and
> confuse them with safe truncating functions (e.g., strscpy(9)).
>
> I'll send you a copy of a paper I'm writing for the C Committee.
>
> > I think it helps the quick association in the mind if the start
> > of the string matches more closely (str).
>
> In this specific case, it's not a good idea. strn*() are NOT string
> functions.
>
> [...]
> > > @@ -6,7 +6,7 @@
> > > .\"
> > > .TH strnlen 3 (date) "Linux man-pages (unreleased)"
> > > .SH NAME
> > > -strnlen \- determine the length of a fixed-size string
> > > +strnlen \- nonstring length
> >
> > string bounded length?
>
> Nope. It doesn't handle strings.
>
> [...]
> > > @@ -6,7 +6,7 @@
> > > .\"
> > > .TH strpbrk 3 (date) "Linux man-pages (unreleased)"
> > > .SH NAME
> > > -strpbrk \- search a string for any of a set of bytes
> > > +strpbrk \- string search characters
> >
> > does the p stand for returning pointer?
>
> <https://stackoverflow.com/a/501005/6872717>
>
> People say it was "string pointer break". It was a weird name, and
> I ignore why they called it like that. It seems to come from 4.3BSD;
> blame them. :)
>
> I expanded it as if it were called strchrs(), which is what it should
> have been called. It's also the name used in Plan9 internally (in some
> cases).
>
>
> Have a lovely night!
> Alex
>
> --
> <https://www.alejandro-colomar.es>
next prev parent reply other threads:[~2026-07-27 2:39 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 12:33 [PATCH v1 1/2] man/man3/str*.3: NAME: Explain the names Alejandro Colomar
2026-07-02 12:33 ` [PATCH v1 2/2] man/man3/strpbrk.3: BUGS: Clarify the NAME Alejandro Colomar
2026-07-03 5:03 ` [PATCH v1 1/2] man/man3/str*.3: NAME: Explain the names Mark Harris
2026-07-03 11:16 ` Alejandro Colomar
2026-07-08 15:09 ` [PATCH v2 0/4] str*.3, mem*.3: " Alejandro Colomar
2026-07-08 15:09 ` [PATCH v2 1/4] man/man3/str*.3: " Alejandro Colomar
2026-07-24 18:52 ` sergeh
2026-07-25 22:09 ` Alejandro Colomar
2026-07-26 23:14 ` alx-0096r1 - string (and nonstring) copying Alejandro Colomar
2026-07-27 2:39 ` Serge E. Hallyn [this message]
2026-07-27 7:51 ` [PATCH v2 1/4] man/man3/str*.3: NAME: Explain the names Alejandro Colomar
2026-07-08 15:09 ` [PATCH v2 2/4] man/man3/strpbrk.3: BUGS: Clarify the NAME Alejandro Colomar
2026-07-24 18:53 ` sergeh
2026-07-25 22:10 ` Alejandro Colomar
2026-07-08 15:09 ` [PATCH v2 3/4] man/man3/mem*.3: NAME: Explain the names Alejandro Colomar
2026-07-24 18:55 ` sergeh
2026-07-08 15:09 ` [PATCH v2 4/4] man/man3/[b]string.3: Rewrite and merge Alejandro Colomar
2026-07-25 23:49 ` [PATCH v3 0/4] str*.3, mem*.3: NAME: Explain the names Alejandro Colomar
2026-07-25 23:49 ` [PATCH v3 1/4] man/man3/str*.3: " Alejandro Colomar
2026-07-25 23:50 ` [PATCH v3 2/4] man/man3/strpbrk.3: BUGS: Clarify the NAME Alejandro Colomar
2026-07-25 23:50 ` [PATCH v3 3/4] man/man3/mem*.3: NAME: Explain the names Alejandro Colomar
2026-07-25 23:50 ` [PATCH v3 4/4] man/man3/[b]string.3: Rewrite and merge Alejandro Colomar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ambE5rIikTuHudR4@mail.hallyn.com \
--to=serge@hallyn.com \
--cc=alx@kernel.org \
--cc=douglas.mcilroy@dartmouth.edu \
--cc=g.branden.robinson@gmail.com \
--cc=linux-man@vger.kernel.org \
--cc=mark.hsj@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox