From nobody Thu Oct 07 15:09:46 2021 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 803D017EA4E8; Thu, 7 Oct 2021 15:09:46 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HQF9Q3Bjgz3R7f; Thu, 7 Oct 2021 15:09:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 4D50C15F0D; Thu, 7 Oct 2021 15:09:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 197F9kmJ094489; Thu, 7 Oct 2021 15:09:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 197F9kqv094488; Thu, 7 Oct 2021 15:09:46 GMT (envelope-from git) Date: Thu, 7 Oct 2021 15:09:46 GMT Message-Id: <202110071509.197F9kqv094488@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mariusz Zaborski Subject: git: 824bbb9a4082 - main - diff: consider two files with same inodes as identical 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 824bbb9a40820fb62bde0a91c0f13e0b894da149 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=824bbb9a40820fb62bde0a91c0f13e0b894da149 commit 824bbb9a40820fb62bde0a91c0f13e0b894da149 Author: Mariusz Zaborski AuthorDate: 2021-10-07 15:07:00 +0000 Commit: Mariusz Zaborski CommitDate: 2021-10-07 15:07:00 +0000 diff: consider two files with same inodes as identical Obtained from: OpenBSD MFC after: 1 week --- usr.bin/diff/diffreg.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index fc3c3406a073..995843f9e539 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -440,6 +440,10 @@ files_differ(FILE *f1, FILE *f2, int flags) if ((flags & (D_EMPTY1|D_EMPTY2)) || stb1.st_size != stb2.st_size || (stb1.st_mode & S_IFMT) != (stb2.st_mode & S_IFMT)) return (1); + + if (stb1.st_dev == stb2.st_dev && stb1.st_ino == stb2.st_ino) + return (0); + for (;;) { i = fread(buf1, 1, sizeof(buf1), f1); j = fread(buf2, 1, sizeof(buf2), f2);