From nobody Tue Nov 25 18:17:40 2025 X-Original-To: dev-commits-src-main@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 4dG9sK3WBlz6HZKL for ; Tue, 25 Nov 2025 18:17:41 +0000 (UTC) (envelope-from git@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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dG9sK0TLwz41FZ for ; Tue, 25 Nov 2025 18:17:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1764094661; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UR/nlYgkAULVwtxBU4X5Ybs6Fmz8VJTO4BN2yIvjh4M=; b=qbaY+weqyr+A6oHn2WPKVgjs0Dv1p8kRx8w+py13OLJYZFfUre+ZVOmI8zMmD8uXgf5YYL GUTV/qEUGwbnRTSmZn2qw5gcUjdq7CpI49l9DJKVUaIrfQyXm6X55B+ANdg3LwAxgjpwMV 2YkpNvOL1T3LGQXgKkjXjwJvmc7yOvWH+vxLNS925oieOb8LREFMPNwPgaajUq6Ir/Mhbk pQ8jtSwDBlIjpKxDwFMfQe0AeXdjJAlJG6v5hFS3FzPmDpJ0CArKQ9C4sxY17DXFO0tu6q 5n2vhKQCVkzGc56yWb1oPWeCR/bJoza6B6n+bUa8vGPAqc/hp1ee2ZTUWzvpSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1764094661; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UR/nlYgkAULVwtxBU4X5Ybs6Fmz8VJTO4BN2yIvjh4M=; b=KS28RgOg84Z0R0tHry1VjJXMlI+6uoIuBlqRZ6Bd3sEgtQbfx/gYI55a52mRVB396XnWJl P6qSjpoVUfeLRXAtFjkF2DWAYY7L841sPPROfti74tTUFCvl4EmvnEzJMLPyh3I4/zoK4H idsHTEe28GTNi7DFE2GRJZpqqk7GtqNz8ZWLSJnK0cw7bnHLpYQqvQ88RMgkYtMCDpfNuR flzdyBub8U+pn5cYY3qEETIcxtkjrfUUHsBtzDSbksXniJuDI1YsuMo1eUiymwzfRxmw9f t+yJO8+kY6zExBpaUOjpt0Lcxw9KOnyHhHDYHe4bdf9UZ68h7iFzxTZqqfreeA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1764094661; a=rsa-sha256; cv=none; b=TfXwZey/k9a2z2ZR0q6Ddowz49q1ve8WKKldmCQKTuDAcm7CNKTK+phJtwHVvPjfvV1Z9q Xp3IPSScBzTCNqHU6KK82mFdHBTEcwjfHmfaeLp6Ylrl6nY+GgpA3oKQW8GSs86BjrZPGr fj2qFnef1xhvFoNMaf0ZQqj0aUIKQ93LSQnivzHllwQpWzGB4i9euqWwEsxk7gdustafLK t/8NYO8G+Mz+jXayi9gQtYnEZc8/NfrPvMTLCB3QbR+17GtzQV2bPt5/EuHzbIzWbYqLye fEz86DvuXomNqHMwNUd/mu8RHwbNsJQj/06tBN5AVMQe8SIzCBEEhAHpCsj0Sw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dG9sJ6xQGz19PX for ; Tue, 25 Nov 2025 18:17:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id e4ef by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 25 Nov 2025 18:17:40 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Matt Jacobson From: Warner Losh Subject: git: 4c8bf76893a8 - main - fdread: Fix logic bug when reading by sector List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4c8bf76893a8b39eda15f91d1515c6bf6a02a9a6 Auto-Submitted: auto-generated Date: Tue, 25 Nov 2025 18:17:40 +0000 Message-Id: <6925f2c4.e4ef.50f3b32a@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4c8bf76893a8b39eda15f91d1515c6bf6a02a9a6 commit 4c8bf76893a8b39eda15f91d1515c6bf6a02a9a6 Author: Matt Jacobson AuthorDate: 2025-11-25 01:30:10 +0000 Commit: Warner Losh CommitDate: 2025-11-25 18:17:26 +0000 fdread: Fix logic bug when reading by sector When reading by sector (because reading a whole track failed), we can accidentally fall into the "should not happen" path, which both (a) emits a spurious error message and (b) fouls up our position accounting going forward. Ensure we do not inappropriately fall into that path. Avoid obscuring the "short after" message in cases where it happens. Signed-off-by: Matt Jacobson Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1897 --- usr.sbin/fdread/fdread.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.sbin/fdread/fdread.c b/usr.sbin/fdread/fdread.c index ee8548699783..02dbaf98da8c 100644 --- a/usr.sbin/fdread/fdread.c +++ b/usr.sbin/fdread/fdread.c @@ -275,12 +275,13 @@ doread(int fd, FILE *of, const char *_devname) errx(EX_OSERR, "unexpected read() result: %d", rv); } + continue; } if ((unsigned)rv < tracksize) { /* should not happen */ nbytes += rv; if (!quiet) - fprintf(stderr, "\nshort after %5d KB\r", + fprintf(stderr, "\nshort after %5d KB\n", nbytes / 1024); fwrite(trackbuf, sizeof(unsigned char), rv, of); fflush(of);