From: Alejandro Colomar <alx@kernel.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: linux-man@vger.kernel.org
Subject: Re: [PATCH 3/4] strncat.3 fixes
Date: Tue, 21 Nov 2023 17:03:53 +0100 [thread overview]
Message-ID: <ZVzU6WHGCQqV4TRn@devuan> (raw)
In-Reply-To: <ZVF4tHfkfrwFQawd@debian>
[-- Attachment #1: Type: text/plain, Size: 2689 bytes --]
Hi Paul,
On Mon, Nov 13, 2023 at 02:15:20AM +0100, Alejandro Colomar wrote:
> Hi Paul,
>
> On Sun, Nov 12, 2023 at 03:52:07PM -0800, Paul Eggert wrote:
>
> > Don't say "concatenate".
>
> Ok
>
> > Use "byte" instead of "character",
>
> Ok
>
> > and use standalone terminology rather than relying on the
> > reader already having read string_copying(7).
>
> I need to check again in a standalone commit.
>
> > Don't say "width" when "size" was intended.
>
> Ok
>
> > Fix indenting of prototype.
>
> Ok
>
> > Simplify possible implementation, fixing a bug when the
> > source string length and sz exceed INT_MAX.
>
> Heh! Good.
>
> > Say that strncat is rarely useful.
>
> Do we need to say that, or is it already implied by
> "append non-null bytes from a source array to a string,
> and null-terminate the result"?
> Not many programs need to do that operation. I'm fine with saying it's
> rarely useful; I'm just wondering if it's worth it.
>
> > Say that behavior is undefined if the destination is not a string.
>
> Ok
>
> > Simplify example by using plain sizeof rather than an nitems macro,
>
> If you want sizeof(), please use sizeof(), not sizeof.
>
> I use nitems() with these functions because if you switch to wide
> strings, you can keep the nitems() part, while you'd have to change it
> if you had sizeof(). Also, nitems() makes it safe against sizeof(ptr).
> What do you think of this?
>
> > by removing a confusingly-named 'maxsize' local,
>
> Ok
>
> > and by removing an unnecessary call to 'exit'.
>
> This was practice from Michael Kerrisk, which I like: always terminate
> the program with exit(1); don't rely on just ending the scope of main().
> That way, it's more visual.
>
> Please split all these things into separate patches, if you don't mind,
> and sign the patch.
I've applied a set of patches myself:
d7cdccd84 (HEAD -> contrib, alx/contrib) strncat.3: CAVEATS: Say that strncat() is rarely useful
dc2c99ffe strncat.3: CAVEATS: wfix
39209460f strncat.3: Reword description
556a2d03e strncat.3: Say that if dst isn't a string, the behavior is undefined
ec37b6ac5 strncat.3: SEE ALSO: tfix
f8de0ec01 strncat.3: EXAMPLES: Fix name of variable
1c1c9f93c strncat.3: Simplify possible implementation of strncat()
09b80aed1 strncat.3: Rename third parameter to ssize
f5429cefe strncat.3: Fix bug in possible implementation of strncat(3)
2fe3076fe strncat.3: SYNOPSIS: ffix
696152d30 strncat.3: Don't say 'width' when 'size' is intended
6fe104a7d strncat.3: Say append instead of (con)catenate
Cheers,
Alex
--
<https://www.alejandro-colomar.es/>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2023-11-21 16:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-12 23:52 [PATCH 0/4] improvements for strncpy.3 etc Paul Eggert
2023-11-12 23:52 ` [PATCH 1/4] * Remove man3/stpecpyx.3; no longer present Paul Eggert
2023-11-13 0:18 ` Alejandro Colomar
2023-11-12 23:52 ` [PATCH 2/4] string.3 fixes Paul Eggert
2023-11-13 0:53 ` Alejandro Colomar
2023-11-13 22:27 ` Paul Eggert
2023-11-13 23:25 ` Alejandro Colomar
2023-11-12 23:52 ` [PATCH 3/4] strncat.3 fixes Paul Eggert
2023-11-13 1:15 ` Alejandro Colomar
2023-11-13 16:23 ` Alejandro Colomar
2023-11-21 16:03 ` Alejandro Colomar [this message]
2023-11-12 23:52 ` [PATCH 4/4] stpncpy(3) fixes Paul Eggert
2023-11-13 1:29 ` Alejandro Colomar
2023-11-21 18:33 ` Alejandro Colomar
2023-11-21 21:18 ` Paul Eggert
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=ZVzU6WHGCQqV4TRn@devuan \
--to=alx@kernel.org \
--cc=eggert@cs.ucla.edu \
--cc=linux-man@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.