From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by sourceware.org (Postfix) with ESMTPS id 7C4803858C41 for ; Thu, 9 Nov 2023 11:13:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7C4803858C41 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7C4803858C41 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=145.40.68.75 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699528411; cv=none; b=s72rsQJpn2iC/6hFHCIu2JcfnGvwitnkt8q/9M2slUO+f80LBlA+LbkyjkquvaIeo0thXvTBn4u5ujj8WTsscFhEbhbGWITTzFCTxRNngiHpdnKB4pfRnof054EXYQJUVVsOXa9RvecQjTJrgA0Q7CalzmlDZpwEh05o+PjY0Ts= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699528411; c=relaxed/simple; bh=VhPsk523O/FXTiXrS4qyAmzx/RDDLYccGE1W0IkrBt0=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=tlMPCq29HsMPuj45YRQ+1ZYvPTO58Mw7Uk29pE/7ssPdxW44i3XWCBrCleWPKhidAFVU86sHe+O45LsUlutaWI64yJ+g5esNj1ASHbLEx2u1okj/LOqUcsaUuMyBMWmAhuSnL7LZtuwUHzMaXouuPWOhpG3SlxW4P0n8heoSBow= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id 5FEA3B81E3A; Thu, 9 Nov 2023 11:13:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67AB6C433C8; Thu, 9 Nov 2023 11:13:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1699528408; bh=VhPsk523O/FXTiXrS4qyAmzx/RDDLYccGE1W0IkrBt0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MN+aQa9V6mFjhHQPJkde/M1zb4Weh4ELYsCbbu7ogBXnV6XrJKjISZ7I3WuprTxuo jMirGZMDhb+HLpJuJYBi7+X5AolYjWc+NYiTrt1m/4HF41KXX2l3I4S9CwZ4wrjhR9 3dzlh2T4gYR9jG8KSAej8bLrGBXYfzSKx75PbD+Vx9pJTjn5LhsQD1/Mcnio5v7GQ+ GQkiqPqquyqNPDcHePSVmjZqeE0D/ViQSKajb9R6kMGAsbX+oUxraR5pTSAYTmTIkS TGnX/IO0uGhp2ueHDNddTQPx8vcTDeQzUIvl59/1hYT51AHuEhHY9M9vDF2aTHqCCX SL0SHvJiiip4Q== Date: Thu, 9 Nov 2023 12:13:24 +0100 From: Alejandro Colomar To: Jonny Grant Cc: Paul Eggert , Carlos O'Donell , Zack Weinberg , GNU libc development , 'linux-man' Subject: Re: strncpy clarify result may not be null terminated Message-ID: References: <16cc15a4-cfc0-49f4-9ebf-ecf0901700ce@app.fastmail.com> <8ebee0fc-1e77-41d9-8feb-8c1083a30a93@cs.ucla.edu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="fRTz2dCEhfdQXhS0" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --fRTz2dCEhfdQXhS0 Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Date: Thu, 9 Nov 2023 12:13:24 +0100 From: Alejandro Colomar To: Jonny Grant Cc: Paul Eggert , Carlos O'Donell , Zack Weinberg , GNU libc development , 'linux-man' Subject: Re: strncpy clarify result may not be null terminated Hi Jonny, On Thu, Nov 09, 2023 at 10:13:24AM +0000, Jonny Grant wrote: > On 09/11/2023 00:29, Alejandro Colomar wrote: > How about following the style of the other man pages that put the notes a= bout each function below them? (rather than above) > https://man7.org/linux/man-pages/man3/string.3.html >=20 > size_t strlen(const char *s); > Return the length of the string s. >=20 >=20 > At the moment on string_copying there are // comments on the line above e= ach function. So the presentation of the information is different: >=20 > // Copy/catenate a string. > char *strcpy(char *restrict dst, const char *restrict src); > char *strcat(char *restrict dst, const char *restrict src); The reason for this presentation is that I want to first look at what they do, and only then look at the function you need to do that. So, if you want to copy from a character sequence into a string, you search for that, and it will tell you what functions you can use for that (strncat(3) is the only standard one). If you want to search for a specific function, you can always search with '/strncpy'. Cheers, Alex --=20 --fRTz2dCEhfdQXhS0 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE6jqH8KTroDDkXfJAnowa+77/2zIFAmVMvtQACgkQnowa+77/ 2zIElg//SVObc+FoZnlhHtKojtEWOK8zqhRtiCsZ3cy63ZKpnkEBInb6EMU0Ui7Q BecSQ1GW/m7HIb6+UhDiE1SfSerQQCBJ7kcsIFoJGFlZKCQRq+Ic/8+fx/EZ1b0G kzBIi7QCM6M64s2O7I4S6/rA53ScBme0DS1rZwSDDXbq5+AtMuFnfWZxwTsvflxK sHSF4daHD+9KJQMExq1LBGeqJFbwm90Mp7PSSCMCnC17hgsJCwmf7DXzLcIj0dlh NtK3v5f+I+niDEQqm1ITsR9FcAlUuQIjdXXIisi8Y5R17hGouNspcu1c9j7IJIg0 VDAn7ZQwZg30v8cQy7E0dLUlftAypMsY3YmOfkbTqFjj2qRCXh5iPXvlpf8xJP65 v5rEZPsyTg6BeMELbwYXPQ0kNFJkIp3+uLVewbj4x6LcrY2pE4VgkbOrjDJnvc66 dSjxL46dqQFVKl/ra+mh5kyV19cPr2lhCtxMAfXUx/45HIa2PVZ83xD51F8EwgDI oWOamHhBVEXJLfBG9T70hXp51IzY5uln6SU3vdZEefw3BiE0a9yTuqsSzB6D+i2V c3mLgSlblw8lszWi3MBaTK152Qh0Vdea3CHIZrtYggc6jNVijBZurWu+AEFjy+6I 2Hkg3jsn9ozj+XHxBb9rtUw/tsUp3bZBN3uAj4Ab9TMznE/jjNo= =53Va -----END PGP SIGNATURE----- --fRTz2dCEhfdQXhS0--