From nobody Thu Feb 5 15:38:50 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 4f6Lxc0wnzz6QljN; Thu, 05 Feb 2026 15:39:32 +0000 (UTC) (envelope-from freebsd@walstatt-de.de) Received: from smtp052.goneo.de (smtp5.goneo.de [IPv6:2001:1640:5::8:30]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4f6Lxb5lS4z3ftd; Thu, 05 Feb 2026 15:39:31 +0000 (UTC) (envelope-from freebsd@walstatt-de.de) Authentication-Results: mx1.freebsd.org; none Received: from hub2.goneo.de (hub2.goneo.de [IPv6:2001:1640:5::8:53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp5.goneo.de (Postfix) with ESMTPS id 8881824028B; Thu, 5 Feb 2026 16:39:20 +0100 (CET) Received: from hub2.goneo.de (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by hub2.goneo.de (Postfix) with ESMTPS id 9E803240421; Thu, 5 Feb 2026 16:39:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walstatt-de.de; s=DKIM001; t=1770305958; 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: in-reply-to:in-reply-to:references:references; bh=/GzIfzuzWwiLv1XflD1lCbdQ6GPArM1Pqk8UbPtfBKg=; b=RSgEPcsP0IEI2Gp72bPopRCjBQ6zbgRDPeyslWbUx2bj0sDHOJqpCXAXXc6TzM9snaUkpu SX2OlvKMHn+B5jCaBGU4weDnE0RneXh+9nKoh7de4D5bJ1EqI6gcz1gIosKJcJVkUjAqB2 8m13ooT6LcEwLfBKDCL+sGl7b5xCe/01hv1KOoAB3EFx/s1ltH/5H800t+dtPqfRvdfohS BuD4CI9e4JHmPaPz//ywcyxvCSq1or3oMiQUuMz33d0JEj+WzTS8Z2rSePfr/FNc6JB0az WRVD4IwJmON9c1ATIXrQ1vdpb8r9cUo4Wk3XHpZlndb6XKRJ+fs5HlczgYxzXg== Received: from thor.sb211.local (dynamic-2a02-3100-2efd-fd02-a884-0216-289d-5b94.310.pool.telefonica.de [IPv6:2a02:3100:2efd:fd02:a884:216:289d:5b94]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by hub2.goneo.de (Postfix) with ESMTPSA id 4009A24039D; Thu, 5 Feb 2026 16:39:18 +0100 (CET) Date: Thu, 5 Feb 2026 16:38:50 +0100 From: A FreeBSD User To: Dag-Erling =?UTF-8?B?U23DuHJncmF2?= Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 590126789c84 - main - diff: Don't compare a file or directory to itself Message-ID: <20260205162739.132689b5@thor.sb211.local> In-Reply-To: <6984ad1d.39760.188296e8@gitrepo.freebsd.org> References: <6984ad1d.39760.188296e8@gitrepo.freebsd.org> X-Mailer: Claws Mail 3.21.0 (GTK+ 2.24.33; amd64-portbld-freebsd16.0) 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: multipart/signed; boundary="Sig_/1e1plY84Qqzw2sr1atKsDpr"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Rspamd-UID: 131d73 X-Rspamd-UID: 0aa89b X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:25394, ipnet:2001:1640::/32, country:DE] X-Rspamd-Queue-Id: 4f6Lxb5lS4z3ftd X-Spamd-Bar: ---- --Sig_/1e1plY84Qqzw2sr1atKsDpr Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Am Tage des Herren Thu, 05 Feb 2026 14:45:49 +0000 Dag-Erling Sm=C3=B8rgrav schrieb: > The branch main has been updated by des: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D590126789c841d80655869bc07= 5c8980c173dd1c >=20 > commit 590126789c841d80655869bc075c8980c173dd1c > Author: Dag-Erling Sm=C3=B8rgrav > AuthorDate: 2026-02-05 14:39:57 +0000 > Commit: Dag-Erling Sm=C3=B8rgrav > CommitDate: 2026-02-05 14:39:57 +0000 >=20 > diff: Don't compare a file or directory to itself > =20 > While here, stop abusing struct dirent for something we don't even ne= ed > to store. > =20 > PR: 254455 > MFC after: 1 week > Sponsored by: Klara, Inc. > Reviewed by: thj, kevans > Differential Revision: https://reviews.freebsd.org/D55113 > --- > usr.bin/diff/diffdir.c | 14 ++++++-------- > usr.bin/diff/diffreg.c | 3 +++ > usr.bin/diff/tests/diff_test.sh | 19 +++++++++++++++++++ > 3 files changed, 28 insertions(+), 8 deletions(-) >=20 > diff --git a/usr.bin/diff/diffdir.c b/usr.bin/diff/diffdir.c > index a55a2bec70ee..bd8ef73e785a 100644 > --- a/usr.bin/diff/diffdir.c > +++ b/usr.bin/diff/diffdir.c > @@ -41,8 +41,6 @@ static void diffit(struct dirent *, char *, size_t, str= uct dirent *, > char *, size_t, int); > static void print_only(const char *, size_t, const char *); > =20 > -#define d_status d_type /* we need to store status for -l */ > - > struct inode { > dev_t dev; > ino_t ino; > @@ -258,7 +256,6 @@ diffit(struct dirent *dp, char *path1, size_t plen1, = struct dirent *dp2, > flags |=3D D_EMPTY1; > memset(&stb1, 0, sizeof(stb1)); > } > - > if (lstat(path2, &stb2) !=3D 0) { > if (!Nflag || errno !=3D ENOENT) { > warn("%s", path2); > @@ -315,7 +312,6 @@ diffit(struct dirent *dp, char *path1, size_t plen1, = struct dirent *dp2, > flags |=3D D_EMPTY1; > memset(&stb1, 0, sizeof(stb1)); > } > - > if (stat(path2, &stb2) !=3D 0) { > if (!Nflag || errno !=3D ENOENT) { > warn("%s", path2); > @@ -328,6 +324,8 @@ diffit(struct dirent *dp, char *path1, size_t plen1, = struct dirent *dp2, > if (stb1.st_mode =3D=3D 0) > stb1.st_mode =3D stb2.st_mode; > } > + if (stb1.st_dev =3D=3D stb2.st_dev && stb1.st_ino =3D=3D stb2.st_ino) > + return; > if (S_ISDIR(stb1.st_mode) && S_ISDIR(stb2.st_mode)) { > if (rflag) > diffdir(path1, path2, flags); > @@ -337,12 +335,12 @@ diffit(struct dirent *dp, char *path1, size_t plen1= , struct dirent > *dp2, return; > } > if (!S_ISREG(stb1.st_mode) && !S_ISDIR(stb1.st_mode)) > - dp->d_status =3D D_SKIPPED1; > + rc =3D D_SKIPPED1; > else if (!S_ISREG(stb2.st_mode) && !S_ISDIR(stb2.st_mode)) > - dp->d_status =3D D_SKIPPED2; > + rc =3D D_SKIPPED2; > else > - dp->d_status =3D diffreg(path1, path2, flags, 0); > - print_status(dp->d_status, path1, path2, ""); > + rc =3D diffreg(path1, path2, flags, 0); > + print_status(rc, path1, path2, ""); > } > =20 > /* > diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c > index 91ae5ee6591a..95c724817ede 100644 > --- a/usr.bin/diff/diffreg.c > +++ b/usr.bin/diff/diffreg.c > @@ -372,6 +372,9 @@ diffreg_stone(char *file1, char *file2, int flags, in= t capsicum) > goto closem; > } > =20 > + if (stb1.st_dev =3D=3D stb2.st_dev && stb1.st_ino =3D=3D stb2.st_ino) > + goto closem; > + > if (lflag) > pr =3D start_pr(file1, file2); > =20 > diff --git a/usr.bin/diff/tests/diff_test.sh b/usr.bin/diff/tests/diff_te= st.sh > index a3f76602cf37..0c8147c7ed18 100755 > --- a/usr.bin/diff/tests/diff_test.sh > +++ b/usr.bin/diff/tests/diff_test.sh > @@ -432,6 +432,24 @@ prleak_body() > atf_check diff -Astone -rul a b > } > =20 > +same_head() > +{ > + atf_set "descr" "Don't diff a file or directory with itself" > +} > +same_body() > +{ > + local n=3D256 > + mkdir a > + for hi in $(jot -w%02x $n 0) ; do > + mkdir a/$hi > + for lo in $(jot -w%02x $n 0) ; do > + echo "$hi$lo" >a/$hi/$lo > + done > + done > + ln -s a b > + atf_check timeout 1s diff -rqs a b > +} > + > atf_init_test_cases() > { > atf_add_test_case simple > @@ -462,4 +480,5 @@ atf_init_test_cases() > atf_add_test_case bigc > atf_add_test_case bigu > atf_add_test_case prleak > + atf_add_test_case same > } >=20 Buildworld seems to fail with newly added diff code: [...] --- all_subdir_usr.bin --- 342 | rc =3D diffreg(path1, path2, flags, 0); | ^ /usr/src/usr.bin/diff/diffdir.c:343:15: error: use of undeclared identifier= 'rc' 343 | print_status(rc, path1, path2, ""); Kind regards, oh --=20 A FreeBSD user --Sig_/1e1plY84Qqzw2sr1atKsDpr Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQRQheDybVktG5eW/1Kxzvs8OqokrwUCaYS5pQAKCRCxzvs8Oqok r9kuAQDSz+4UhOsv0sUrTlosnMEg9l52dsgUL9u6Yr8B6GVAvgD+MYk4GJJxA8gG rLgvsBDMiOk4L8c0Xej4YYQv04+ETQk= =GoH/ -----END PGP SIGNATURE----- --Sig_/1e1plY84Qqzw2sr1atKsDpr--