From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 18 23:38:29 2024 Received: (at submit) by debbugs.gnu.org; 19 Nov 2024 04:38:29 +0000 Received: from localhost ([127.0.0.1]:40096 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDG0T-0006q6-1L for submit@debbugs.gnu.org; Mon, 18 Nov 2024 23:38:29 -0500 Received: from lists.gnu.org ([209.51.188.17]:43368) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDG0Q-0006py-Sn for submit@debbugs.gnu.org; Mon, 18 Nov 2024 23:38:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tDG0Q-0005KJ-N5 for bug-coreutils@gnu.org; Mon, 18 Nov 2024 23:38:26 -0500 Received: from mail-ua1-x932.google.com ([2607:f8b0:4864:20::932]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tDG0P-0000Cj-18 for bug-coreutils@gnu.org; Mon, 18 Nov 2024 23:38:26 -0500 Received: by mail-ua1-x932.google.com with SMTP id a1e0cc1a2514c-856ed9e5413so248632241.3 for ; Mon, 18 Nov 2024 20:38:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731991103; x=1732595903; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=+V+l5KjUN7OSvXJmtRhhsY0tQOhLgvKFg3Jug0DLamo=; b=CZ8Wl0RW4ZuZuDA2yS/+wzyZZPMeGvpMNM5Pd5MVP5szjnnmK9xa2vB9tujB4M7qGx VglBJZrQz+pkdT+G0h+4dM9dhl6mAvNKNCqJKKYaHM+WVdmTBp//Zb1JSWanBfAVi38u Mxc+YiyUtGW9mwUZYFzwyg3E3wUBZjiLrzhaqTivSTEDhk19v80QtspqlLIiBwu7G1/V WvzRCuhN/0dD4ohqpckRI9tme0MTUEc/Td5WvCmQa9fzp/ZujxRGIyOKv2V/yDICQ0AH lVrQq7xHfVTbYZnuAXtPaO8XRsOhmiCZIkT9laEXQUGdrqKJ1fyeKPtk87fRHvfxjxf0 QmbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731991103; x=1732595903; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+V+l5KjUN7OSvXJmtRhhsY0tQOhLgvKFg3Jug0DLamo=; b=vKZevPd5UHWFVye6FXDoYnk30nbUlINpWnLFZrSy2zUarv/O0QOh9PR1Yl8ARCmfgS x8S1YBsNLdaPGeV7mVXHFbVXUOFeW8TyN/NwoNmvYgcuJqs7ff5Bspz+vwjWqbWO/q7h rS7le3W8isu5F/K0EJTwU59B2J+xgzUvvz0ZKjcw9M5XM/lVEl+7+rGAkhCXNgNc0+rH DaVhaAzH3wNy8ReUjafIMU5HjEM7MNLNHyyFiC1WNhFx2w3WCDqnOlz0B4KZIFZsBMFb 3OMtkXn4VByJXVXJcwYftTY7N1EOdpgdTYbrXrfzAm8rbaNXRJB8b3vbRaA/BVQ8I/35 lWUA== X-Gm-Message-State: AOJu0YzM/6CxAzAMKpIwtZAu+h91hyiJvucn/JjevQlDyx7WS8SouEbK oqshaMh7wlL+fHsmDprZamzjQaDsk63ts9Xp/bONrFGhtFgMfrXuAmqnpg== X-Google-Smtp-Source: AGHT+IFpVx5oqhrNH19Pw+teak9GKwIRb4t5imXsTwpSc6w6d5JyylSBoZBKdcyG1L83UPCBrvyvLg== X-Received: by 2002:a67:f6d7:0:b0:4ad:63ab:f8d9 with SMTP id ada2fe7eead31-4ad63abfa17mr10472012137.2.1731991103413; Mon, 18 Nov 2024 20:38:23 -0800 (PST) Received: from localhost ([71.125.249.178]) by smtp.gmail.com with UTF8SMTPSA id 6a1803df08f44-6d40dbe039fsm44058196d6.8.2024.11.18.20.38.22 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 Nov 2024 20:38:23 -0800 (PST) From: Grisha Levit To: bug-coreutils@gnu.org Subject: tests/printf/printf-indexed failure on macOS Date: Mon, 18 Nov 2024 23:38:02 -0500 Message-ID: <20241119043822.69942-1-grishalevit@gmail.com> X-Mailer: git-send-email 2.47.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::932; envelope-from=grishalevit@gmail.com; helo=mail-ua1-x932.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) See the following two chunks from the test suite log on macOS 15: + printf_check ' 0 1 ' '%100$*d %s %s %s\n' 4 1 + cat + shift + env printf '%100$*d %s %s %s\n' 4 1 printf: '': Invalid argument + fail=1 + printf_check_err 'printf: '\''A'\'': expected a numeric value' '%0x2$s %2$s\n' A B + cat + shift + returns_ 1 env printf '%0x2$s %2$s\n' A B 02$s B + compare exp out + compare_dev_null_ exp out + test 2 = 2 + test xexp = x/dev/null + test xout = x/dev/null + return 2 + case $? in + compare_ exp out + LC_ALL=C + diff -u exp out --- exp 2024-11-18 23:32:01.486843241 -0500 +++ out 2024-11-18 23:32:01.492438694 -0500 @@ -1 +1 @@ -printf: 'A': expected a numeric value +printf: 'A': Invalid argument + fail=1 From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 19 10:11:49 2024 Received: (at 74427-done) by debbugs.gnu.org; 19 Nov 2024 15:11:49 +0000 Received: from localhost ([127.0.0.1]:43630 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDPtM-0002pD-TH for submit@debbugs.gnu.org; Tue, 19 Nov 2024 10:11:49 -0500 Received: from mail-wm1-f54.google.com ([209.85.128.54]:46225) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDPtK-0002p0-GI for 74427-done@debbugs.gnu.org; Tue, 19 Nov 2024 10:11:47 -0500 Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4315baa51d8so39908925e9.0 for <74427-done@debbugs.gnu.org>; Tue, 19 Nov 2024 07:11:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732029041; x=1732633841; darn=debbugs.gnu.org; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:sender:from:to:cc:subject:date :message-id:reply-to; bh=Bo+hieP0oXXyp7qE1sXKuPfBUJCn2m7+zADHTduPi70=; b=NzKyHvbW2GVvYgq2Rb4JkaEcjfBx2jWWa/SPAnlo/hL5kuCVV7nh3RkOhGbC4UcPKS Ip6uSxyhHrYoNuvtiRUkIyyvBEPd3JXPOFLv1Vqik0qCqCl8lRX5UK8nrPaG522wLnI5 f7aC9tfvCtn82DxSzl2wiifSPcy86yyKc/w/pEYDoNyKL0AmGBBMC7iqTgv+aFTRig+q H/T+MNxdZYpu6QedP9TBUrJ/t0Sp82KwFBNN5dvmTbMGBBvPAhF3PAZA11TdCv0N0ZSr yIp3jviiKA1Z0OvRTxmlTnZZ1J0AuBYQC3LjX2mQM0tIWdxXLl/ySXJecXgK5wiJnita kHqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732029041; x=1732633841; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Bo+hieP0oXXyp7qE1sXKuPfBUJCn2m7+zADHTduPi70=; b=uByxKj/0URsMSZg0qhsTMVjP7Sxx24d0ap62YRAUVYyh0/S2GxqKAxbGpk/HJzV/5+ mEN6JphotIPzje1dXPTZQ8IBLBACdQZkKMDpcfsBmSG1N33IqZN3IT444Hdk2+RUf7U8 6vq/um45VG7XzPzx2sGBVWzG1kpAE0963KRxF9VK7Z3R+7ygnfhhwW2lrgHF2DP4ZowR cmteeSz3zBU8JIzxluoq06Q0ePqP2Bu1Z9c8IUxLtt1HEkZ6pvu5b0MWfK7yD+8PwmWs OLnVNcaezNh0TnOJXKeB/5dU/7qTqfx+/JqcAd70bENOOJ02uw482Gdjja1rCD2mNhGi T5ww== X-Forwarded-Encrypted: i=1; AJvYcCWFrdD03cZeXcTFBfVA3DsSxsop51/Lq2wQfiva4PYZaQ3Gh4YratlITmkWIXL7ErI7ZiZ0stz1hjp2@debbugs.gnu.org X-Gm-Message-State: AOJu0Yw4sFH0lG5YytUB9TkG/MEdBtPwR4HZMPVIt+2kULdcmj3Ln6Y4 9ImgXjuN6/NP1dissf9AwDx/qnngJynyhtFc/y8pr1qguzg5HQTj X-Google-Smtp-Source: AGHT+IExJ8mop5vvyh0GXflDfh2XsltFuAcxzqjEhGBXz5rkF3Xrku5EcWxhYNFqLWXbEp8n//FLcA== X-Received: by 2002:a05:600c:1911:b0:432:d797:4071 with SMTP id 5b1f17b1804b1-432df790785mr122038445e9.32.1732029040220; Tue, 19 Nov 2024 07:10:40 -0800 (PST) Received: from [192.168.1.19] (86-44-211-146-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.44.211.146]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-432dab78918sm192275525e9.17.2024.11.19.07.10.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Nov 2024 07:10:39 -0800 (PST) Content-Type: multipart/mixed; boundary="------------6cZuKbd10eOsYdJKUXLJEQuG" Message-ID: Date: Tue, 19 Nov 2024 15:10:37 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: bug#74427: tests/printf/printf-indexed failure on macOS To: Grisha Levit , 74427-done@debbugs.gnu.org References: <20241119043822.69942-1-grishalevit@gmail.com> Content-Language: en-US From: =?UTF-8?Q?P=C3=A1draig_Brady?= In-Reply-To: <20241119043822.69942-1-grishalevit@gmail.com> X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 74427-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) This is a multi-part message in MIME format. --------------6cZuKbd10eOsYdJKUXLJEQuG Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 19/11/2024 04:38, Grisha Levit wrote: > See the following two chunks from the test suite log on macOS 15: > > + printf_check ' 0 1 ' '%100$*d %s %s %s\n' 4 1 > + cat > + shift > + env printf '%100$*d %s %s %s\n' 4 1 > printf: '': Invalid argument > + fail=1 > > + printf_check_err 'printf: '\''A'\'': expected a numeric value' '%0x2$s %2$s\n' A B > + cat > + shift > + returns_ 1 env printf '%0x2$s %2$s\n' A B > 02$s B > + compare exp out > + compare_dev_null_ exp out > + test 2 = 2 > + test xexp = x/dev/null > + test xout = x/dev/null > + return 2 > + case $? in > + compare_ exp out > + LC_ALL=C > + diff -u exp out > --- exp 2024-11-18 23:32:01.486843241 -0500 > +++ out 2024-11-18 23:32:01.492438694 -0500 > @@ -1 +1 @@ > -printf: 'A': expected a numeric value > +printf: 'A': Invalid argument > + fail=1 This is due to inconsistency in how strtol and strtoimax operate on macos. The man page for those on macos states: "If no conversion could be performed, 0 is returned and the global variable errno is set to EINVAL (the last feature is not portable across all platforms)." So in particular, we'll have to handle the NUL string in code, to ensure it returns 0, and adjust the test to treat EINVAL like "expected a numeric value". I've not got access to a macos system to test currently, but the attached should address this. Marking this as done. thanks, Pádraig --------------6cZuKbd10eOsYdJKUXLJEQuG Content-Type: text/x-patch; charset=UTF-8; name="printf-indexed-macos.patch" Content-Disposition: attachment; filename="printf-indexed-macos.patch" Content-Transfer-Encoding: base64 RnJvbSBkODk4MjVjMzE1Y2JmNTM5OWQ2YmFiNTY2N2I0ZTY1ZTNhZDg0ODgzIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiA9P1VURi04P3E/UD1DMz1BMWRyYWlnPTIwQnJhZHk/ PSA8UEBkcmFpZ0JyYWR5LmNvbT4KRGF0ZTogVHVlLCAxOSBOb3YgMjAyNCAxNTowMjowMyAr MDAwMApTdWJqZWN0OiBbUEFUQ0hdIHByaW50ZjogZW5zdXJlIGVtcHR5IHN0cmluZ3MgY29y cmVzcG9uZCB0byAwCgoqIHNyYy9wcmludGYuYyAoU1RSVE9YKTogRW5zdXJlIHdlIHByaW50 IDAgZm9yIGVtcHR5IHN0cmluZ3MuClRoaXMgYXZvaWRzIEVJTlZBTCBvbiBtYWNvcyBhdCBs ZWFzdC4KKiB0ZXN0cy9wcmludGYvcHJpbnRmLWluZGV4ZWQuc2g6IEFkanVzdCBFSU5WQUwg ZXJyb3IsCnJldHVybmVkIG9uIG1hY29zIGZvciBub24gZW1wdHkgaW52YWxpZCBudW1lcmlj IHN0cmluZ3MsCnRvIHRoZSBjb3JyZXNwb25kaW5nIGludGVybmFsIGVycm9yIHVzZWQgb24g c3lzdGVtcwp0aGF0IGRvbid0IHNldCBlcnJubyBpbiB0aGlzIGNhc2UuCkZpeGVzIGh0dHBz Oi8vYnVncy5nbnUub3JnLzc0NDI3Ci0tLQogc3JjL3ByaW50Zi5jICAgICAgICAgICAgICAg ICAgIHwgNCArKy0tCiB0ZXN0cy9wcmludGYvcHJpbnRmLWluZGV4ZWQuc2ggfCA3ICsrKysr LS0KIDIgZmlsZXMgY2hhbmdlZCwgNyBpbnNlcnRpb25zKCspLCA0IGRlbGV0aW9ucygtKQoK ZGlmZiAtLWdpdCBhL3NyYy9wcmludGYuYyBiL3NyYy9wcmludGYuYwppbmRleCBmYjExZjg0 YTkuLmMyZmFkNzMzZSAxMDA2NDQKLS0tIGEvc3JjL3ByaW50Zi5jCisrKyBiL3NyYy9wcmlu dGYuYwpAQCAtMTI0LDcgKzEyNCw3IEBAIHN0YXRpYyBUWVBFCQkJCQkJCQkgXAogRlVOQ19O QU1FIChjaGFyIGNvbnN0ICpzKQkJCQkJCSBcCiB7CQkJCQkJCQkJIFwKICAgY2hhciAqZW5k OwkJCQkJCQkJIFwKLSAgVFlQRSB2YWw7CQkJCQkJCQkgXAorICBUWVBFIHZhbCA9IDA7CQkJ CQkJCQkgXAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKICAgaWYgKCgqcyA9PSAnXCInIHx8ICpz ID09ICdcJycpICYmICoocyArIDEpKQkJCQkgXAogICAgIHsJCQkJCQkJCQkgXApAQCAtMTUz LDcgKzE1Myw3IEBAIEZVTkNfTkFNRSAoY2hhciBjb25zdCAqcykJCQkJCQkgXAogICAgICAg aWYgKCorK3MgIT0gMCAmJiAhcG9zaXhseV9jb3JyZWN0KQkJCQkgXAogICAgICAgICBlcnJv ciAoMCwgMCwgXyhjZmNjX21zZyksIHMpOwkJCQkJIFwKICAgICB9CQkJCQkJCQkJIFwKLSAg ZWxzZQkJCQkJCQkJCSBcCisgIGVsc2UgaWYgKCpzKQkJCQkJCQkJIFwKICAgICB7CQkJCQkJ CQkJIFwKICAgICAgIGVycm5vID0gMDsJCQkJCQkJIFwKICAgICAgIHZhbCA9IChMSUJfRlVO Q19FWFBSKTsJCQkJCQkgXApkaWZmIC0tZ2l0IGEvdGVzdHMvcHJpbnRmL3ByaW50Zi1pbmRl eGVkLnNoIGIvdGVzdHMvcHJpbnRmL3ByaW50Zi1pbmRleGVkLnNoCmluZGV4IDdhNzc0NDQz Ni4uYWE0ZTM0MGI2IDEwMDc1NQotLS0gYS90ZXN0cy9wcmludGYvcHJpbnRmLWluZGV4ZWQu c2gKKysrIGIvdGVzdHMvcHJpbnRmL3ByaW50Zi1pbmRleGVkLnNoCkBAIC0xOCw3ICsxOCw3 IEBACiAKIC4gIiR7c3JjZGlyPS59L3Rlc3RzL2luaXQuc2giOyBwYXRoX3ByZXBlbmRfIC4v c3JjCiBwcmludF92ZXJfIHByaW50ZgotaQorCiBnZXRsaW1pdHNfCiAKIHByb2c9J2VudiBw cmludGYnCkBAIC00MSw3ICs0MSwxMCBAQCBFT0YKIAogICBzaGlmdAogCi0gIHJldHVybnNf IDEgJHByb2cgIiRAIiAyPiBvdXQgfHwgZmFpbD0xCisgIHJldHVybnNfIDEgJHByb2cgIiRA IiAyPiBvdXQudCB8fCBmYWlsPTEKKyAgIyBNYXAgRUlOVkFMIGZyb20gc3lzdGVtcyBsaWtl IG1hY29zIHRvIGludGVybmFsIGVycm9yCisgIHNlZCAtZSAncy9JbnZhbGlkIGFyZ3VtZW50 L2V4cGVjdGVkIGEgbnVtZXJpYyB2YWx1ZS8nIFwKKyAgICA8IG91dC50ID4gb3V0IHx8IGZy YW1ld29ya19mYWlsdXJlXwogICBjb21wYXJlIGV4cCBvdXQgfHwgZmFpbD0xCiB9CiAKLS0g CjIuNDcuMAoK --------------6cZuKbd10eOsYdJKUXLJEQuG-- From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 19 11:47:13 2024 Received: (at 74427) by debbugs.gnu.org; 19 Nov 2024 16:47:13 +0000 Received: from localhost ([127.0.0.1]:43823 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDRNg-0007Av-OC for submit@debbugs.gnu.org; Tue, 19 Nov 2024 11:47:13 -0500 Received: from mail.cs.ucla.edu ([131.179.128.66]:54930) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDRNe-0007Ah-9R for 74427@debbugs.gnu.org; Tue, 19 Nov 2024 11:47:11 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 5502F3C011BD7; Tue, 19 Nov 2024 08:47:04 -0800 (PST) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id VhHXhZVNBLfI; Tue, 19 Nov 2024 08:47:03 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id D99D03C00FB20; Tue, 19 Nov 2024 08:47:03 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu D99D03C00FB20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1732034823; bh=B36GmtcL/YGQCRTxQOsPVU0yejxoVyssYlXgfAJ3bok=; h=Message-ID:Date:MIME-Version:To:From; b=AZEFVXuR5VcZx1yuhv2JUSMoqXI/KcAQqwC3XXwlc7sUi5xWof3XjbGL4qhgxvpx2 Z9xd8JcVdxYoX6kzHvGNIJQh19vmfkFnkJ+NrSO7b+xUQmIHS9VR4anUTJ8FcVO1iy 6270hoxgK3J1cfXpRF43djXK5lfi8vVhiveEWGnomtV8rpcBH4Oxe2yVsrPNZudv0m Ds2R1rSL35CxAAykRASnIbT7ay2d66/voeuszsz0me1tt3I4jBIVklyx3W3AoSfyHm Xe2GiwjpEg7y69QnOsxUhaEQAqlscjyYyIEabWqv6H5O7RQmwipBFVU9ec8Ru2tI6u 5UD5yoUwvEeaw== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id Jf5WbbJR8RbP; Tue, 19 Nov 2024 08:47:03 -0800 (PST) Received: from [192.168.254.12] (unknown [47.150.137.250]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id BB1C53C011BD7; Tue, 19 Nov 2024 08:47:03 -0800 (PST) Content-Type: multipart/mixed; boundary="------------nGGAi0NfqpIRsQhxlZDqcMa0" Message-ID: Date: Tue, 19 Nov 2024 08:47:03 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#74427: tests/printf/printf-indexed failure on macOS To: 74427@debbugs.gnu.org, P@draigBrady.com, grishalevit@gmail.com References: <20241119043822.69942-1-grishalevit@gmail.com> Content-Language: en-US From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 74427 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --------------nGGAi0NfqpIRsQhxlZDqcMa0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable On 2024-11-19 07:10, P=C3=A1draig Brady wrote: > I've not got access to a macos system to test currently, > but the attached should address this. That patch addresses only the empty string, not other strings that=20 cannot be converted (e.g., a string consisting of a single space). This=20 turns out to be a longstanding bug in printf. I installed the attached=20 fancier patch which should address the more-general problem, and which=20 adds some test cases. I tested this on cfarm104.cfarm.net which is=20 running macOS 12.6. --------------nGGAi0NfqpIRsQhxlZDqcMa0 Content-Type: text/x-patch; charset=UTF-8; name="0001-printf-diagnose-empty-args-correctly.patch" Content-Disposition: attachment; filename="0001-printf-diagnose-empty-args-correctly.patch" Content-Transfer-Encoding: base64 RnJvbSA5MWU5NWYxZjg2OTc3YTY2YWMwZDYxNjVmNmRiNTU0ZWZmMTc0MTI4IE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBQYXVsIEVnZ2VydCA8ZWdnZXJ0QGNzLnVjbGEuZWR1 PgpEYXRlOiBNb24sIDE4IE5vdiAyMDI0IDE4OjE5OjU0IC0wODAwClN1YmplY3Q6IFtQQVRD SF0gcHJpbnRmOiBkaWFnbm9zZSBlbXB0eSBhcmdzIGNvcnJlY3RseQpNSU1FLVZlcnNpb246 IDEuMApDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9VVRGLTgKQ29udGVudC1U cmFuc2Zlci1FbmNvZGluZzogOGJpdAoKQWxzbywgcG9ydCBiZXR0ZXIgdG8gbWFjT1MuCiog c3JjL3ByaW50Zi5jICh2ZXJpZnlfbnVtZXJpYyk6IERvbuKAmXQgYXNzdW1lIHRoYXQgd2hl biBzID09IGVuZAp0aGVuIGVycm5vIGlzIHplcm87IGl0IGlzIEVJTlZBTCBvbiBtYWNPUywg YW5kIFBPU0lYIGFsbG93cyB0aGlzLgoocHJpbnRfZGlyZWMpOiBUcmVhdCBtaXNzaW5nIGFy ZyBhcyB6ZXJvIGZvciBudW1lcmljIGNvbnZlcnNpb25zLAphbmQgYXMgYW4gZW1wdHkgc3Ry aW5nIGZvciB0aGUgb3RoZXJzLgoocHJpbnRfZm9ybWF0dGVkKTogVXNlIG51bGwgcG9pbnRl ciwgbm90IGFuIGVtcHR5IHN0cmluZywKdG8gcmVwcmVzZW50IG1pc3NpbmcgYXJnLgoqIHRl c3RzL3ByaW50Zi9wcmludGYuc2g6IFRlc3QgZW1wdHkgYW5kIHNwYWNlIHdpZHRocyBhbmQg cHJlY2lzaW9ucy4KLS0tCiBzcmMvcHJpbnRmLmMgICAgICAgICAgIHwgMzMgKysrKysrKysr KysrKysrKysrKystLS0tLS0tLS0tLS0tCiB0ZXN0cy9wcmludGYvcHJpbnRmLnNoIHwgIDkg KysrKysrKysrCiAyIGZpbGVzIGNoYW5nZWQsIDI5IGluc2VydGlvbnMoKyksIDEzIGRlbGV0 aW9ucygtKQoKZGlmZiAtLWdpdCBhL3NyYy9wcmludGYuYyBiL3NyYy9wcmludGYuYwppbmRl eCA0ODhlOGUwMDYuLmQ3NzMwYWU2YyAxMDA2NDQKLS0tIGEvc3JjL3ByaW50Zi5jCisrKyBi L3NyYy9wcmludGYuYwpAQCAtMTA0LDE3ICsxMDQsMTkgQEAgQVJHVU1FTlRzIGNvbnZlcnRl ZCB0byBwcm9wZXIgdHlwZSBmaXJzdC4gIFZhcmlhYmxlIHdpZHRocyBhcmUgaGFuZGxlZC5c blwKIHN0YXRpYyB2b2lkCiB2ZXJpZnlfbnVtZXJpYyAoY2hhciBjb25zdCAqcywgY2hhciBj b25zdCAqZW5kKQogewotICBpZiAoZXJybm8pCisgIGlmIChzID09IGVuZCkKKyAgICB7Cisg ICAgICBlcnJvciAoMCwgMCwgXygiJXM6IGV4cGVjdGVkIGEgbnVtZXJpYyB2YWx1ZSIpLCBx dW90ZSAocykpOworICAgICAgZXhpdF9zdGF0dXMgPSBFWElUX0ZBSUxVUkU7CisgICAgfQor ICBlbHNlIGlmIChlcnJubykKICAgICB7CiAgICAgICBlcnJvciAoMCwgZXJybm8sICIlcyIs IHF1b3RlIChzKSk7CiAgICAgICBleGl0X3N0YXR1cyA9IEVYSVRfRkFJTFVSRTsKICAgICB9 CiAgIGVsc2UgaWYgKCplbmQpCiAgICAgewotICAgICAgaWYgKHMgPT0gZW5kKQotICAgICAg ICBlcnJvciAoMCwgMCwgXygiJXM6IGV4cGVjdGVkIGEgbnVtZXJpYyB2YWx1ZSIpLCBxdW90 ZSAocykpOwotICAgICAgZWxzZQotICAgICAgICBlcnJvciAoMCwgMCwgXygiJXM6IHZhbHVl IG5vdCBjb21wbGV0ZWx5IGNvbnZlcnRlZCIpLCBxdW90ZSAocykpOworICAgICAgZXJyb3Ig KDAsIDAsIF8oIiVzOiB2YWx1ZSBub3QgY29tcGxldGVseSBjb252ZXJ0ZWQiKSwgcXVvdGUg KHMpKTsKICAgICAgIGV4aXRfc3RhdHVzID0gRVhJVF9GQUlMVVJFOwogICAgIH0KIH0KQEAg LTM0NCw3ICszNDYsNyBAQCBwcmludF9kaXJlYyAoY2hhciBjb25zdCAqc3RhcnQsIGNoYXIg Y29udmVyc2lvbiwKICAgICBjYXNlICdkJzoKICAgICBjYXNlICdpJzoKICAgICAgIHsKLSAg ICAgICAgaW50bWF4X3QgYXJnID0gdnN0cnRvaW1heCAoYXJndW1lbnQpOworICAgICAgICBp bnRtYXhfdCBhcmcgPSBhcmd1bWVudCA/IHZzdHJ0b2ltYXggKGFyZ3VtZW50KSA6IDA7CiAg ICAgICAgIGlmICghaGF2ZV9maWVsZF93aWR0aCkKICAgICAgICAgICB7CiAgICAgICAgICAg ICBpZiAoIWhhdmVfcHJlY2lzaW9uKQpAQCAtMzY3LDcgKzM2OSw3IEBAIHByaW50X2RpcmVj IChjaGFyIGNvbnN0ICpzdGFydCwgY2hhciBjb252ZXJzaW9uLAogICAgIGNhc2UgJ3gnOgog ICAgIGNhc2UgJ1gnOgogICAgICAgewotICAgICAgICB1aW50bWF4X3QgYXJnID0gdnN0cnRv dW1heCAoYXJndW1lbnQpOworICAgICAgICB1aW50bWF4X3QgYXJnID0gYXJndW1lbnQgPyB2 c3RydG91bWF4IChhcmd1bWVudCkgOiAwOwogICAgICAgICBpZiAoIWhhdmVfZmllbGRfd2lk dGgpCiAgICAgICAgICAgewogICAgICAgICAgICAgaWYgKCFoYXZlX3ByZWNpc2lvbikKQEAg LTM5NCw3ICszOTYsNyBAQCBwcmludF9kaXJlYyAoY2hhciBjb25zdCAqc3RhcnQsIGNoYXIg Y29udmVyc2lvbiwKICAgICBjYXNlICdnJzoKICAgICBjYXNlICdHJzoKICAgICAgIHsKLSAg ICAgICAgbG9uZyBkb3VibGUgYXJnID0gdnN0cnRvbGQgKGFyZ3VtZW50KTsKKyAgICAgICAg bG9uZyBkb3VibGUgYXJnID0gYXJndW1lbnQgPyB2c3RydG9sZCAoYXJndW1lbnQpIDogMDsK ICAgICAgICAgaWYgKCFoYXZlX2ZpZWxkX3dpZHRoKQogICAgICAgICAgIHsKICAgICAgICAg ICAgIGlmICghaGF2ZV9wcmVjaXNpb24pCkBAIC00MTMsMTMgKzQxNSwxOCBAQCBwcmludF9k aXJlYyAoY2hhciBjb25zdCAqc3RhcnQsIGNoYXIgY29udmVyc2lvbiwKICAgICAgIGJyZWFr OwogCiAgICAgY2FzZSAnYyc6Ci0gICAgICBpZiAoIWhhdmVfZmllbGRfd2lkdGgpCi0gICAg ICAgIHhwcmludGYgKHAsICphcmd1bWVudCk7Ci0gICAgICBlbHNlCi0gICAgICAgIHhwcmlu dGYgKHAsIGZpZWxkX3dpZHRoLCAqYXJndW1lbnQpOworICAgICAgeworICAgICAgICBjaGFy IGMgPSBhcmd1bWVudCA/ICphcmd1bWVudCA6ICdcMCc7CisgICAgICAgIGlmICghaGF2ZV9m aWVsZF93aWR0aCkKKyAgICAgICAgICB4cHJpbnRmIChwLCBjKTsKKyAgICAgICAgZWxzZQor ICAgICAgICAgIHhwcmludGYgKHAsIGZpZWxkX3dpZHRoLCBjKTsKKyAgICAgIH0KICAgICAg IGJyZWFrOwogCiAgICAgY2FzZSAncyc6CisgICAgICBpZiAoIWFyZ3VtZW50KQorICAgICAg ICBhcmd1bWVudCA9ICIiOwogICAgICAgaWYgKCFoYXZlX2ZpZWxkX3dpZHRoKQogICAgICAg ICB7CiAgICAgICAgICAgaWYgKCFoYXZlX3ByZWNpc2lvbikKQEAgLTY2Miw3ICs2NjksNyBA QCBwcmludF9mb3JtYXR0ZWQgKGNoYXIgY29uc3QgKmZvcm1hdCwgaW50IGFyZ2MsIGNoYXIg Kiphcmd2KQogICAgICAgICAgIHByaW50X2RpcmVjIChkaXJlYywgKmFjLmYsCiAgICAgICAg ICAgICAgICAgICAgICAgIGhhdmVfZmllbGRfd2lkdGgsIGZpZWxkX3dpZHRoLAogICAgICAg ICAgICAgICAgICAgICAgICBoYXZlX3ByZWNpc2lvbiwgcHJlY2lzaW9uLAotICAgICAgICAg ICAgICAgICAgICAgICBhcmdjIDw9IGFjLmN1cnJfYXJnID8gIiIgOiBhcmd2W2FjLmN1cnJf YXJnXSk7CisgICAgICAgICAgICAgICAgICAgICAgIGFjLmN1cnJfYXJnIDwgYXJnYyA/IGFy Z3ZbYWMuY3Vycl9hcmddIDogbnVsbHB0cik7CiAKICAgICAgICAgICBicmVhazsKIApkaWZm IC0tZ2l0IGEvdGVzdHMvcHJpbnRmL3ByaW50Zi5zaCBiL3Rlc3RzL3ByaW50Zi9wcmludGYu c2gKaW5kZXggN2U0ODkxNjFlLi5hNDExYjlkOWYgMTAwNzU1Ci0tLSBhL3Rlc3RzL3ByaW50 Zi9wcmludGYuc2gKKysrIGIvdGVzdHMvcHJpbnRmL3ByaW50Zi5zaApAQCAtNzMsNiArNzMs MTEgQEAgcmV0dXJuc18gMSAkcHJvZyAnJS4qZHhcbicgJElOVF9PRkxPVyAwID4+b3V0IDI+ IC9kZXYvbnVsbCB8fCBmYWlsPTEKIAogJHByb2cgJzExICUqY1xuJyAyIHggPj5vdXQgfHwg ZmFpbD0xCiAKK3JldHVybnNfIDEgJHByb2cgJzEyICUqc1xuJyAnJyAnZW1wdHkgd2lkdGgn ID4+b3V0IDI+L2Rldi9udWxsIHx8IGZhaWw9MQorcmV0dXJuc18gMSAkcHJvZyAnMTMgJSpz XG4nICcgJyAnc3BhY2Ugd2lkdGgnID4+b3V0IDI+L2Rldi9udWxsIHx8IGZhaWw9MQorcmV0 dXJuc18gMSAkcHJvZyAnMTQgJS4qc3hcbicgJycgJ2VtcHR5IHByZWNpc2lvbicgPj5vdXQg Mj4vZGV2L251bGwgfHwgZmFpbD0xCityZXR1cm5zXyAxICRwcm9nICcxNSAlLipzeFxuJyAn ICcgJ3NwYWNlIHByZWNpc2lvbicgPj5vdXQgMj4vZGV2L251bGwgfHwgZmFpbD0xCisKIHJl dHVybnNfIDEgJHByb2cgJyUjZFxuJyAwID4+b3V0IDI+IC9kZXYvbnVsbCB8fCBmYWlsPTEK IAogcmV0dXJuc18gMSAkcHJvZyAnJTBzXG4nIDAgPj5vdXQgMj4gL2Rldi9udWxsIHx8IGZh aWw9MQpAQCAtOTMsNiArOTgsMTAgQEAgY2F0IDw8XEVPRiA+IGV4cAogOSAwIHgKIDEwIDB4 CiAxMSAgeAorMTIgZW1wdHkgd2lkdGgKKzEzIHNwYWNlIHdpZHRoCisxNCB4CisxNSB4CiBF T0YKIAogY29tcGFyZSBleHAgb3V0IHx8IGZhaWw9MQotLSAKMi40My4wCgo= --------------nGGAi0NfqpIRsQhxlZDqcMa0-- From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 19 12:54:07 2024 Received: (at 74427) by debbugs.gnu.org; 19 Nov 2024 17:54:07 +0000 Received: from localhost ([127.0.0.1]:43925 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDSQQ-0001cY-VL for submit@debbugs.gnu.org; Tue, 19 Nov 2024 12:54:07 -0500 Received: from mail-wr1-f41.google.com ([209.85.221.41]:45199) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDSQO-0001cM-Sg for 74427@debbugs.gnu.org; Tue, 19 Nov 2024 12:54:05 -0500 Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-38241435528so2074866f8f.2 for <74427@debbugs.gnu.org>; Tue, 19 Nov 2024 09:54:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732038784; x=1732643584; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=Nvn0OLmrRgRTiy655cRR9JEmvKF1/21UD20yXcRUTjY=; b=Jb/CYM2bJdF3YtBLRm8Syu1N9mI5B2r6Wgg5OF9FHCQZsgaeL8eIkmMECuH/j4dQ/F vwcXuFICQRSSfY9KQVYqqM9nSRnZBBVMEvyHS1IhGyJ06c/1/Z+y31OcdkP5NBjrEvnL tuHbZR4NNxTaPtxTDnuFcMObfgrUj4yo4O90mY9jMIS7s5Yj780hmG0t0Ch5paPddC1o 133MLzRtCX5N/wotxBwk9iqEcdkGnqE5u52OLSJQVojUndNyYhYsKTuelPIkYxb7urTr CCsI8rJSt97t1GSa02M7grSSRTTZcca0RH1yTxNXlKoDEUyDEx2+fz6R9RgL+l/yBzJM id8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732038784; x=1732643584; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Nvn0OLmrRgRTiy655cRR9JEmvKF1/21UD20yXcRUTjY=; b=g5VwKONWYrldTSNWmwebnCKbH4KXxxLgpGW6a+pasfBpNyOEoPBOjkq1AwRBbySXww nEJ0+wZrMf5SjP0D51+sof7JEdKBIjJSUiHT/rqZZeNxi0elEvX4oSMqUV6UK7BJ/M+B O+S/qGz1dRuSD2cky26AzpJZSMwVtYsqzR8ifNPc3qzBwXExvLAh0w2gkE2fERG+VLro snIBESH3+tnVsZ0ZHxX8NwIJuSIqEVpe4wikFV2Y8m78MioQ8g5sSAR8vaJ6iItdn7O+ saUu/Yqn0gG9UorGU3PHP1NPKCs5cdYiaywLodkQec5O55bvmFDGanAzuNhWXhOEINlf LKWA== X-Forwarded-Encrypted: i=1; AJvYcCUPyExzXwNnz8QgkfeEUJFOB/56lfqGuyU0hCF/yz8lJg70oBQn+SVqo+O36AfdYYEaVgc7gg==@debbugs.gnu.org X-Gm-Message-State: AOJu0Ywwh8WGvixcaE5FJHnDpRBe67j9tNbjHoJRuol3+Aa6dms3bvY3 Yu1VxOnfEH9lj8e225/Q8o44FVi/kuBwiMix9XPWCx1TQ/vthZKhmQ+V0g== X-Google-Smtp-Source: AGHT+IFve3mTYpo6HvvoxmH6/5ZuXadild53+880otFChRH8cxb7MFuQo+ho7Ngq8zvwiciq/KrKKQ== X-Received: by 2002:a05:6000:2904:b0:382:4aa0:e728 with SMTP id ffacd0b85a97d-3824aa0e803mr6035908f8f.1.1732038783878; Tue, 19 Nov 2024 09:53:03 -0800 (PST) Received: from [192.168.1.19] (86-44-211-146-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.44.211.146]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38230e88f57sm12065848f8f.94.2024.11.19.09.53.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Nov 2024 09:53:03 -0800 (PST) Message-ID: Date: Tue, 19 Nov 2024 17:53:01 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: bug#74427: tests/printf/printf-indexed failure on macOS To: Paul Eggert , 74427@debbugs.gnu.org, grishalevit@gmail.com References: <20241119043822.69942-1-grishalevit@gmail.com> Content-Language: en-US From: =?UTF-8?Q?P=C3=A1draig_Brady?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 74427 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 19/11/2024 16:47, Paul Eggert wrote: > On 2024-11-19 07:10, Pádraig Brady wrote: >> I've not got access to a macos system to test currently, >> but the attached should address this. > > That patch addresses only the empty string, not other strings that > cannot be converted (e.g., a string consisting of a single space). This > turns out to be a longstanding bug in printf. I installed the attached > fancier patch which should address the more-general problem, and which > adds some test cases. I tested this on cfarm104.cfarm.net which is > running macOS 12.6. Do we really want to treat NUL and NULL strings differently? $ src/printf '%d\n' 0 $ src/printf '%d\n' '' printf: ‘’: expected a numeric value 0 That's different to bash and dash. More problematically I think is it's also inconsistent with %s $ src/printf '%s' $ src/printf '%s' '' BTW after we decide the best operation, we should update NEWS. I had done this locally like: printf consistently outputs 0 for numeric conversions of empty strings. Previously on systems like macos, it would have failed with an error. cheers, Pádraig From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 19 15:02:51 2024 Received: (at 74427) by debbugs.gnu.org; 19 Nov 2024 20:02:51 +0000 Received: from localhost ([127.0.0.1]:44125 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDUR0-0007MI-NU for submit@debbugs.gnu.org; Tue, 19 Nov 2024 15:02:51 -0500 Received: from mail.cs.ucla.edu ([131.179.128.66]:58742) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDUQz-0007M5-9G for 74427@debbugs.gnu.org; Tue, 19 Nov 2024 15:02:50 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id EB7683C011BE0; Tue, 19 Nov 2024 12:02:42 -0800 (PST) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id 9Gc_I25DIF2B; Tue, 19 Nov 2024 12:02:41 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 9258D3C00FB20; Tue, 19 Nov 2024 12:02:41 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 9258D3C00FB20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1732046561; bh=oNqr0a1nIMD36W5lw2mk40fvFsQIvD3Ge4AIrYLZIUQ=; h=Message-ID:Date:MIME-Version:To:From; b=LyPvlISOgkizjgharWB7gUYzbVuYHeDR8nK6ZKv+VGEAz4Ay8U6ELtxzTLLxqw8z5 PB714uGWBUkPmkJKcNWUFpuyyfxdjcQbY2+7OKR+LjoEMBapTR8fS5Smp3upBW40bn DtzXG2ICMfyZPGe7Y6ivLjPgtsshwtt5BxeuJB/4Sr34xOzcJ+7hYobB5P3qQ2kq8i sa7QNpHLh1UH/JrWI6N84yp4FdcFsxcGeJfYREKtHer/OkakgnCZ+SrblJcrFu/gJr PPtgddeNTwa2IokNy08zQgGHr9KSI0DFYYWHy3aNAELDb0epJDYQZe/A4VMgspOPbQ tRiBJXE0hsCVQ== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id NPX9aCtXn96W; Tue, 19 Nov 2024 12:02:41 -0800 (PST) Received: from [192.168.254.12] (unknown [47.150.137.250]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 7091E3C011BE0; Tue, 19 Nov 2024 12:02:41 -0800 (PST) Message-ID: Date: Tue, 19 Nov 2024 12:02:41 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#74427: tests/printf/printf-indexed failure on macOS To: =?UTF-8?Q?P=C3=A1draig_Brady?= References: <20241119043822.69942-1-grishalevit@gmail.com> Content-Language: en-US From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 74427 Cc: 74427@debbugs.gnu.org, grishalevit@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 2024-11-19 09:53, P=C3=A1draig Brady wrote: > Do we really want to treat NUL and NULL strings differently? >=20 > =C2=A0 $ src/printf '%d\n' > =C2=A0 0 > =C2=A0 $ src/printf '%d\n' '' > =C2=A0 printf: =E2=80=98=E2=80=99: expected a numeric value > =C2=A0 0 Both behaviors are required by POSIX, so yes, we want to treat them=20 differently. Also, it makes sense to treat '' like ' '; we report an=20 error for the latter so we should report it for the former too. > More problematically I think is it's also inconsistent with %s >=20 > $ src/printf '%s' > $ src/printf '%s' ''=20 I don't see a problem there. As per POSIX, missing string arguments are=20 treated as empty strings, whereas missing numeric arguments are treated=20 as zero. > That's different to bash and dash. AIX and Solaris 10 printf do things the right way (i.e., conform to=20 POSIX) - not surprising as AIX at least has gone through POSIX=20 conformance tests. I expect the GNU divergence from tradition was=20 accidental, as it doesn't make sense for printf to treat '' differently=20 from other non-numbers. I filed bug reports for both Bash and Dash; see: https://lists.gnu.org/r/bug-bash/2024-11/msg00149.html https://lore.kernel.org/dash/20241119193211.1585716-1-eggert@cs.ucla.edu/= T/#u > BTW after we decide the best operation, we should update NEWS.=20 Thanks, good point. How about something like the following: printf now diagnoses attempts to treat empty strings as numbers, as per=20 POSIX. For example, "printf '%d' ''" now issues a diagnostic and fails=20 instead of silently succeeding. From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 19 15:29:28 2024 Received: (at 74427) by debbugs.gnu.org; 19 Nov 2024 20:29:28 +0000 Received: from localhost ([127.0.0.1]:44174 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDUql-0008TY-KS for submit@debbugs.gnu.org; Tue, 19 Nov 2024 15:29:27 -0500 Received: from mail-wr1-f44.google.com ([209.85.221.44]:51395) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDUqk-0008TP-4Y for 74427@debbugs.gnu.org; Tue, 19 Nov 2024 15:29:26 -0500 Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-3824709ee03so1944283f8f.2 for <74427@debbugs.gnu.org>; Tue, 19 Nov 2024 12:29:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732048104; x=1732652904; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=FTaPls0RQY6+/HW2NvVg9dtjxz5NoGlyT/jF1Wk8XYM=; b=fQ7TXZ4f20wIDU5JzECxdqRvfDM98dwz8S9wjDeT/BKq+LKD4DEACupTJbcCXfWoV2 VLzG+VAajB25+EmhG1Dz+y/XOnuVfR/FkJtTbwYe2GStGkpCkhP1wiIjgjwEG1fzSvsf Wvs21HdvTe+bp8p9o2B2l11yn2gMnD/l/GrJtVS7DTMQkmmWnEMmABZW1F533KQRW+CP sJYWJ+gg92lRPBaNNsnNekOBpuHYDch9wL89fOmvndYmhJ/ik2KQsg6QQuJVJMdhgdJr T+YxP6J23NuiU8lBONRL16waqL16OAKgGBmun1ISE2hj+2Fc50NbTITbbly07vfmYjgv OTLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732048104; x=1732652904; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FTaPls0RQY6+/HW2NvVg9dtjxz5NoGlyT/jF1Wk8XYM=; b=fkIdElgmiDLzuL+hU7/wPKInbWo2Zeac1NADxeaC2KuPG6TSplpuAiq+cjXYnYrk/6 /vQ8K2aJX6x5C7ZJo6ydhcUEn2Vzjvdg+DkqE1UHZTm48un4O1dzaVpHccPCdq2hpu87 2+JYJj5nFfPEfW+WAYPIC1WlqGm/EWG7Kxjn7B/UATBWGogDirv8O3OUgpDeXPX9IKDS BHrga0Wr9PONGfWvwtwDI5+jBKpYXOy10rNVQ/0m2Dn68pHondnYO4edDmcLr8S91U2r gLWysXHQneTV6vWXQR87dFqUpMs73wtbTCtKfYpDdlPnR/R3o0mvNP9Y5+Oxe4aZb80G 5Jrw== X-Gm-Message-State: AOJu0Yxe5QdPDITbs4Dbn2ytszBG62eqIGcAE/4DzOJGkPJDgYPMPEji G9jTlmijxk65M7CqDvTgOdUAWXmvBoagJmE1zHRG3QeBxA+BR6Ot X-Google-Smtp-Source: AGHT+IFgsrazZxySoQttTUcSMsVGa13S7XSPLGsoyNf26lyUDGiFPgV2e0mKwjf6ClBvush+P4Jjtg== X-Received: by 2002:a05:6000:178d:b0:378:89d8:8242 with SMTP id ffacd0b85a97d-38254af9979mr120839f8f.26.1732048104238; Tue, 19 Nov 2024 12:28:24 -0800 (PST) Received: from [192.168.1.19] (86-44-211-146-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.44.211.146]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-432da29978dsm206646125e9.41.2024.11.19.12.28.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Nov 2024 12:28:23 -0800 (PST) Message-ID: <163a29c6-6978-45bb-a7c2-90d77d539ff0@draigBrady.com> Date: Tue, 19 Nov 2024 20:28:22 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: bug#74427: tests/printf/printf-indexed failure on macOS To: Paul Eggert References: <20241119043822.69942-1-grishalevit@gmail.com> Content-Language: en-US From: =?UTF-8?Q?P=C3=A1draig_Brady?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 74427 Cc: 74427@debbugs.gnu.org, grishalevit@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 19/11/2024 20:02, Paul Eggert wrote: > On 2024-11-19 09:53, Pádraig Brady wrote: >> Do we really want to treat NUL and NULL strings differently? >> >>   $ src/printf '%d\n' >>   0 >>   $ src/printf '%d\n' '' >>   printf: ‘’: expected a numeric value >>   0 > > Both behaviors are required by POSIX, so yes, we want to treat them > differently. Also, it makes sense to treat '' like ' '; we report an > error for the latter so we should report it for the former too. Well POSIX isn't explicit about the empty case. The closest it specifies I think is: "If an argument operand cannot be completely converted into an internal value appropriate to the corresponding conversion specification, a diagnostic message shall be written to standard error" But one could consider an empty argument as completely converted? I'm not very strongly against the change, it just seems a little inconsistent to me to error for the empty argument to numeric conversion case, when we don't do that for strings. Also I'm a bit worried about quoting consequences for shell scripts. For example scripts with `printf '%d\n' "$int"` will start erroring if int is not defined, whereas arguably less protected scripts with `printf '%d\n' $int` will behave (correctly) as before. >> That's different to bash and dash. > > AIX and Solaris 10 printf do things the right way (i.e., conform to > POSIX) - not surprising as AIX at least has gone through POSIX > conformance tests. I expect the GNU divergence from tradition was > accidental, as it doesn't make sense for printf to treat '' differently > from other non-numbers. > > I filed bug reports for both Bash and Dash; see: > > https://lists.gnu.org/r/bug-bash/2024-11/msg00149.html > https://lore.kernel.org/dash/20241119193211.1585716-1-eggert@cs.ucla.edu/T/#u For completeness ksh on Solaris 11 treats empty as 0 solaris11$ printf --version version printf (AT&T Research) 2009-02-02 solaris11:~$ printf '%d\n' '' 0 As does newer ksh: fedora40$ printf --version version printf (ksh 93u+m) 2023-03-23 fedora40$ printf '%d\n' '' 0 Though I also see that ksh treats any non number as 0. cheers, Pádraig From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 19 16:48:12 2024 Received: (at 74427) by debbugs.gnu.org; 19 Nov 2024 21:48:12 +0000 Received: from localhost ([127.0.0.1]:44352 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDW4x-0003YH-Lk for submit@debbugs.gnu.org; Tue, 19 Nov 2024 16:48:11 -0500 Received: from mail.cs.ucla.edu ([131.179.128.66]:55604) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDW4v-0003Y3-Og for 74427@debbugs.gnu.org; Tue, 19 Nov 2024 16:48:10 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id BD9FA3C011BE0; Tue, 19 Nov 2024 13:48:03 -0800 (PST) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id JsDFXtRZmSV7; Tue, 19 Nov 2024 13:48:03 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 77D283C00FB20; Tue, 19 Nov 2024 13:48:03 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 77D283C00FB20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1732052883; bh=q7nxOIETX3vhZZFwDWDVKFBPnRWKk9/QhLe+XdkRK6M=; h=Message-ID:Date:MIME-Version:To:From; b=OPsNLewP8cAI4xiErOV4kjCNIg07UoeXQJbmKrruvw8vYheGsckbqsF+YOPh+thK2 vmYH1Gub7bCxzAEbSMVQux21CajNqddM0HzPgGOQeau2JLq43X3d4o8IsV5p0Ha6gE jBp86E+AHB53V5Advjrh1zSlB2Vi3qfBbTWYk/8ouVwvV+ESTwaVTD2P3pzJ5P5837 PEgY++xUnImkERuOZ1gAvED2yq1AyvusXDgTc5E4MlChwvPcD8J9hOKpi5rxS+JQA9 dBdc0ted0wBFU0yYSJcOdexvEXtpAKECTM5Ja+ZLHU1VQF32GMcC/XOuDjmRI6CKtP yRe7x0nOFR5Dw== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id 8XEh5wdOqy6r; Tue, 19 Nov 2024 13:48:03 -0800 (PST) Received: from [192.168.254.12] (unknown [47.150.137.250]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 584DC3C011BE0; Tue, 19 Nov 2024 13:48:03 -0800 (PST) Message-ID: <83bb1a3d-3625-4134-9b71-a66f0fb41b3f@cs.ucla.edu> Date: Tue, 19 Nov 2024 13:48:03 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#74427: tests/printf/printf-indexed failure on macOS To: =?UTF-8?Q?P=C3=A1draig_Brady?= References: <20241119043822.69942-1-grishalevit@gmail.com> <163a29c6-6978-45bb-a7c2-90d77d539ff0@draigBrady.com> Content-Language: en-US From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: <163a29c6-6978-45bb-a7c2-90d77d539ff0@draigBrady.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 74427 Cc: 74427@debbugs.gnu.org, grishalevit@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 2024-11-19 12:28, P=C3=A1draig Brady wrote: > But one could consider an empty argument as completely converted? No, because POSIX says the argument must be a C integer constant, and=20 empty strings are not C integer constants. Similar reasoning applies for=20 floating point specs like %g, where POSIX says the argument is converted=20 as if by strtod, and for an empty string POSIX says no conversion is=20 performed by strtod. > For example scripts with `printf '%d\n' "$int"` will start erroring if = int is not defined It shouldn't be that big a deal, as the change doesn't affect stdout.=20 The only issues are stderr and exit status, and that sort of script=20 typically ignores both. From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 19 16:56:04 2024 Received: (at 74427) by debbugs.gnu.org; 19 Nov 2024 21:56:05 +0000 Received: from localhost ([127.0.0.1]:44371 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDWCa-0003vk-JA for submit@debbugs.gnu.org; Tue, 19 Nov 2024 16:56:04 -0500 Received: from mail-wm1-f45.google.com ([209.85.128.45]:58468) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDWCY-0003vM-RF for 74427@debbugs.gnu.org; Tue, 19 Nov 2024 16:56:03 -0500 Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-431688d5127so12290245e9.0 for <74427@debbugs.gnu.org>; Tue, 19 Nov 2024 13:56:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732053302; x=1732658102; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=yrFGyksvSk3Eu3WJAJ9CWZImdLMWmbkj/ioTTs6nQyQ=; b=nUJvyLMN5G7q8N+Ky+OH0zrrDO5JX+YOl2USomog3iHydIKxTk7agjERP/0PX0SVOL aDY179tdCm5KzKJi/WXkXMFxihLGJZC2F6EDSyafZkQgfrsBD63hQyJQU3TTr5WwMyqx Lih3+muQnmlflhTMdewRi/rdq94sqjazjpjMUdvG3W6co/Y8XnnjmKV8n0KQTDSCU3IA 57sHC2MuZpD+KZt/jYdjzM9yIFP+yy0xs6E8yLdjvFNLYEN682FB3SJa1CLLB7kGvd4P sQwWBxZM1n8WUYwWL0guisKys7GS9cisaNcPuIPK42OViEyMKRknTJavd8/oXsTJlmU/ BKKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732053302; x=1732658102; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yrFGyksvSk3Eu3WJAJ9CWZImdLMWmbkj/ioTTs6nQyQ=; b=J4j61Rh8yM29xwjHFRiXGioS+lKXhHYHLi9rLZk4H/8eVsuRtte5982bDQpHgdn7xH dFqj8faRpFUgWzkDlKhTherXxeyYi19z4CThoJeEOv7kTgLORCMWekcyiolnvYmFxkBJ NzkE0kan97yqwTwHG+hxRFd3TPb/9CAjsJu2bgBSEuvGZVkxihw3Dilh81bVMBslr4Zv 4uP7X0ytn7ftFB6ApkZQTwc6KDJ2PflUEm2FLnV4zja1l7ElA2om00f/8Pb+iWJ0Iylt p3TttfvopK7f9VM8ay+Dt0FAxyg/JJfGGFkax/By2fK8E052dYVKlRw78bop/csbdW54 6log== X-Gm-Message-State: AOJu0Yzg+aDDo/XU7ZoH5PzgNRHPeA5iKhmmiiybvXEBoXIaZrH6xRAg GGgttZjBOAW1net8aTbIpqPmvnDcnh6YcGjQh+9sM40PUk+1dOzb X-Google-Smtp-Source: AGHT+IEI2z3pgVBYg+Ij1V2JepCFyxgTquDhl2XJsx/QRtj7w+HHXLNzEhKXgSeEo2kWVp08BBBASw== X-Received: by 2002:a05:600c:35d2:b0:431:93dd:8e77 with SMTP id 5b1f17b1804b1-4334f027286mr4218685e9.31.1732053301616; Tue, 19 Nov 2024 13:55:01 -0800 (PST) Received: from [192.168.1.19] (86-44-211-146-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.44.211.146]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-432dab789fasm213158585e9.18.2024.11.19.13.54.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Nov 2024 13:55:00 -0800 (PST) Message-ID: Date: Tue, 19 Nov 2024 21:54:59 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: bug#74427: tests/printf/printf-indexed failure on macOS To: Paul Eggert References: <20241119043822.69942-1-grishalevit@gmail.com> <163a29c6-6978-45bb-a7c2-90d77d539ff0@draigBrady.com> <83bb1a3d-3625-4134-9b71-a66f0fb41b3f@cs.ucla.edu> Content-Language: en-US From: =?UTF-8?Q?P=C3=A1draig_Brady?= In-Reply-To: <83bb1a3d-3625-4134-9b71-a66f0fb41b3f@cs.ucla.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 74427 Cc: 74427@debbugs.gnu.org, grishalevit@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 19/11/2024 21:48, Paul Eggert wrote: > On 2024-11-19 12:28, Pádraig Brady wrote: >> But one could consider an empty argument as completely converted? > > No, because POSIX says the argument must be a C integer constant, and > empty strings are not C integer constants. Similar reasoning applies for > floating point specs like %g, where POSIX says the argument is converted > as if by strtod, and for an empty string POSIX says no conversion is > performed by strtod. > > >> For example scripts with `printf '%d\n' "$int"` will start erroring if int is not defined > > It shouldn't be that big a deal, as the change doesn't affect stdout. > The only issues are stderr and exit status, and that sort of script > typically ignores both. > OK assuming all the above, the NEWS change looks good. thanks! Pádraig From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 19 17:17:47 2024 Received: (at 74427) by debbugs.gnu.org; 19 Nov 2024 22:17:47 +0000 Received: from localhost ([127.0.0.1]:44402 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDWXb-0004pd-86 for submit@debbugs.gnu.org; Tue, 19 Nov 2024 17:17:47 -0500 Received: from mail-wm1-f46.google.com ([209.85.128.46]:52647) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDWXZ-0004pQ-J8 for 74427@debbugs.gnu.org; Tue, 19 Nov 2024 17:17:46 -0500 Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-4314f38d274so50773335e9.1 for <74427@debbugs.gnu.org>; Tue, 19 Nov 2024 14:17:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732054600; x=1732659400; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=stBiGBTMnHlqOcRCoo3chuzS54z+2IUpI8Y4ic4xTz4=; b=JQqi7tWj73xY5oyLSGiVf7i8YXQhc3KQ0vu6PEQP+7fR8kQUDGTsBJfAdMzWIb2ckO nwcJrK+ki2q54K0OoCFhAceGpYtdRe2ZUrlzCMJnBUcGtMR7J3mVIBXxEyqoNHWFtcyH +sFDFJle+iAH9nERwB2PX9yywHzR1la5bec1I13Ft9OK3JRgwWAauHMvRka5/xGubW37 5fAm0sXAVO7c7G0uDrOgGIHhyO04YMlVhLl7hXVcpcRLjFZG7U5aaEgM+9jlg8PtWVAZ j7/kBIYTd/6udFZyv8PfbhAFmqKNs9xEl3kIBPBRKlUCZa4C+9xYhZwNb1Q8oQzPU9pn JhaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732054600; x=1732659400; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=stBiGBTMnHlqOcRCoo3chuzS54z+2IUpI8Y4ic4xTz4=; b=u+bxtTNvJFMHF2bx+EMXyN4OLLQ36OLKXlLZ/3g4lOgkAqiUxSRmLtSZt//+U9UaUi jjx0dVHwyGuj62B1emxT8QcfrrXreuB9Tvb8Tz/i698TD/zXocX6qcWDw5n7zTVs9uEC PzXe0meXre/6nZQbJ+8iQPAUWFblVt9DPMd1gNYJfLUXwGuwADQqvTnTHcsMB7IsAOb0 HLg9cyUMq9ygabGIDuHstZd5n+QItxcY2g05AE/fGaKbF3mpTlgrf1i/tf5QJ4Y0wtc7 deyM/z/ZaiGN3uPBf9xxLBTHEdQt0U/A8hvy2x9QOfTlSA349m77msdO9EULCWfcvetx TJhw== X-Gm-Message-State: AOJu0Yy9uGEPRg+BsLavdKWJivq7U2jPxgO1t3jWdf9p8OYDwYPL7Q29 u2ZKbA7yHgp6UMqF3xRkmcdhyEgVgYGq44xSu1pNrxsbWaBHbsmc X-Google-Smtp-Source: AGHT+IEr63nvgSnPgZWWqtz1J0OVkxp+r12hCUl0GWChMwVrJJO4v826o1IivuaPgOad1fz13WocwA== X-Received: by 2002:a05:600c:1e10:b0:431:542d:2599 with SMTP id 5b1f17b1804b1-4334f015482mr4429395e9.22.1732054599532; Tue, 19 Nov 2024 14:16:39 -0800 (PST) Received: from [192.168.1.19] (86-44-211-146-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.44.211.146]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-432da298760sm210946085e9.37.2024.11.19.14.16.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Nov 2024 14:16:38 -0800 (PST) Message-ID: <1cfbd51f-3a60-4db6-a8f0-92f334c839ea@draigBrady.com> Date: Tue, 19 Nov 2024 22:16:37 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: bug#74427: tests/printf/printf-indexed failure on macOS To: Paul Eggert References: <20241119043822.69942-1-grishalevit@gmail.com> Content-Language: en-US From: =?UTF-8?Q?P=C3=A1draig_Brady?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 74427 Cc: 74427@debbugs.gnu.org, grishalevit@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 19/11/2024 20:02, Paul Eggert wrote: > On 2024-11-19 09:53, Pádraig Brady wrote: >> Do we really want to treat NUL and NULL strings differently? >> >>   $ src/printf '%d\n' >>   0 >>   $ src/printf '%d\n' '' >>   printf: ‘’: expected a numeric value >>   0 > > Both behaviors are required by POSIX, so yes, we want to treat them > differently. Also, it makes sense to treat '' like ' '; we report an > error for the latter so we should report it for the former too. > > >> More problematically I think is it's also inconsistent with %s >> >> $ src/printf '%s' >> $ src/printf '%s' '' > > I don't see a problem there. As per POSIX, missing string arguments are > treated as empty strings, whereas missing numeric arguments are treated > as zero. > > >> That's different to bash and dash. > > AIX and Solaris 10 printf do things the right way (i.e., conform to > POSIX) - not surprising as AIX at least has gone through POSIX > conformance tests. I expect the GNU divergence from tradition was > accidental, as it doesn't make sense for printf to treat '' differently > from other non-numbers. > > I filed bug reports for both Bash and Dash; see: > > https://lists.gnu.org/r/bug-bash/2024-11/msg00149.html > https://lore.kernel.org/dash/20241119193211.1585716-1-eggert@cs.ucla.edu/T/#u For completeness I noticed a previous related dash discussion about this: https://patchwork.kernel.org/project/dash/patch/62c16598-2d44-f4c9-991d-9880a8839786@inlv.org/#21564895 At the _shell level_, unset and empty variables are to be treated similarly, and as per POSIX, for shells, uninitialized variables should be treated as 0 dash -c 'unset x; echo $((x))' 0 $ dash -c 'x=; echo $((x))' 0 I know shell arithmetic is separate to printf processing, so just posting this for completeness and to perhaps aid any discussions on the shell bug reports above. cheers, Pádraig From unknown Thu Aug 14 21:50:07 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 18 Dec 2024 12:24:09 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator