From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by sourceware.org (Postfix) with ESMTPS id CBB253858C33 for ; Thu, 9 Nov 2023 14:11:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CBB253858C33 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 CBB253858C33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::333 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699539079; cv=none; b=mDV+bTnIqODkBtuJklLPS13uqJBAwKicuysAd9zhFKdjSYxS3HTJu3qpCj3PlTwlH1JRZuOm8fiVqj5kbBabVYvNbVtv/kEt80CgaibCpNFBnhZqDCSvstgBswTknYB9ZMtsfyvPpnov4B61HcYK++P9W0qNCzDSzmY4yhB7ZIg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699539079; c=relaxed/simple; bh=Ng0oeGwNtKClh6cZk7MNwLa/iVWowC/3YCn6b8jwDKo=; h=DKIM-Signature:Message-ID:Date:MIME-Version:From:Subject:To; b=EizIB9Y4/yZvCdgxrhv0FPC20Yc9Ppbpyv6fY1VErL8pOJ5FVIWqE/LJ0Fo+5piZ3pBGZBPEob3f3LuELEixHQiXbrR3KKjnM7CsAmUHrlAvQLO6f2LafY5TcdJRIkRDJCc/1DIpN7A0ldU6cpCMOqGgiGWcw1M42ZGNoKqYM08= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4084e49a5e5so6610965e9.3 for ; Thu, 09 Nov 2023 06:11:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jguk.org; s=google; t=1699539075; x=1700143875; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=YqwZdZmbcWbGjqCVCfw7coY9GbPR+WBpYN3VcSQN5FY=; b=EgfNSR5dXzk9z2TCWnCKa6s59XoKkIcsv5/T1ch7hgKkr8MYCj69Si+vAJ8p4xL4I6 sQyR/DuOvzOot5tds2EsVkZvE6iF6VTJ9oD03s3CZnejRnHYDnx/j9FJG4cD283ui3rP JSgpTeGPBjZY4pz2w3JZZdq5s3nnzM0QheLTEhAX9fYAMvrfIphcZ0Zx9Ej0p225MVn/ k+I58wSKlOW6nsChAlDWItHjHjFP54nKanCw1DedkY/jl3yhJU3YT4QjS+a8AjptIORk igr5WRCqTJsYKl8qxuEsHfYZe0MyPEgTj41uLoQC69V2wpg4SUFROhZaFjcrMoJYHHkB aDPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699539075; x=1700143875; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YqwZdZmbcWbGjqCVCfw7coY9GbPR+WBpYN3VcSQN5FY=; b=QEZTt8PG6R3FCGItJXDGcTY7521Kfh3/mm6O/2aSN9K0nsXjHc10/h5K04cpvEmG3w 36qAVbtwoLMPxQI7jeFlxc1GugtEsTjQ4CnnjRRxcaicAQdeMg+DbGNRtiHynL5BbIV5 pKRqH7wOGR3R8abEvZeuQlznPzMUi2IHfI+bhFfEemeIvMgWZCQoE2HrB1ybrWQj3eOB 3TwM226WG9NO4D8KEY9k95IUCVJVVTsH5Z18XHPo61tIF0GGho2MUnBo6OSwlyNeOeY4 GcsWOcn02pzWX9YjVOA9UGuCvHT6YlP++gmTeDhPmZ13RZwdxug3G/r5yuNp+4dp6z9z K8Zg== X-Gm-Message-State: AOJu0YzdlYBJIZGFZ6un1PxCsyWGOm8H2N6vgC8gDmLUJ66OizR7fWvz ju7Kcsvn5Rj/4hT8rd3Vb7T+Uw== X-Google-Smtp-Source: AGHT+IHfMoTh7SOtIeXSXWEhuKm0aoE3pp2/POhZsPBnIOEh7SmCZpZLV3o4UZ0nAQrxG21uMTT0BQ== X-Received: by 2002:a05:600c:3d9a:b0:408:5bc6:a7d with SMTP id bi26-20020a05600c3d9a00b004085bc60a7dmr4331792wmb.19.1699539075381; Thu, 09 Nov 2023 06:11:15 -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 iv11-20020a05600c548b00b00405c7591b09sm2224191wmb.35.2023.11.09.06.11.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Nov 2023 06:11:15 -0800 (PST) Message-ID: <93436b5b-c373-4cbe-ae64-cc7c2f70f165@jguk.org> Date: Thu, 9 Nov 2023 14:11:14 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Jonny Grant Subject: Re: [PATCH] stpncpy.3, string_copying.7: Clarify that st[rp]ncpy() do NOT produce a string To: Paul Eggert , Alejandro Colomar , linux-man@vger.kernel.org Cc: 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> Content-Language: en-GB In-Reply-To: <290c7650-bc39-4315-a9dd-7b9b7ec55333@cs.ucla.edu> 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 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. It could clarify "Copy at most n bytes from string src to ARRAY dest, returning a pointer to the start of ARRAY dest." (caps for my emphasis in this email) Kind regards Jonny