git: 3e2277276975 - stable/14 - sed: The change ("c") command should start a new cycle.

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Fri, 17 Jan 2025 19:17:32 UTC
The branch stable/14 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=3e22772769757b31d2b9383b5f510d4e43afaa8b

commit 3e22772769757b31d2b9383b5f510d4e43afaa8b
Author:     Valeriy Ushakov <uwe@netbsd.org>
AuthorDate: 2024-12-17 22:27:01 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-01-17 18:48:07 +0000

    sed: The change ("c") command should start a new cycle.
    
    The "c" command should start the next cycle as clarified in POSIX 2024.
    This is also consistent with historical and gnu sed behavior.
    
    This patch is from OpenBSD by way of NetBSD with a tweak to the man page
    date by me.
    
    Confirmed the test case in the bug now works.
    
    PR:             271817
    Obtained from:  NetBSD (1.39 uwe), OpenBSD (1.39 millert)
    Sponsored by:   Netflix
    
    (cherry picked from commit a2d78713171cf138b5ae50d61f82df1af7574c95)
---
 usr.bin/sed/process.c | 2 +-
 usr.bin/sed/sed.1     | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/usr.bin/sed/process.c b/usr.bin/sed/process.c
index 945db462a601..e3f2bcab4881 100644
--- a/usr.bin/sed/process.c
+++ b/usr.bin/sed/process.c
@@ -137,7 +137,7 @@ redirect:
 				psl = 0;
 				if (cp->a2 == NULL || lastaddr || lastline())
 					(void)fprintf(outfile, "%s", cp->t);
-				break;
+				goto new;
 			case 'd':
 				pd = 1;
 				goto new;
diff --git a/usr.bin/sed/sed.1 b/usr.bin/sed/sed.1
index 29ede6d70230..90b23e2834de 100644
--- a/usr.bin/sed/sed.1
+++ b/usr.bin/sed/sed.1
@@ -30,7 +30,7 @@
 .\"
 .\"	@(#)sed.1	8.2 (Berkeley) 12/30/93
 .\"
-.Dd April 8, 2021
+.Dd December 17, 2024
 .Dt SED 1
 .Os
 .Sh NAME
@@ -374,7 +374,7 @@ If the label is not specified, branch to the end of the script.
 .Pp
 .It [2addr]c\e
 .It text
-Delete the pattern space.
+Delete the pattern space and start the next cycle.
 With 0 or 1 address or at the end of a 2-address range,
 .Em text
 is written to the standard output.