From nobody Mon Jun 12 11:11:47 2023 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Qfpsv3ww0z4clSG for ; Mon, 12 Jun 2023 11:11:47 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Qfpsv0y1fz3PVv for ; Mon, 12 Jun 2023 11:11:47 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686568307; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VgBRgJY3Vptsq7QUMY5kSuwo06Y30SuNxJud5200YnY=; b=i8vgnjFqsywMXi+ACEBDQk3PNz1bL/gZmNtJ6RxnTr03U+6GNdUqqjmVKmNvqA3GbeXayP mpKgCb86sbFfG92518MlmqLHszMwEs13wA2TccB8vnHMSEe7dJe2xzlSlIdAFfM4WR3KGL jbKJlXvaZy0PqQHiTXQlhieP7GP8dv4CedflF4Qn6BArcs3AtHAdNZ201tgPDcMzYIoTaP IIeRZlD0aKMRlIsq8q/tf9WeEtzA3+aUzpQ4k511qNuDqeWjWJLHa4SqeuNSBQp76TfrvB 8hP5ORFH1FdGS1roYsWVvfI/ueQRhqjwV1sBDiVE4HY8Q1fNTtCUpBTwkCCCQQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686568307; a=rsa-sha256; cv=none; b=BYq676wmeXchSfR+d8FIkJuNR3HG5kvrkStoKk3hLZK0F4ClGFR8IOM2SOiZYV48UOakSK fmBFnrsbsqtGVeuKruhvZ9np8cSnmn58B9uN/UBxnQiwX+Z3Mda/JNH7vROtxEQnsyr0qv z+JcV0NjCeli+owFhg843xdBTkpeNVCreu/rEbULB7cU9SI+gSWUESaKex+OZFTkUXCNW3 clP+08jJYgqcV6BIu6BmjbG59HFWE8jAWdE5Lu95TRHlXKjnT5rNOn/F3XM/vFYZ3GdxF1 1v4TBMzz5ffIJw6ibnLuBi7NicS2nDazFcMt4ymhnn8xlXixBZ+9HRp/NV3cfA== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Qfpsv04Cszd9Y for ; Mon, 12 Jun 2023 11:11:47 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 35CBBkIC046187 for ; Mon, 12 Jun 2023 11:11:46 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 35CBBkSk046186 for bugs@FreeBSD.org; Mon, 12 Jun 2023 11:11:46 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 271964] seq(1) printing one line more than it should for many inputs since at least early 2018 Date: Mon, 12 Jun 2023 11:11:47 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: Unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: daniel@octaforge.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271964 Bug ID: 271964 Summary: seq(1) printing one line more than it should for many inputs since at least early 2018 Product: Base System Version: Unspecified Hardware: Any OS: Any Status: New Severity: Affects Many People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: daniel@octaforge.org Currently running the following will get you incorrect results: $ seq 1 1050000|wc -l 1050001 It comes down to this: $ seq 1050000 1050000 1.05e+06 1.05e+06 I've been able to track down the offending commit, which is https://github.com/freebsd/freebsd-src/commit/3049d4ccc031e5d4d0ff6b9a24451= 31f507778f2 As I see it, the logic of that commit is wrong and will result in false positives more often than not in practice. The %g format string which is us= ed by default will truncate any value over 999999. The decimal precision of a double type is much larger than that, as double has 53-bit mantissa. While = at it, the condition that 'cur !=3D last_shown_value' will *always* be true, a= s the 'cur' will *always* need to increment past the end in order to break the lo= op at all. I don't see any reliable way to check this, actually. I don't think it is actually possible to check if a rounding error happened or not. Therefore, I think the above change should be reverted, unless somebody has a better ide= a. This likely affects other BSDs as well, as it was found thanks to https://floss.social/@Gottox@chaos.social/110527807611326720 - but I'm reporting it here as I work primarily with FreeBSD sources and reverted it = in my project (https://github.com/chimera-linux/chimerautils/commit/1ecc1e99d4a309631e846= a868b5a422f996704ac). --=20 You are receiving this mail because: You are the assignee for the bug.=