[Bug 270048] nvi(1) errors when g//{cmd} modifies the number of lines

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 22 Apr 2026 12:18:25 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270048

--- Comment #3 from Tim Chase <freebsd@tim.thechases.com> ---
When reported over on bugs@openbsd, Walter provided a patch here:

https://marc.info/?l=openbsd-bugs&m=177683716412009&w=2

which boils down to changing one ">" to ">=" and adjusting the comment.

--- ex/ex_global.c      20 Apr 2026 10:30:02 -0000      1.19
+++ ex/ex_global.c      22 Apr 2026 05:04:12 -0000
@@ -269,10 +269,10 @@ ex_g_insdel(SCR *sp, lnop_t op, recno_t
                                continue;

                        /*
-                        * If range greater than the line, decrement or
-                        * increment the range.
+                        * If range is greater than or equal to the line,
+                        * decrement or increment the range.
                         */
-                       if (rp->start > lno) {
+                       if (rp->start >= lno) {
                                if (op == LINE_DELETE) {
                                        --rp->start;
                                        --rp->stop;

-- 
You are receiving this mail because:
You are the assignee for the bug.