From nobody Sun Mar 22 08:05:58 2026 X-Original-To: dev-commits-src-branches@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 4fdplV3Ftqz6W9cF for ; Sun, 22 Mar 2026 08:05:58 +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" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fdplV1R9fz3Ywg for ; Sun, 22 Mar 2026 08:05:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1774166758; 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=9WPISdfOHYJ31uo66nYbxf01ZxK7DRA5ebwK73jogoU=; b=kvZpOWPDQWfnijNFE08HQMKVYDsxT2jsfJX8Y3l0J+oVQx4Tv6zT/dLYSOOdYW44ijTnMj 1cU0mRV3XqjqGbJoGuAHrd35+0SKmb6XVwYP+Zui//VSkud9Ndr3z+PEy17Vcc/AOJ2YQh Qmy1iXrCMsr7BFBSoPyFH2zMjO82nraCulOc375rTzqAqsvd/R1dbSEvNXZmkl5bB49FlY 7Fb4mEbM2ubZNi0HWmgl555cLgKdFZvBnWRA1V76YoWxrMrhUd2pPqNx5zJvkjXp5Fpgun oFxhSrqhTZBCfs8VTgx1tiyY6qSSS1rtKwBQD3xunynZ1c98seESUq89VrU0pQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1774166758; a=rsa-sha256; cv=none; b=Em5Qu8s4H6fV30cV/XKwubOnFdvbyWdQUzZ/AsnxY/hp1Hmtf4UTbw0BqmIXCsDRdtJeAU HAVEzwXqjlHxMI92YgJ0ZU5NqFH1tHhr1PxVXtBR4ldcIQGZnuP3bik2igkWiC4dKT2bfQ Rv02t7CYnbRW/qxgOlrZdjV4Av/mK75mhaqoz6rTn6W4hYcMBven5mJiVC659tNv5CV/qz yHH3N+8VngjWDcqeK6g1G95Hg/qUnHnvbXkbMuyXYgjWUpwLcYPUwgFXEYKEou5XRWX31I gvNLZIawZaPPzlmLgaZPVPu3IRkPQ7bFv1u2i3Tt2pxJCw3DZRL/r4OXtbLlNw== 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=1774166758; 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=9WPISdfOHYJ31uo66nYbxf01ZxK7DRA5ebwK73jogoU=; b=h2N0RbEFZGESasiOM04nKU+oWlpFi6xaxf+VpkK6J9/4JW+zS/S8wEKipJwL3czXDIpCVv wSoth4GdoYRx5X5ol26RcZ7nLX4MVto91vWzqxkutS5b/YfdtegpvEN2OuvmJfbI4bCMRE oiNxJf1PqzXZqyRr92lvrSh5b09uAZIP4VuutdWiN8cCQM5dk6Gjr2mxrB+HOfg0J7AhJm NMwfY52Se3Xlmunr5wzjMRrUnetxQoEb+y9PN24cCQAS918rt6sLmeHvkq3CvAsWVXzHqo 05WYor0UbQFuXb4L9PfhuWe4E4KJpw0Zc3BnUYwEI4ejVYrhwViWN9HvOyW9EQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fdplV11LFzrLR for ; Sun, 22 Mar 2026 08:05:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1a413 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 22 Mar 2026 08:05:58 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: fa37a9e9135e - stable/15 - diff3: Produce correct exit status List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/15 X-Git-Reftype: branch X-Git-Commit: fa37a9e9135e5e87d8dc6342545c2e4f14537121 Auto-Submitted: auto-generated Date: Sun, 22 Mar 2026 08:05:58 +0000 Message-Id: <69bfa2e6.1a413.c55fc93@gitrepo.freebsd.org> The branch stable/15 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=fa37a9e9135e5e87d8dc6342545c2e4f14537121 commit fa37a9e9135e5e87d8dc6342545c2e4f14537121 Author: Dag-Erling Smørgrav AuthorDate: 2026-03-02 08:52:06 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-03-22 02:04:59 +0000 diff3: Produce correct exit status Use exit status 2 for errors, 1 only to indicate that differences were found between the inputs (in some operating modes). MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: ngie, bapt Differential Revision: https://reviews.freebsd.org/D55608 (cherry picked from commit fe5341287c6c9bacc18879b25ed72ceb42e1c811) --- usr.bin/diff3/diff3.1 | 17 ++++++++++++++++- usr.bin/diff3/diff3.c | 26 +++++++++++++------------- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/usr.bin/diff3/diff3.1 b/usr.bin/diff3/diff3.1 index 9286a79e6ec6..8ca2d9f853af 100644 --- a/usr.bin/diff3/diff3.1 +++ b/usr.bin/diff3/diff3.1 @@ -27,7 +27,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd June 23, 2022 +.Dd March 1, 2026 .Dt DIFF3 1 .Os .Sh NAME @@ -196,6 +196,21 @@ The lines beneath this notation are ranges of lines which are exclusively different in file .Va n . .El +.Sh EXIT STATUS +The +.Nm +utility exits with a status of 0 on success +and >1 if an error occurred. +Additionally, if the +.Fl A , +.Fl E , +.Fl L , +.Fl m , +or +.Fl X +flags were specified, +it exits with a status of 1 if conflicts were found. +.El .Sh SEE ALSO .Xr diff 1 , .Xr ed 1 , diff --git a/usr.bin/diff3/diff3.c b/usr.bin/diff3/diff3.c index fce4d353af69..0f114163321f 100644 --- a/usr.bin/diff3/diff3.c +++ b/usr.bin/diff3/diff3.c @@ -202,7 +202,7 @@ strtoi(char *str, char **end) if ((end != NULL && *end == str) || num < 0 || num > INT_MAX || errno == EINVAL || errno == ERANGE) - err(1, "error in diff output"); + err(2, "error in diff output"); return (int)num; } @@ -267,7 +267,7 @@ readin(int fd, struct diff **dd) if (*p == ',') d = strtoi(p + 1, &p); if (*p != '\n') - errx(1, "error in diff output"); + errx(2, "error in diff output"); if (kind == 'a') a++; else if (kind == 'c') @@ -275,11 +275,11 @@ readin(int fd, struct diff **dd) else if (kind == 'd') c++; else - errx(1, "error in diff output"); + errx(2, "error in diff output"); b++; d++; if (b < a || d < c) - errx(1, "error in diff output"); + errx(2, "error in diff output"); (*dd)[i].old.from = a; (*dd)[i].old.to = b; (*dd)[i].new.from = c; @@ -287,7 +287,7 @@ readin(int fd, struct diff **dd) if (i > 0) { if ((*dd)[i].old.from < (*dd)[i - 1].old.to || (*dd)[i].new.from < (*dd)[i - 1].new.to) - errx(1, "diff output out of order"); + errx(2, "diff output out of order"); } } if (i > 0) { @@ -564,7 +564,7 @@ skip(int i, int from, const char *pr) for (n = 0; cline[i] < from - 1; n += j) { if ((line = get_line(fp[i], &j)) == NULL) - errx(1, "logic error"); + errx(2, "logic error"); if (pr != NULL) printf("%s%s", Tflag == 1 ? "\t" : pr, line); cline[i]++; @@ -595,7 +595,7 @@ duplicate(struct range *r1, struct range *r2) if (c == -1 && d == -1) break; if (c == -1 || d == -1) - errx(1, "logic error"); + errx(2, "logic error"); nchar++; if (c != d) { repos(nchar); @@ -652,7 +652,7 @@ printrange(FILE *p, struct range *r) return; if (r->from > r->to) - errx(1, "invalid print range"); + errx(2, "invalid print range"); /* * XXX-THJ: We read through all of the file for each range printed. @@ -900,27 +900,27 @@ increase(void) p = reallocarray(d13, newsz, sizeof(*p)); if (p == NULL) - err(1, NULL); + err(2, NULL); memset(p + szchanges, 0, incr * sizeof(*p)); d13 = p; p = reallocarray(d23, newsz, sizeof(*p)); if (p == NULL) - err(1, NULL); + err(2, NULL); memset(p + szchanges, 0, incr * sizeof(*p)); d23 = p; p = reallocarray(de, newsz, sizeof(*p)); if (p == NULL) - err(1, NULL); + err(2, NULL); memset(p + szchanges, 0, incr * sizeof(*p)); de = p; q = reallocarray(overlap, newsz, 1); if (q == NULL) - err(1, NULL); + err(2, NULL); memset(q + szchanges, 0, incr * 1); overlap = q; s = reallocarray(de_delta, newsz, sizeof(*s)); if (s == NULL) - err(1, NULL); + err(2, NULL); memset(s + szchanges, 0, incr * sizeof(*s)); de_delta = s; szchanges = newsz;