X-Loop: help-debbugs@HIDDEN Subject: bug#77535: timeout treats very short durations as `0` Resent-From: Nicolas Boichat <nicolas@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-coreutils@HIDDEN Resent-Date: Fri, 04 Apr 2025 16:13:02 +0000 Resent-Message-ID: <handler.77535.B.174378313531834 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 77535 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 77535 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.174378313531834 (code B ref -1); Fri, 04 Apr 2025 16:13:02 +0000 Received: (at submit) by debbugs.gnu.org; 4 Apr 2025 16:12:15 +0000 Received: from localhost ([127.0.0.1]:39665 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1u0jeR-0008HO-7l for submit <at> debbugs.gnu.org; Fri, 04 Apr 2025 12:12:15 -0400 Received: from lists.gnu.org ([2001:470:142::17]:43010) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <nicolas.boichat@HIDDEN>) id 1u0ix5-00067z-5d for submit <at> debbugs.gnu.org; Fri, 04 Apr 2025 11:27:27 -0400 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 <nicolas.boichat@HIDDEN>) id 1u0iwq-00066D-QB for bug-coreutils@HIDDEN; Fri, 04 Apr 2025 11:27:13 -0400 Received: from mail-io1-f42.google.com ([209.85.166.42]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <nicolas.boichat@HIDDEN>) id 1u0iwp-0005If-6M for bug-coreutils@HIDDEN; Fri, 04 Apr 2025 11:27:12 -0400 Received: by mail-io1-f42.google.com with SMTP id ca18e2360f4ac-85b4277d03fso81705639f.1 for <bug-coreutils@HIDDEN>; Fri, 04 Apr 2025 08:27:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743780429; x=1744385229; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=kMIAk8BIWY1vriXK6/7sVpHCFuZdumn0ziOYcRZh5wg=; b=VdViJk6eKzdjmOQ8e2RixVPrUpjeP1stzk1v5k5kMBsebRqmSuchiR/ZSyuD08INEV nuDTHkcvq3by7YyDDyIwRmEMCjcC6QZLllOIXTpek7rjmtWwAlbOSigq3x6k0YcsYDgT VAl8B+/vf2Yoz6DjyaWrERe1m++SEkVFrvZtm1Tq7obrcoyNLy+jVEhXptLHJLssiYk0 hdTiK7tIZ21sm7PlLcdtKrjVZQCVNClCOC56/nf2rgUOQ7N3fYS9kAhjhLjWHl4qL2PX 3aTkeYwqVxripHaCQ3QWXHKvn+JDNGS2IQa1YRkA/LCG8K6l3PgLpHGhV5T0VbCYIUyU j8Eg== X-Gm-Message-State: AOJu0YzjncONw5Pbrpb20Wc+4IyqN5F7PvcFIKRQo6cnH6hDYa22O1I7 LLxKPtLJJlpccwHocFdemXx/fVS7RiaRKkEhmC8FCNbwUEPsWFiQBNwnrkD2pnWjD7HY0OXRkCg EW+4y3DL+q8I+z7/owBJptltl53luvBPPjEY= X-Gm-Gg: ASbGncve+HU+XwWkLd94E876hDbcisZQCiCwwPVLJwTK8SNZEWrKuv1tYWPsOTeVwLu 6GKSpEVZpxPEDh/e5sptbCD9s1Qy0oOz2pIMAOLxRzEO5uYUrdU8n15vqHm/5/Hm8GNf7V49Hbv fjpD4T1eGEt6OrjvGJEWVbf+Zgy43vAzqf34E= X-Google-Smtp-Source: AGHT+IGCEUgbNbaSUg+ijpRv0pQg+j6Ypa7RBrPPFwIyvyF/PLYYCodJs3relLklUxHYbQNZoOGaa3OipvrDASwceBg= X-Received: by 2002:a05:6e02:3701:b0:3ce:4b12:fa17 with SMTP id e9e14a558f8ab-3d6e3f7f812mr45735545ab.19.1743780428844; Fri, 04 Apr 2025 08:27:08 -0700 (PDT) MIME-Version: 1.0 From: Nicolas Boichat <nicolas@HIDDEN> Date: Fri, 4 Apr 2025 17:26:56 +0200 X-Gm-Features: ATxdqUEoSIp3-7q8UzAhlw1H5z2kM9CSaO2hZ_WSwYIA0wWPqIMo8N1xHgLhNZ8 Message-ID: <CAM6NUi5isNtqv5-UqtA4yMBTZcs1+sMLJ6uQvKn7QpE7pSS0dg@HIDDEN> Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=209.85.166.42; envelope-from=nicolas.boichat@HIDDEN; helo=mail-io1-f42.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Mailman-Approved-At: Fri, 04 Apr 2025 12:12:13 -0400 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.0 (/) Hi, Version: timeout (GNU coreutils) 9.6, Archlinux, x86-64. While playing with different duration parameters to `timeout`, I noticed that extremely short durations, like `1e-3000`, are rounded down to `0`. The problem is that `0` has a special meaning (disabling the timeout), so I don't think this is desired. All of these commands exit immediately: ``` timeout 0.0001 cat timeout 1e-100 cat timeout 1e-300 cat timeout 1e-323 cat ``` But these never exits: ``` timeout 1e-324 cat timeout 1e-3000 cat ``` As if we had typed: ``` timeout 0 cat ``` I think there is some logic in `printf` to handle float parsing underflow, so maybe this can be reused in `timeout` as well. Thanks,
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Nicolas Boichat <nicolas@HIDDEN> Subject: bug#77535: Acknowledgement (timeout treats very short durations as `0`) Message-ID: <handler.77535.B.174378313531834.ack <at> debbugs.gnu.org> References: <CAM6NUi5isNtqv5-UqtA4yMBTZcs1+sMLJ6uQvKn7QpE7pSS0dg@HIDDEN> X-Gnu-PR-Message: ack 77535 X-Gnu-PR-Package: coreutils Reply-To: 77535 <at> debbugs.gnu.org Date: Fri, 04 Apr 2025 16:13:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-coreutils@HIDDEN If you wish to submit further information on this problem, please send it to 77535 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 77535: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D77535 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: =?UTF-8?Q?P=C3=A1draig?= Brady <P@HIDDEN> Subject: bug#77535: closed (timeout treats very short durations as `0`) CC: tracker <at> debbugs.gnu.org Message-ID: <handler.77535.D77535.174379488730638.ackdone <at> debbugs.gnu.org> References: <a1cfeefb-ca6d-42a5-8701-8e8c0d607b87@HIDDEN> <CAM6NUi5isNtqv5-UqtA4yMBTZcs1+sMLJ6uQvKn7QpE7pSS0dg@HIDDEN> X-Gnu-PR-Message: closed 77535 X-Gnu-PR-Package: coreutils Date: Fri, 04 Apr 2025 19:29:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1743794942-30742-0" This is a multi-part message in MIME format... ------------=_1743794942-30742-0 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Your message dated Fri, 4 Apr 2025 20:27:55 +0100 with message-id <a1cfeefb-ca6d-42a5-8701-8e8c0d607b87@HIDDEN> and subject line Re: bug#77535: timeout treats very short durations as `0` has caused the debbugs.gnu.org bug report #77535, regarding timeout treats very short durations as `0` to be marked as done. (If you believe you have received this mail in error, please contact help-debbugs@HIDDEN) --=20 77535: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D77535 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems ------------=_1743794942-30742-0 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 4 Apr 2025 16:12:15 +0000 Received: from localhost ([127.0.0.1]:39665 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1u0jeR-0008HO-7l for submit <at> debbugs.gnu.org; Fri, 04 Apr 2025 12:12:15 -0400 Received: from lists.gnu.org ([2001:470:142::17]:43010) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <nicolas.boichat@HIDDEN>) id 1u0ix5-00067z-5d for submit <at> debbugs.gnu.org; Fri, 04 Apr 2025 11:27:27 -0400 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 <nicolas.boichat@HIDDEN>) id 1u0iwq-00066D-QB for bug-coreutils@HIDDEN; Fri, 04 Apr 2025 11:27:13 -0400 Received: from mail-io1-f42.google.com ([209.85.166.42]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <nicolas.boichat@HIDDEN>) id 1u0iwp-0005If-6M for bug-coreutils@HIDDEN; Fri, 04 Apr 2025 11:27:12 -0400 Received: by mail-io1-f42.google.com with SMTP id ca18e2360f4ac-85b4277d03fso81705639f.1 for <bug-coreutils@HIDDEN>; Fri, 04 Apr 2025 08:27:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743780429; x=1744385229; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=kMIAk8BIWY1vriXK6/7sVpHCFuZdumn0ziOYcRZh5wg=; b=VdViJk6eKzdjmOQ8e2RixVPrUpjeP1stzk1v5k5kMBsebRqmSuchiR/ZSyuD08INEV nuDTHkcvq3by7YyDDyIwRmEMCjcC6QZLllOIXTpek7rjmtWwAlbOSigq3x6k0YcsYDgT VAl8B+/vf2Yoz6DjyaWrERe1m++SEkVFrvZtm1Tq7obrcoyNLy+jVEhXptLHJLssiYk0 hdTiK7tIZ21sm7PlLcdtKrjVZQCVNClCOC56/nf2rgUOQ7N3fYS9kAhjhLjWHl4qL2PX 3aTkeYwqVxripHaCQ3QWXHKvn+JDNGS2IQa1YRkA/LCG8K6l3PgLpHGhV5T0VbCYIUyU j8Eg== X-Gm-Message-State: AOJu0YzjncONw5Pbrpb20Wc+4IyqN5F7PvcFIKRQo6cnH6hDYa22O1I7 LLxKPtLJJlpccwHocFdemXx/fVS7RiaRKkEhmC8FCNbwUEPsWFiQBNwnrkD2pnWjD7HY0OXRkCg EW+4y3DL+q8I+z7/owBJptltl53luvBPPjEY= X-Gm-Gg: ASbGncve+HU+XwWkLd94E876hDbcisZQCiCwwPVLJwTK8SNZEWrKuv1tYWPsOTeVwLu 6GKSpEVZpxPEDh/e5sptbCD9s1Qy0oOz2pIMAOLxRzEO5uYUrdU8n15vqHm/5/Hm8GNf7V49Hbv fjpD4T1eGEt6OrjvGJEWVbf+Zgy43vAzqf34E= X-Google-Smtp-Source: AGHT+IGCEUgbNbaSUg+ijpRv0pQg+j6Ypa7RBrPPFwIyvyF/PLYYCodJs3relLklUxHYbQNZoOGaa3OipvrDASwceBg= X-Received: by 2002:a05:6e02:3701:b0:3ce:4b12:fa17 with SMTP id e9e14a558f8ab-3d6e3f7f812mr45735545ab.19.1743780428844; Fri, 04 Apr 2025 08:27:08 -0700 (PDT) MIME-Version: 1.0 From: Nicolas Boichat <nicolas@HIDDEN> Date: Fri, 4 Apr 2025 17:26:56 +0200 X-Gm-Features: ATxdqUEoSIp3-7q8UzAhlw1H5z2kM9CSaO2hZ_WSwYIA0wWPqIMo8N1xHgLhNZ8 Message-ID: <CAM6NUi5isNtqv5-UqtA4yMBTZcs1+sMLJ6uQvKn7QpE7pSS0dg@HIDDEN> Subject: timeout treats very short durations as `0` To: bug-coreutils@HIDDEN Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=209.85.166.42; envelope-from=nicolas.boichat@HIDDEN; helo=mail-io1-f42.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Fri, 04 Apr 2025 12:12:13 -0400 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.0 (/) Hi, Version: timeout (GNU coreutils) 9.6, Archlinux, x86-64. While playing with different duration parameters to `timeout`, I noticed that extremely short durations, like `1e-3000`, are rounded down to `0`. The problem is that `0` has a special meaning (disabling the timeout), so I don't think this is desired. All of these commands exit immediately: ``` timeout 0.0001 cat timeout 1e-100 cat timeout 1e-300 cat timeout 1e-323 cat ``` But these never exits: ``` timeout 1e-324 cat timeout 1e-3000 cat ``` As if we had typed: ``` timeout 0 cat ``` I think there is some logic in `printf` to handle float parsing underflow, so maybe this can be reused in `timeout` as well. Thanks, ------------=_1743794942-30742-0 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 77535-done) by debbugs.gnu.org; 4 Apr 2025 19:28:07 +0000 Received: from localhost ([127.0.0.1]:40189 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1u0mhy-0007y6-M1 for submit <at> debbugs.gnu.org; Fri, 04 Apr 2025 15:28:06 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:57760) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <pixelbeat@HIDDEN>) id 1u0mhv-0007xU-7i for 77535-done <at> debbugs.gnu.org; Fri, 04 Apr 2025 15:28:03 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-39ac9aea656so2138200f8f.3 for <77535-done <at> debbugs.gnu.org>; Fri, 04 Apr 2025 12:28:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743794877; x=1744399677; 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=TcrGkF78pGioQb/5ZONU/YBobvsqcKnubgUjMn6Rl34=; b=lAv880KTy3tJuCM8JdaEGqyQPDpdb0gTMkGB5pWTVK26xV39tfaq9muA5B1A99N92V wUNGUt5jvSiCWRqhDCIQgEZwNkCdT63UGPbip8f3C+c7dfqlqJRwoEIv9ord0sGup4Re 2AQ29xChaaHnhSC4SBkizN+vyYD+kO0fTMUx6zYj2tXaGSTQi+XbpXWmhdeiCu4AF0ES NQvkI0CmP3MS9O8n4etLpzWGExwK7KGC7PWsJbBo/EUXe5273ZHDNSpQwuC2jHLVOqos J0tlPAJJykTMyqd8XRmarP46gh3+Jm44yVQfd4/xIRWAWa2fTa6OxOuHj+nKrDTQf8mS sgVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743794877; x=1744399677; 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=TcrGkF78pGioQb/5ZONU/YBobvsqcKnubgUjMn6Rl34=; b=hyJy8g+fNzXp1hoGPB9Qs+sFCNT3TUNSghkoqrmTM3hJkdrfBeLwsBBhprihFSKq9C KnuJcYJc8BSMfMVPFN76C8uAV32BZKCySNnvJTYVIDmqbAzhtfuvnlTt30biS9cIKMQd ByjrmfBf6v2EgPz8YJDkLVI90LVGgY4YLirJyK69mm6KAoOpzQ20reawPMHnRWgDRkv1 9XdVzqKdaRIv1S+lGvw/skbyJuugl/WV3aCQNse/Gi4PdZ40zTnUs3wjXUJNexQvqcUT w+kHVaX0XUQAuvXGEbmlFWE8yLnrwxf4mfDV7qaW34bedxGI5n3++arP9l3iC5itL4bh dP7Q== X-Forwarded-Encrypted: i=1; AJvYcCWqlBW6Bhspt/2OuuPNjOxJ1qZjSTEuzD8SMMjEQix9MVeEcaqo8XFKynxR7PYQGIc0tzem7KNr+Ni1 <at> debbugs.gnu.org X-Gm-Message-State: AOJu0Yz/x/g1b0bQSKamq/eQGCuqv4FL8BKt+91dlNvhOh45IwQEz+w6 jOn5d8qmdjvZDoDsppO5H2RgsrIWWBlhsiFzKcuLWwGoyEtb8muDAELJ/9eA6rw= X-Gm-Gg: ASbGnctY8JO/Arlrg9LCQVgBjPcBoIfivX9HT7Ak+wFToo/wreMa/vdvUAkggIWJSlU FYoNlPFHCPgp15W/hA4V2dbdCZ6dCz8k9DkPMGLL6nPLc8qf85ivM9iy6LbQUyMBAdteDoIHJCg vHOoNkafZUgTnqg0YO5BdtvRQRKcRDjIOZmPti1/1BaDsgv+e8agSjTqyc45I2vPbGMp3VPHYHv gtg1qpmMw+9GX/j4BhOrjmZUF9WZguLyYvv0/Kgco3ir7TBT40zJd4sdgsFZ51a5xtxQq45pFJ7 LGL9pZhnw1XJMdg28Uo1PInJBARwThq3DWHWyR+b/lkqSK2pC1AV8nFf/PL60CpMybgcaBRPEI3 SjXm+EbZtH0ZZ5sA50yBwcRmaCL7TQCluMf8= X-Google-Smtp-Source: AGHT+IF0BG7n4Noss0G+N5uZzrF7tR7/gEOMd+7yf62lmD80EnH0RGf2Ib4/b+LTpGR9kf/K9J2xig== X-Received: by 2002:a5d:588f:0:b0:39c:1efd:ed8f with SMTP id ffacd0b85a97d-39d14662e4dmr3134696f8f.50.1743794876599; Fri, 04 Apr 2025 12:27:56 -0700 (PDT) Received: from [192.168.1.31] (86-44-211-146-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.44.211.146]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-39c301b7933sm5239401f8f.54.2025.04.04.12.27.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Apr 2025 12:27:56 -0700 (PDT) Message-ID: <a1cfeefb-ca6d-42a5-8701-8e8c0d607b87@HIDDEN> Date: Fri, 4 Apr 2025 20:27:55 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: bug#77535: timeout treats very short durations as `0` To: Nicolas Boichat <nicolas@HIDDEN>, 77535-done <at> debbugs.gnu.org References: <CAM6NUi5isNtqv5-UqtA4yMBTZcs1+sMLJ6uQvKn7QpE7pSS0dg@HIDDEN> Content-Language: en-US From: =?UTF-8?Q?P=C3=A1draig_Brady?= <P@HIDDEN> In-Reply-To: <CAM6NUi5isNtqv5-UqtA4yMBTZcs1+sMLJ6uQvKn7QpE7pSS0dg@HIDDEN> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 77535-done X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) On 04/04/2025 16:26, Nicolas Boichat wrote: > Hi, > > Version: timeout (GNU coreutils) 9.6, Archlinux, x86-64. > > While playing with different duration parameters to `timeout`, I > noticed that extremely short durations, like `1e-3000`, are rounded > down to `0`. The problem is that `0` has a special meaning (disabling > the timeout), so I don't think this is desired. > > All of these commands exit immediately: > ``` > timeout 0.0001 cat > timeout 1e-100 cat > timeout 1e-300 cat > timeout 1e-323 cat > ``` > > But these never exits: > ``` > timeout 1e-324 cat > timeout 1e-3000 cat > ``` > > As if we had typed: > ``` > timeout 0 cat > ``` > > I think there is some logic in `printf` to handle float parsing > underflow, so maybe this can be reused in `timeout` as well. The following should avoid this issue. Marking this as done. thanks! Pádraig diff --git a/src/timeout.c b/src/timeout.c index 578d71070..6756cd888 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -371,6 +371,10 @@ parse_duration (char const *str) usage (EXIT_CANCELED); } + /* Clamp underflow to 1ns, as 0 disables the timeout. */ + if (duration == 0 && errno == ERANGE) + duration = 1e-9; + return duration; } ------------=_1743794942-30742-0--
MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Nicolas Boichat <nicolas@HIDDEN> Subject: bug#77535: closed (Re: bug#77535: timeout treats very short durations as `0`) Message-ID: <handler.77535.D77535.174379488730638.notifdone <at> debbugs.gnu.org> References: <a1cfeefb-ca6d-42a5-8701-8e8c0d607b87@HIDDEN> <CAM6NUi5isNtqv5-UqtA4yMBTZcs1+sMLJ6uQvKn7QpE7pSS0dg@HIDDEN> X-Gnu-PR-Message: they-closed 77535 X-Gnu-PR-Package: coreutils Reply-To: 77535 <at> debbugs.gnu.org Date: Fri, 04 Apr 2025 19:29:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1743794942-30742-1" This is a multi-part message in MIME format... ------------=_1743794942-30742-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #77535: timeout treats very short durations as `0` which was filed against the coreutils package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 77535 <at> debbugs.gnu.org. --=20 77535: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D77535 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems ------------=_1743794942-30742-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 77535-done) by debbugs.gnu.org; 4 Apr 2025 19:28:07 +0000 Received: from localhost ([127.0.0.1]:40189 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1u0mhy-0007y6-M1 for submit <at> debbugs.gnu.org; Fri, 04 Apr 2025 15:28:06 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:57760) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <pixelbeat@HIDDEN>) id 1u0mhv-0007xU-7i for 77535-done <at> debbugs.gnu.org; Fri, 04 Apr 2025 15:28:03 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-39ac9aea656so2138200f8f.3 for <77535-done <at> debbugs.gnu.org>; Fri, 04 Apr 2025 12:28:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743794877; x=1744399677; 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=TcrGkF78pGioQb/5ZONU/YBobvsqcKnubgUjMn6Rl34=; b=lAv880KTy3tJuCM8JdaEGqyQPDpdb0gTMkGB5pWTVK26xV39tfaq9muA5B1A99N92V wUNGUt5jvSiCWRqhDCIQgEZwNkCdT63UGPbip8f3C+c7dfqlqJRwoEIv9ord0sGup4Re 2AQ29xChaaHnhSC4SBkizN+vyYD+kO0fTMUx6zYj2tXaGSTQi+XbpXWmhdeiCu4AF0ES NQvkI0CmP3MS9O8n4etLpzWGExwK7KGC7PWsJbBo/EUXe5273ZHDNSpQwuC2jHLVOqos J0tlPAJJykTMyqd8XRmarP46gh3+Jm44yVQfd4/xIRWAWa2fTa6OxOuHj+nKrDTQf8mS sgVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743794877; x=1744399677; 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=TcrGkF78pGioQb/5ZONU/YBobvsqcKnubgUjMn6Rl34=; b=hyJy8g+fNzXp1hoGPB9Qs+sFCNT3TUNSghkoqrmTM3hJkdrfBeLwsBBhprihFSKq9C KnuJcYJc8BSMfMVPFN76C8uAV32BZKCySNnvJTYVIDmqbAzhtfuvnlTt30biS9cIKMQd ByjrmfBf6v2EgPz8YJDkLVI90LVGgY4YLirJyK69mm6KAoOpzQ20reawPMHnRWgDRkv1 9XdVzqKdaRIv1S+lGvw/skbyJuugl/WV3aCQNse/Gi4PdZ40zTnUs3wjXUJNexQvqcUT w+kHVaX0XUQAuvXGEbmlFWE8yLnrwxf4mfDV7qaW34bedxGI5n3++arP9l3iC5itL4bh dP7Q== X-Forwarded-Encrypted: i=1; AJvYcCWqlBW6Bhspt/2OuuPNjOxJ1qZjSTEuzD8SMMjEQix9MVeEcaqo8XFKynxR7PYQGIc0tzem7KNr+Ni1 <at> debbugs.gnu.org X-Gm-Message-State: AOJu0Yz/x/g1b0bQSKamq/eQGCuqv4FL8BKt+91dlNvhOh45IwQEz+w6 jOn5d8qmdjvZDoDsppO5H2RgsrIWWBlhsiFzKcuLWwGoyEtb8muDAELJ/9eA6rw= X-Gm-Gg: ASbGnctY8JO/Arlrg9LCQVgBjPcBoIfivX9HT7Ak+wFToo/wreMa/vdvUAkggIWJSlU FYoNlPFHCPgp15W/hA4V2dbdCZ6dCz8k9DkPMGLL6nPLc8qf85ivM9iy6LbQUyMBAdteDoIHJCg vHOoNkafZUgTnqg0YO5BdtvRQRKcRDjIOZmPti1/1BaDsgv+e8agSjTqyc45I2vPbGMp3VPHYHv gtg1qpmMw+9GX/j4BhOrjmZUF9WZguLyYvv0/Kgco3ir7TBT40zJd4sdgsFZ51a5xtxQq45pFJ7 LGL9pZhnw1XJMdg28Uo1PInJBARwThq3DWHWyR+b/lkqSK2pC1AV8nFf/PL60CpMybgcaBRPEI3 SjXm+EbZtH0ZZ5sA50yBwcRmaCL7TQCluMf8= X-Google-Smtp-Source: AGHT+IF0BG7n4Noss0G+N5uZzrF7tR7/gEOMd+7yf62lmD80EnH0RGf2Ib4/b+LTpGR9kf/K9J2xig== X-Received: by 2002:a5d:588f:0:b0:39c:1efd:ed8f with SMTP id ffacd0b85a97d-39d14662e4dmr3134696f8f.50.1743794876599; Fri, 04 Apr 2025 12:27:56 -0700 (PDT) Received: from [192.168.1.31] (86-44-211-146-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.44.211.146]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-39c301b7933sm5239401f8f.54.2025.04.04.12.27.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Apr 2025 12:27:56 -0700 (PDT) Message-ID: <a1cfeefb-ca6d-42a5-8701-8e8c0d607b87@HIDDEN> Date: Fri, 4 Apr 2025 20:27:55 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: bug#77535: timeout treats very short durations as `0` To: Nicolas Boichat <nicolas@HIDDEN>, 77535-done <at> debbugs.gnu.org References: <CAM6NUi5isNtqv5-UqtA4yMBTZcs1+sMLJ6uQvKn7QpE7pSS0dg@HIDDEN> Content-Language: en-US From: =?UTF-8?Q?P=C3=A1draig_Brady?= <P@HIDDEN> In-Reply-To: <CAM6NUi5isNtqv5-UqtA4yMBTZcs1+sMLJ6uQvKn7QpE7pSS0dg@HIDDEN> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 77535-done X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) On 04/04/2025 16:26, Nicolas Boichat wrote: > Hi, > > Version: timeout (GNU coreutils) 9.6, Archlinux, x86-64. > > While playing with different duration parameters to `timeout`, I > noticed that extremely short durations, like `1e-3000`, are rounded > down to `0`. The problem is that `0` has a special meaning (disabling > the timeout), so I don't think this is desired. > > All of these commands exit immediately: > ``` > timeout 0.0001 cat > timeout 1e-100 cat > timeout 1e-300 cat > timeout 1e-323 cat > ``` > > But these never exits: > ``` > timeout 1e-324 cat > timeout 1e-3000 cat > ``` > > As if we had typed: > ``` > timeout 0 cat > ``` > > I think there is some logic in `printf` to handle float parsing > underflow, so maybe this can be reused in `timeout` as well. The following should avoid this issue. Marking this as done. thanks! Pádraig diff --git a/src/timeout.c b/src/timeout.c index 578d71070..6756cd888 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -371,6 +371,10 @@ parse_duration (char const *str) usage (EXIT_CANCELED); } + /* Clamp underflow to 1ns, as 0 disables the timeout. */ + if (duration == 0 && errno == ERANGE) + duration = 1e-9; + return duration; } ------------=_1743794942-30742-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 4 Apr 2025 16:12:15 +0000 Received: from localhost ([127.0.0.1]:39665 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1u0jeR-0008HO-7l for submit <at> debbugs.gnu.org; Fri, 04 Apr 2025 12:12:15 -0400 Received: from lists.gnu.org ([2001:470:142::17]:43010) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <nicolas.boichat@HIDDEN>) id 1u0ix5-00067z-5d for submit <at> debbugs.gnu.org; Fri, 04 Apr 2025 11:27:27 -0400 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 <nicolas.boichat@HIDDEN>) id 1u0iwq-00066D-QB for bug-coreutils@HIDDEN; Fri, 04 Apr 2025 11:27:13 -0400 Received: from mail-io1-f42.google.com ([209.85.166.42]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <nicolas.boichat@HIDDEN>) id 1u0iwp-0005If-6M for bug-coreutils@HIDDEN; Fri, 04 Apr 2025 11:27:12 -0400 Received: by mail-io1-f42.google.com with SMTP id ca18e2360f4ac-85b4277d03fso81705639f.1 for <bug-coreutils@HIDDEN>; Fri, 04 Apr 2025 08:27:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743780429; x=1744385229; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=kMIAk8BIWY1vriXK6/7sVpHCFuZdumn0ziOYcRZh5wg=; b=VdViJk6eKzdjmOQ8e2RixVPrUpjeP1stzk1v5k5kMBsebRqmSuchiR/ZSyuD08INEV nuDTHkcvq3by7YyDDyIwRmEMCjcC6QZLllOIXTpek7rjmtWwAlbOSigq3x6k0YcsYDgT VAl8B+/vf2Yoz6DjyaWrERe1m++SEkVFrvZtm1Tq7obrcoyNLy+jVEhXptLHJLssiYk0 hdTiK7tIZ21sm7PlLcdtKrjVZQCVNClCOC56/nf2rgUOQ7N3fYS9kAhjhLjWHl4qL2PX 3aTkeYwqVxripHaCQ3QWXHKvn+JDNGS2IQa1YRkA/LCG8K6l3PgLpHGhV5T0VbCYIUyU j8Eg== X-Gm-Message-State: AOJu0YzjncONw5Pbrpb20Wc+4IyqN5F7PvcFIKRQo6cnH6hDYa22O1I7 LLxKPtLJJlpccwHocFdemXx/fVS7RiaRKkEhmC8FCNbwUEPsWFiQBNwnrkD2pnWjD7HY0OXRkCg EW+4y3DL+q8I+z7/owBJptltl53luvBPPjEY= X-Gm-Gg: ASbGncve+HU+XwWkLd94E876hDbcisZQCiCwwPVLJwTK8SNZEWrKuv1tYWPsOTeVwLu 6GKSpEVZpxPEDh/e5sptbCD9s1Qy0oOz2pIMAOLxRzEO5uYUrdU8n15vqHm/5/Hm8GNf7V49Hbv fjpD4T1eGEt6OrjvGJEWVbf+Zgy43vAzqf34E= X-Google-Smtp-Source: AGHT+IGCEUgbNbaSUg+ijpRv0pQg+j6Ypa7RBrPPFwIyvyF/PLYYCodJs3relLklUxHYbQNZoOGaa3OipvrDASwceBg= X-Received: by 2002:a05:6e02:3701:b0:3ce:4b12:fa17 with SMTP id e9e14a558f8ab-3d6e3f7f812mr45735545ab.19.1743780428844; Fri, 04 Apr 2025 08:27:08 -0700 (PDT) MIME-Version: 1.0 From: Nicolas Boichat <nicolas@HIDDEN> Date: Fri, 4 Apr 2025 17:26:56 +0200 X-Gm-Features: ATxdqUEoSIp3-7q8UzAhlw1H5z2kM9CSaO2hZ_WSwYIA0wWPqIMo8N1xHgLhNZ8 Message-ID: <CAM6NUi5isNtqv5-UqtA4yMBTZcs1+sMLJ6uQvKn7QpE7pSS0dg@HIDDEN> Subject: timeout treats very short durations as `0` To: bug-coreutils@HIDDEN Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=209.85.166.42; envelope-from=nicolas.boichat@HIDDEN; helo=mail-io1-f42.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Fri, 04 Apr 2025 12:12:13 -0400 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.0 (/) Hi, Version: timeout (GNU coreutils) 9.6, Archlinux, x86-64. While playing with different duration parameters to `timeout`, I noticed that extremely short durations, like `1e-3000`, are rounded down to `0`. The problem is that `0` has a special meaning (disabling the timeout), so I don't think this is desired. All of these commands exit immediately: ``` timeout 0.0001 cat timeout 1e-100 cat timeout 1e-300 cat timeout 1e-323 cat ``` But these never exits: ``` timeout 1e-324 cat timeout 1e-3000 cat ``` As if we had typed: ``` timeout 0 cat ``` I think there is some logic in `printf` to handle float parsing underflow, so maybe this can be reused in `timeout` as well. Thanks, ------------=_1743794942-30742-1--
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.