All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx@kernel.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: linux-man@vger.kernel.org
Subject: Re: [PATCH 2/4] string.3 fixes
Date: Tue, 14 Nov 2023 00:25:05 +0100	[thread overview]
Message-ID: <ZVKwUU1li8zOSqE8@debian> (raw)
In-Reply-To: <9292717d-1a77-40af-bef8-49a05e93c9b9@cs.ucla.edu>

[-- Attachment #1: Type: text/plain, Size: 1841 bytes --]

Hi Paul,

On Mon, Nov 13, 2023 at 02:27:51PM -0800, Paul Eggert wrote:
> On 11/12/23 16:53, Alejandro Colomar wrote:
> > I'm not convinced by the array wording, as it could be understood as
> > doing this:
> > 
> > 	char d[3], s[3] = {'a', '\0', 'b'};
> > 
> > 	strncpy(d, s, 3);  // "a\0b"?  Or maybe "ab\0"?
> > 
> > Did it copy the non-null byte 'b'?
> 
> OK, let's fix that confusion by saying it copies "leading non-null bytes",
> not merely "non-null bytes". Please see attached.

LGTM.  Patch applied.
<https://www.alejandro-colomar.es/src/alx/linux/man-pages/man-pages.git/commit/?h=contrib&id=0726f57d8362553b697fa19c405f7fc77f2e42dd>

Cheers,
Alex

> From ac104738b8b13159271c40a86341f871fa260e33 Mon Sep 17 00:00:00 2001
> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Mon, 13 Nov 2023 14:26:42 -0800
> Subject: [PATCH] string.3 fixes
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> Say "size" not "width" for byte counts; "width" is for the number
> of bits in a word.  Say "leading" to make it clear we don’t care
> about what the source contains, after its first null byte.
> ---
>  man3/string.3 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/man3/string.3 b/man3/string.3
> index 4c374a7df..08b050b17 100644
> --- a/man3/string.3
> +++ b/man3/string.3
> @@ -185,7 +185,7 @@ bytes to
>  const char " src "[restrict ." n ],
>  .BI "       size_t " n );
>  .fi
> -Fill a fixed-width buffer with non-null bytes from a source string,
> +Fill a fixed-size buffer with leading non-null bytes from a source array,
>  padding with null bytes as needed.
>  .SH DESCRIPTION
>  The string functions perform operations on null-terminated
> -- 
> 2.41.0
> 


-- 
<https://www.alejandro-colomar.es/>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2023-11-13 23:25 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 [this message]
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
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=ZVKwUU1li8zOSqE8@debian \
    --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.