NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/60177: vi crash when using cedit



The following reply was made to PR bin/60177; it has been noted by GNATS.

From: RVP <rvp%SDF.ORG@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: bin/60177: vi crash when using cedit
Date: Thu, 9 Apr 2026 07:03:51 +0000 (UTC)

 On Mon, 6 Apr 2026, Mouse via gnats wrote:
 
 > 	Representing control characters with ^ notation, this means
 > 	typing
 >
 > 	vi
 > 	i
 > 	^[:set cedit=^V^R
 > 	:^R
 >
 > 	The crash occurs shortly after the last ^R is typed.
 >
 
 The crash only seems to happen when:
 
 1. You invoke `cedit' on the 2nd line;
 2. and, only if the `cedit' buffer is empty--not otherwise.
 
 Here're 2 patches to address this. The first is mine (which I of course prefer);
 the other is from nvi2 (to keep these two nvi code-bases sort-of in sync--the
 latest nvi code [https://repo.or.cz/nvi.git] crashes too).
 
 ---START patch 1---
 diff -urN src/external/bsd/nvi.orig/dist/vi/vs_split.c src/external/bsd/nvi/dist/vi/vs_split.c
 --- src/external/bsd/nvi.orig/dist/vi/vs_split.c	2014-01-26 21:43:45.000000000 +0000
 +++ src/external/bsd/nvi/dist/vi/vs_split.c	2026-04-09 06:36:10.634190374 +0000
 @@ -72,7 +72,7 @@
   	CALLOC(sp, _HMAP(new), SMAP *, SIZE_HMAP(sp), sizeof(SMAP));
   	if (_HMAP(new) == NULL)
   		return (1);
 -	_HMAP(new)->lno = sp->lno;
 +	_HMAP(new)->lno = 0;
   	_HMAP(new)->coff = 0;
   	_HMAP(new)->soff = 1;
 
 ---END patch 1---
 
 ---START patch 2---
 >From nvi2:
 
 https://github.com/lichray/nvi2/commit/3c7a9a74038f593ab4a437cfe8f791092a796b1e
 
 diff -urN src/external/bsd/nvi.orig/dist/vi/vs_refresh.c src/external/bsd/nvi/dist/vi/vs_refresh.c
 --- src/external/bsd/nvi.orig/dist/vi/vs_refresh.c	2018-04-10 12:44:41.000000000 +0000
 +++ src/external/bsd/nvi/dist/vi/vs_refresh.c	2026-04-09 06:46:38.124130868 +0000
 @@ -315,7 +315,8 @@
   				if (vs_sm_1down(sp))
   					return (1);
   			goto adjust;
 -		}
 +		} else
 +			goto top;	/* XXX No such line. */
 
   		/*
   		 * If less than a half screen from the bottom of the file,
 ---END patch 2---
 
 -RVP
 



Home | Main Index | Thread Index | Old Index