From owner-svn-src-head@freebsd.org Tue Oct 27 12:57:26 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2F4F544C808; Tue, 27 Oct 2020 12:57:26 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CLBYy0TKRz4nGD; Tue, 27 Oct 2020 12:57:26 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from ivaldir.etoilebsd.net (etoilebsd.net [178.32.217.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: bapt) by smtp.freebsd.org (Postfix) with ESMTPSA id CFA0D2DE82; Tue, 27 Oct 2020 12:57:25 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: by ivaldir.etoilebsd.net (Postfix, from userid 1001) id 2A0F84913A; Tue, 27 Oct 2020 13:57:24 +0100 (CET) Date: Tue, 27 Oct 2020 13:57:24 +0100 From: Baptiste Daroussin To: Kyle Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r367076 - head/usr.bin/diff Message-ID: <20201027125724.onnk46ruaqyqyizk@ivaldir.net> References: <202010271227.09RCRQEN018075@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="qk7s5qzpftmxct3m" Content-Disposition: inline In-Reply-To: <202010271227.09RCRQEN018075@repo.freebsd.org> X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Oct 2020 12:57:26 -0000 --qk7s5qzpftmxct3m Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 27, 2020 at 12:27:26PM +0000, Kyle Evans wrote: > Author: kevans > Date: Tue Oct 27 12:27:26 2020 > New Revision: 367076 > URL: https://svnweb.freebsd.org/changeset/base/367076 >=20 > Log: > diff: don't force the format to 'context' with -p immediately > =20 > Instead, leave the fomat as unspecified (if it hasn't been) and use the > -p flag as a hint to 'context' if no other formatting option is specifi= ed. > =20 > This fixes `diff -purw`, used frequently by emaste, and matches the beh= avior > of its GNU counterpart. > =20 > PR: 250015 > Reviewed by: emaste > MFC after: 1 week >=20 > Modified: > head/usr.bin/diff/diff.c >=20 > Modified: head/usr.bin/diff/diff.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/usr.bin/diff/diff.c Tue Oct 27 11:29:11 2020 (r367075) > +++ head/usr.bin/diff/diff.c Tue Oct 27 12:27:26 2020 (r367076) > @@ -210,17 +210,6 @@ main(int argc, char **argv) > diff_format =3D D_NREVERSE; > break; > case 'p': > - /* > - * If it's not unset and it's not set to context or > - * unified, we'll error out here as a conflicting > - * format. If it's unset, we'll go ahead and set it to > - * context. > - */ > - if (FORMAT_MISMATCHED(D_CONTEXT) && > - FORMAT_MISMATCHED(D_UNIFIED)) > - conflicting_format(); > - if (diff_format =3D=3D D_UNSET) > - diff_format =3D D_CONTEXT; > dflags |=3D D_PROTOTYPE; > break; > case 'P': > @@ -320,6 +309,8 @@ main(int argc, char **argv) > newarg =3D optind !=3D prevoptind; > prevoptind =3D optind; > } > + if (diff_format =3D=3D D_UNSET && (dflags & D_PROTOTYPE) !=3D 0) > + diff_format =3D D_CONTEXT; > if (diff_format =3D=3D D_UNSET) > diff_format =3D D_NORMAL; > argc -=3D optind; I think it would be great to have a test to ensure we don't break it in the futur. Bapt --qk7s5qzpftmxct3m Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEgOTj3suS2urGXVU3Y4mL3PG3PloFAl+YGTEACgkQY4mL3PG3 PlpnOxAA48yGK1BrhOTGjcVhAAFdV2Cf05/nYHN1FlnRpzMVKlaem+ulNsu4uRd9 1Zz3tZaYgVBTPBEuH+QVzToOUimLkTxXv3OVCAIaKx/XT2bz1d2n5UH8+kD3Jr22 0lWW19QeOdoJw2m4vJow1Tre//8fDFpmh4NVIG5jKPcDyqygZ8zy5BNfRFuqh6PT Wmi72um5/enFcg9Uknx4UEFW6/KsYbIZi+qHoziDpgMIUIvCuhVd5z8sH2FT7XFC P3Zxht1DbE2iV3MrikQh4PM7dl7ntwIklhcz15qUlWawscRTDZKxk/7mkQV+s5Fn gbu91iSVD8/iZzGAHkylhCetUl1jZHjbjfDRYIqZAOzmTopv9SMH9j6n5dI/gnpR ao4yon1LYhuhXxLe9GS7AkmPRoZnsWYfMBswDoJgWmbYHzyfa734Pa1DbDqIy/R4 jNhAbr/3qyhINDeZ4Cvjh17+ZqTkfnHQGLkSaZNzk6Gnqor7LULOa+qWdrDq/ITt e/OL8qM5ieHbBBmlgvErWH1c+dkGDIlLUp31Zmw1JRhITjprg+2zlUycfAF+wzUI yRlKpj2aOQ8ICbwB2mVmNSg8E+XjLqcMDNg0YMr8aMNgmvKWKVXQtf7ugU3MZAWI Kkx5YrVUisuqs8k50tThRe083VEfadOURS0ULF/OzOP4Fd1u1Qg= =HoRE -----END PGP SIGNATURE----- --qk7s5qzpftmxct3m--