From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id 3C53C3858D1E for ; Thu, 9 Nov 2023 14:47:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3C53C3858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=jguk.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=jguk.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3C53C3858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::42b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699541229; cv=none; b=k5l/POdfxNUXeHUHn49bDor0+yRXhUEWu2gJr0p/UQ/RGZ/ZsSNBiTyNMaq7WVUKQK3T+LC/1XJsLCjflhLIJgzjJmlHSSFBUhQRAykiQ6El2jCnbdhEbYFQbQftvFiCdr5iuoDK1SPX83L2sNAnu/b5DMFFrWQVIPj3UV9XDc4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699541229; c=relaxed/simple; bh=2yCleMOTcK9y9wA6m3FEoDGvhXm00vvkVp4UjFZH9Ec=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=MYJRW0zqPezhhx1VkprV07xQiIT8ugaRX01Buettk+3x2NorUh0TGBrE7Uxi8Zxp/J3TnuJlNViNXrvU8/QKitbE2WtGraVXyDQI0KiY79s8dVVybshvKsbWo2Cm16CbpMdzF23j78+q4GzLLcs04EmEPHgb8R8iIp07XUVCzZc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-32daeed7771so512960f8f.3 for ; Thu, 09 Nov 2023 06:47:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jguk.org; s=google; t=1699541227; x=1700146027; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=YhFCLxW8LJp5VBNpr0oqDGKKi+8RqbZ4fMqaAAz4WWM=; b=EyBoYVSOIDEcNikKtYHwn2wbmMjruYitH3sHm+RdKr4NA+DvSMmJKm/KFoR22fuHne ZfP28u1w4CEID3vKkYY9cuYm5w2CMfgRKF+rF+oaLlTkahQ1nblGlxkkRDH0lmVlLU78 7lEEWY4tRs7qcx5RxnoUy+/ApJUMnbUJA2I/U6ZdpiTNz68PhllaZnHMqaQYqvtn9xtS jgR6M5PsdQ9ST9KlkyecrfedSHnykP1tjQAisYdpqyiCaV0wR6ZIPL7kGUu/2RgFua9f XT4q4dVpKdqF6FOk3DuU8AxcS0OQEPcP+FvcZY0Bv4WWcJqzsTHr6Js77oi+sO7T4SbK EBwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699541227; x=1700146027; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YhFCLxW8LJp5VBNpr0oqDGKKi+8RqbZ4fMqaAAz4WWM=; b=GwkDRYwpY126nfniGdvsIWN0dQDxzpllBHQFIKZc6ED9FKpbnAmaQLJYD10T2RZVFL cEOnWfAajX4oa4j40lMUIJl8AGIflnN1bX7V7wPrSF0j/22nKsQGo/v/fLZ7WxObAUYN VJwHBJWqxjM8+ZeJy1uk5vb3dcZ7qIMnbLWpzGTpwoaYmQbLlV3lee0HBenZEox5dsUK GaQwGqd6b9qSy6gV/VBlLlIaoMoHb8pffDbcZXbhpdglKOkeDXRDWsES2y1KuyxfiEuO dpaEZs7Jjr/nMsoK6lV6XQDXsTgR8XDOqeZPRS4hujyKpLhH0Sps6GA4Qk48kV3wqsUZ geXA== X-Gm-Message-State: AOJu0YxcszW3whYi+fhecq2dn4dZR1ShL8Vp+yVHqcgfa+81na5LvvIr dW3KgH0TuXzNmYpNrrhEKA1A8Q== X-Google-Smtp-Source: AGHT+IGFKCUL6vP+1IuHx2DpDkr09CDqy2XXJFFDT4XsinYGwu51CrABJymDyovR0jO+1MeYFIodWg== X-Received: by 2002:a5d:58ec:0:b0:32d:b55c:41fa with SMTP id f12-20020a5d58ec000000b0032db55c41famr3578843wrd.28.1699541226768; Thu, 09 Nov 2023 06:47:06 -0800 (PST) Received: from [192.168.0.12] (cpc87345-slou4-2-0-cust172.17-4.cable.virginm.net. [81.101.252.173]) by smtp.gmail.com with ESMTPSA id d5-20020adff2c5000000b0032d2f09d991sm7479026wrp.33.2023.11.09.06.47.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Nov 2023 06:47:06 -0800 (PST) Message-ID: <86f95c84-c26d-48ad-be82-5259573678fc@jguk.org> Date: Thu, 9 Nov 2023 14:47:05 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] stpncpy.3, string_copying.7: Clarify that st[rp]ncpy() do NOT produce a string To: Alejandro Colomar Cc: Paul Eggert , linux-man@vger.kernel.org, libc-alpha@sourceware.org, DJ Delorie , Matthew House , Oskari Pirhonen , Thorsten Kukuk , Adhemerval Zanella Netto , Zack Weinberg , "G. Branden Robinson" , Carlos O'Donell References: <20231108221638.37101-2-alx@kernel.org> <290c7650-bc39-4315-a9dd-7b9b7ec55333@cs.ucla.edu> <93436b5b-c373-4cbe-ae64-cc7c2f70f165@jguk.org> Content-Language: en-GB From: Jonny Grant In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,RCVD_IN_DNSWL_NONE,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: On 09/11/2023 14:35, Alejandro Colomar wrote: > Hi Jonny, > > On Thu, Nov 09, 2023 at 02:11:14PM +0000, Jonny Grant wrote: >> On 08/11/2023 23:06, Paul Eggert wrote: >>> On 11/8/23 14:17, Alejandro Colomar wrote: >>>> These copy*from*  a string >>> >>> Not necessarily. For example, in strncpy (DST, SRC, N), SRC need not be a string. >>> >>> By the way, have you looked at the recent (i.e., this-year) changes to the glibc manual's string section? They're relevant. >> >> That's a great reference page Paul, lots of useful information in the manual. >> https://www.gnu.org/software/libc/manual/html_node/String-and-Array-Utilities.html >> >> Re this man page: >> >> https://man7.org/linux/man-pages/man3/string.3.html >> >> Obsolete functions >> char *strncpy(char dest[restrict .n], const char src[restrict .n], >> size_t n); >> Copy at most n bytes from string src to dest, returning a >> pointer to the start of dest. > > Uh, I forgot about that page. I'll have a look at it and update it. At > least, I need to remove that "Obsolete functions". > >> >> >> It could clarify >> "Copy at most n bytes from string src to ARRAY dest, returning a >> pointer to the start of ARRAY dest." > > I think I prefer DJ's suggestion: > > "Fill a fixed‐width null‐padded buffer with bytes from a string." Better to make it clear it's null-padded after? "Fill a fixed‐width buffer with bytes from a string and pad with null bytes." I'll leave it with you. Kind regards Jonny