Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 08 Mar 2023 20:49:02 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 270048] nvi(1) errors when g//!{cmd} modifies the number of lines
Message-ID:  <bug-270048-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D270048

            Bug ID: 270048
           Summary: nvi(1) errors when g//!{cmd} modifies the number of
                    lines
           Product: Base System
           Version: Unspecified
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: freebsd@tim.thechases.com

To replicate

 $ yes hello | head -50 | fmt -100 > wide_lines.txt
 $ vi wide_lines.txt
 :.!fmt

correctly formats the first line as expected.  However attempting=20
to reformat each individual line with:

 :g/^/.!fmt=20

errors with """
+=3D+=3D+=3D+=3D+=3D+=3D+=3D+
Illegal address: only 6 lines in the file.
Error: unable to retrieve line 7; 4 lines added; 2 lines deleted
Press any key to continue:=20
"""

(the "4 lines added; 2 lines deleted" and possibly the "Press any=20
key to continue" might be a screen artifact from prior to the error
message since it's not in reverse video like the rest of the error)

Expected behavior:  each individual line gets passed through fmt(1)=20
to reformat it.

Observed behavior:  an error about the number of lines in the file
and only a portion of the lines are properly reformatted.

It sounds like something isn't re-calculating the number of lines=20
in the file before/after a "!{cmd}" invocation within the context=20
of a :g// command.  Or perhaps the lines marked by the g:// don't=20
get updated after reading data output of an external "!{cmd}"

FWIW, this manifests in OpenBSD's nvi(1), too.

(bug encountered when using composing a mail message, wanting to reformat l=
ong
lines individually rather than by paragraph)

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-270048-227>