From nobody Thu Feb 5 19:40:49 2026 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 4f6SJ148XFz6R64y for ; Thu, 05 Feb 2026 19:40:49 +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 "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4f6SJ11Nsfz4JcS for ; Thu, 05 Feb 2026 19:40:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1770320449; 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=TmZglPug5iy8lNPKDeoQxgKV0AZYOiKS9xGcg4a0BRE=; b=SpsF56O7H5ZI9doCmNPeU/StUjNMRuRaw5zzCQA59Ij00FaDn28A6hAmb5OZq+M5RCHi7s XITYpa1a8IawEau9M+tT0g/UjHGgktHL+w9QerrE2j/C3/8GmMWGsvOQbQBuyllmJZaQgi FT+pmkJv5paOKRieB75y2D3RgXY/E9R2bn2onmK4gGEU77Y56MtMfa0J7wexqvhAjltBGX SKU27+W49hiZJwSm0im7v9c3DUWxbpF88VzQgXqCIFiVSJ2Zm1COUuHDQDMcmM4RqUc/ux oaDjg651l+LsTpx/zwogBwCkzIAgvLju3o3TpHQrHlOnIIeNE5q8XUfUqBh9Kw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1770320449; a=rsa-sha256; cv=none; b=nSFVPAPFmeDLgd7GwW8GxIXuWsGS7u4rddRXBO6LHkOuN56YqqO/Y/Ir34kUdK7xulVHtj gt8AI4HgNhxkY18ETZgFdQ1k3rHOo6bi4rOHFlpxuha4jEZYTOUyPpr0Azbh52aiJm9rLn g6LauqmxFe0G7YHog3YNUVJOaNDvmt41n4k+A480pVXtz30wnL87JZoVi/f/G5oL/T6i3R Wx6PtzDlpKWS1J3zU4zdVghuVN90bjr98064/PjJCnYDX2l5r/DsYqnMBYTpmW/7X1oX7z CnwZ/iQPY0nYfJ3bSawhLwMkQ+8iOLusKw3TI+FCUrhUciOm8+s5Mzq4Pn9tkw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1770320449; 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=TmZglPug5iy8lNPKDeoQxgKV0AZYOiKS9xGcg4a0BRE=; b=FAq9GzyxU65++stdiqQW+PYycx4FeMxyxLBFDZ+QDz2uSspGfYMJlRaEo5KG6mzopIaai0 3bc8N0scLUwiK3fj/TNmVXOgb73NAghW7/sP167O5cRmjfToqbZ5vQ7doY259JQdOzeSo7 c4U4eey+P6wkWGPOme6GNC1gFb9+M6vwbOAfVgNQePSDk692dAVJl0QiTl5ORD6D8n+f1e yRftHdob7qaPmDIRWeFNYBQocGt1YFuzbWJwIpO6eThNMHBAUlHgRNjmcEkQOhvB0D9My8 UNnaiJ2HVTz0fMh+8guHo3U3K93GJ9iF2iBdpA4QTj0RXlRT8FAlnJML3raJ0g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4f6SJ110r4zkDy for ; Thu, 05 Feb 2026 19:40:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3b148 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 05 Feb 2026 19:40:49 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: f8c12e6e3874 - main - diff: Report I/O errors in Stone algorithm 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f8c12e6e3874cdd353fb16785da6f4e7eb134cd9 Auto-Submitted: auto-generated Date: Thu, 05 Feb 2026 19:40:49 +0000 Message-Id: <6984f241.3b148.1f4cabb0@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=f8c12e6e3874cdd353fb16785da6f4e7eb134cd9 commit f8c12e6e3874cdd353fb16785da6f4e7eb134cd9 Author: Dag-Erling Smørgrav AuthorDate: 2026-02-05 17:41:56 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-02-05 19:40:35 +0000 diff: Report I/O errors in Stone algorithm In the legacy Stone algorithm, we do a first pass over the files to check if they're identical before we start diffing them. That code would correctly set the exit status if an I/O error was encountered, but would not emit an error message. Do so. PR: 292198 MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: thj Differential Revision: https://reviews.freebsd.org/D55125 --- usr.bin/diff/diffreg.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index 95c724817ede..8dcf55a7190b 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -406,6 +406,10 @@ diffreg_stone(char *file1, char *file2, int flags, int capsicum) break; default: /* error */ + if (ferror(f1)) + warn("%s", file1); + if (ferror(f2)) + warn("%s", file2); rval = D_ERROR; status |= 2; goto closem; @@ -499,9 +503,9 @@ files_differ(FILE *f1, FILE *f2, int flags) return (0); for (;;) { - i = fread(buf1, 1, sizeof(buf1), f1); - j = fread(buf2, 1, sizeof(buf2), f2); - if ((!i && ferror(f1)) || (!j && ferror(f2))) + if ((i = fread(buf1, 1, sizeof(buf1), f1)) == 0 && ferror(f1)) + return (-1); + if ((j = fread(buf2, 1, sizeof(buf2), f2)) == 0 && ferror(f2)) return (-1); if (i != j) return (1);