testing/nvi: new aport

Including a subset of the debian patchset.
This commit is contained in:
Sören Tempel 2015-11-30 19:14:21 +01:00
parent 4b763f9b85
commit 7525cfa637
26 changed files with 5097 additions and 0 deletions

File diff suppressed because it is too large Load Diff

25
testing/nvi/03db4.patch Normal file
View File

@ -0,0 +1,25 @@
From: <hesso@pool.math.tu-berlin.de>
Subject: libdb4 compatibility adjustments.
--- nvi-1.81.6.orig/common/msg.c 2009-02-26 14:26:58.350336128 +0100
+++ nvi-1.81.6/common/msg.c 2009-02-26 14:29:05.235335829 +0100
@@ -724,9 +724,18 @@
p = buf;
} else
p = file;
+ if (access(p, F_OK) != 0) {
+ if (first) {
+ first = 0;
+ return (1);
+ }
+ sp->db_error = ENOENT;
+ msgq_str(sp, M_DBERR, p, "%s");
+ return (1);
+ }
if ((sp->db_error = db_create(&db, 0, 0)) != 0 ||
(sp->db_error = db->set_re_source(db, p)) != 0 ||
- (sp->db_error = db_open(db, NULL, DB_RECNO, 0, 0)) != 0) {
+ (sp->db_error = db_open(db, NULL, DB_RECNO, DB_CREATE, 0)) != 0) {
if (first) {
first = 0;
return (1);

View File

@ -0,0 +1,10 @@
From: <hesso@pool.math.tu-berlin.de>
Subject: Help configure by decreeing that some headers are present.
diff -Naur nvi-1.81.6.orig/build/confdefs.h nvi-1.81.6/build/confdefs.h
--- nvi-1.81.6.orig/build/confdefs.h 1970-01-01 01:00:00.000000000 +0100
+++ nvi-1.81.6/build/confdefs.h 2008-05-01 18:05:00.000000000 +0200
@@ -0,0 +1,3 @@
+
+#define HAVE_SYS_MMAN_H 1
+#define HAVE_SYS_SELECT_H 1

View File

@ -0,0 +1,15 @@
From: <hesso@pool.math.tu-berlin.de>
Subject: Increase the default 'escapetime' setting to accommodate slow lines.
diff -Naur nvi-1.81.6.orig/common/options.c nvi-1.81.6/common/options.c
--- nvi-1.81.6.orig/common/options.c 2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/common/options.c 2008-05-01 18:06:18.000000000 +0200
@@ -356,7 +356,7 @@
(void)SPRINTF(b2, SIZE(b2),
L("directory=%s"), (s = getenv("TMPDIR")) == NULL ? _PATH_TMP : s);
OI(O_TMP_DIRECTORY, b2);
- OI(O_ESCAPETIME, L("escapetime=1"));
+ OI(O_ESCAPETIME, L("escapetime=3"));
OI(O_KEYTIME, L("keytime=6"));
OI(O_MATCHTIME, L("matchtime=7"));
(void)SPRINTF(b2, SIZE(b2), L("msgcat=%s"), _PATH_MSGCAT);

View File

@ -0,0 +1,46 @@
From: <hesso@pool.math.tu-berlin.de>
Subject: No description.
diff -Naur nvi-1.81.6.orig/common/db1.c nvi-1.81.6/common/db1.c
--- nvi-1.81.6.orig/common/db1.c 2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/common/db1.c 2008-05-01 18:07:58.000000000 +0200
@@ -262,8 +262,7 @@
}
/* Flush the cache, update line count, before screen update. */
- if (lno <= ep->c_lno)
- ep->c_lno = OOBLNO;
+ ep->c_lno = OOBLNO;
if (ep->c_nlines != OOBLNO)
--ep->c_nlines;
@@ -314,8 +313,7 @@
}
/* Flush the cache, update line count, before screen update. */
- if (lno < ep->c_lno)
- ep->c_lno = OOBLNO;
+ ep->c_lno = OOBLNO;
if (ep->c_nlines != OOBLNO)
++ep->c_nlines;
@@ -386,8 +384,7 @@
}
/* Flush the cache, update line count, before screen update. */
- if (lno >= ep->c_lno)
- ep->c_lno = OOBLNO;
+ ep->c_lno = OOBLNO;
if (ep->c_nlines != OOBLNO)
++ep->c_nlines;
@@ -459,8 +456,7 @@
}
/* Flush the cache, before logging or screen update. */
- if (lno == ep->c_lno)
- ep->c_lno = OOBLNO;
+ ep->c_lno = OOBLNO;
/* File now dirty. */
if (F_ISSET(ep, F_FIRSTMODIFY))

25
testing/nvi/08lfs.patch Normal file
View File

@ -0,0 +1,25 @@
From: <hesso@pool.math.tu-berlin.de>
Subject: Insert a safety check to save large files from being overwritten.
diff -Naur nvi-1.81.6.orig/common/exf.c nvi-1.81.6/common/exf.c
--- nvi-1.81.6.orig/common/exf.c 2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/common/exf.c 2008-05-01 18:09:55.000000000 +0200
@@ -157,6 +157,18 @@
*/
if (file_spath(sp, frp, &sb, &exists))
return (1);
+ /*
+ * On LFS systems, it's possible that stat returned an error because
+ * the file is >2GB, which nvi would normally treat as "doesn't exist"
+ * and eventually overwrite. That's no good. Rather than mess with
+ * every stat() call in file_spath, we'll just check again here.
+ */
+ if (!exists && stat(frp->name, &sb)) {
+ if (errno == EOVERFLOW) {
+ msgq(sp, M_ERR, "File too large (>2GB, probably)");
+ goto err;
+ }
+ }
/*
* Check whether we already have this file opened in some

View File

@ -0,0 +1,15 @@
From: <hesso@pool.math.tu-berlin.de>
Subject: No description.
diff -Naur nvi-1.81.6.orig/common/exf.c nvi-1.81.6/common/exf.c
--- nvi-1.81.6.orig/common/exf.c 2008-05-01 18:10:20.000000000 +0200
+++ nvi-1.81.6/common/exf.c 2008-05-01 18:10:30.000000000 +0200
@@ -1075,7 +1075,7 @@
*--s = '.';
}
}
- msgq(sp, M_INFO, s);
+ msgq(sp, M_INFO, "%s", s);
if (nf)
FREE_SPACE(sp, p, 0);
return (0);

View File

@ -0,0 +1,28 @@
From: <hesso@pool.math.tu-berlin.de>
Subject: No description.
diff -Naur nvi-1.81.6.orig/common/exf.c nvi-1.81.6/common/exf.c
--- nvi-1.81.6.orig/common/exf.c 2008-05-01 18:10:45.000000000 +0200
+++ nvi-1.81.6/common/exf.c 2008-05-01 18:13:23.000000000 +0200
@@ -207,16 +207,21 @@
*/
oname = frp->name;
if (LF_ISSET(FS_OPENERR) || oname == NULL || !exists) {
+ mode_t orig_umask;
if (opts_empty(sp, O_TMP_DIRECTORY, 0))
goto err;
+ orig_umask = umask(0);
+ umask(orig_umask & 0177);
(void)snprintf(tname, sizeof(tname),
"%s/vi.XXXXXX", O_STR(sp, O_TMP_DIRECTORY));
if ((fd = mkstemp(tname)) == -1) {
+ umask(orig_umask);
msgq(sp, M_SYSERR,
"237|Unable to create temporary file");
goto err;
}
(void)close(fd);
+ umask(orig_umask);
if (frp->name == NULL)
F_SET(frp, FR_TMPFILE);

View File

@ -0,0 +1,24 @@
From: <hesso@pool.math.tu-berlin.de>
Subject: No description.
diff -Naur nvi-1.81.6.orig/vi/v_ch.c nvi-1.81.6/vi/v_ch.c
--- nvi-1.81.6.orig/vi/v_ch.c 2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/vi/v_ch.c 2008-05-01 18:14:03.000000000 +0200
@@ -165,7 +165,7 @@
endp = (startp = p) + len;
p += vp->m_start.cno;
for (cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; cnt--;) {
- while (++p < endp && *p != key);
+ while (++p < endp && *p != (char) key);
if (p == endp) {
notfound(sp, key);
return (1);
@@ -247,7 +247,7 @@
endp = p - 1;
p += vp->m_start.cno;
for (cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; cnt--;) {
- while (--p > endp && *p != key);
+ while (--p > endp && *p != (char) key);
if (p == endp) {
notfound(sp, key);
return (1);

View File

@ -0,0 +1,21 @@
From: <hesso@pool.math.tu-berlin.de>
Subject: Catch segfaults when the screen is only one line high.
diff -Naur nvi-1.81.6.orig/vi/vi.c nvi-1.81.6/vi/vi.c
--- nvi-1.81.6.orig/vi/vi.c 2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/vi/vi.c 2008-05-01 18:15:14.000000000 +0200
@@ -974,6 +974,14 @@
sp->rows = vip->srows = O_VAL(sp, O_LINES);
sp->cols = O_VAL(sp, O_COLUMNS);
sp->t_rows = sp->t_minrows = O_VAL(sp, O_WINDOW);
+ /*
+ * To avoid segfaults on terminals with only one line,
+ * catch this corner case now and die explicitly.
+ */
+ if (sp->t_rows == 0) {
+ (void)fprintf(stderr, "Error: Screen too small for visual mode.\n");
+ return 1;
+ }
if (sp->rows != 1) {
if (sp->t_rows > sp->rows - 1) {
sp->t_minrows = sp->t_rows = sp->rows - 1;

View File

@ -0,0 +1,15 @@
From: <hesso@pool.math.tu-berlin.de>
Subject: No description.
diff -Naur nvi-1.81.6.orig/vi/v_sentence.c nvi-1.81.6/vi/v_sentence.c
--- nvi-1.81.6.orig/vi/v_sentence.c 2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/vi/v_sentence.c 2008-05-01 18:15:37.000000000 +0200
@@ -291,7 +291,7 @@
* we can end up where we started. Fix it.
*/
if (vp->m_start.lno != cs.cs_lno ||
- vp->m_start.cno != cs.cs_cno)
+ vp->m_start.cno > cs.cs_cno)
goto okret;
/*

View File

@ -0,0 +1,15 @@
From: <hesso@pool.math.tu-berlin.de>
Subject: No description.
diff -Naur nvi-1.81.6.orig/vi/vs_refresh.c nvi-1.81.6/vi/vs_refresh.c
--- nvi-1.81.6.orig/vi/vs_refresh.c 2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/vi/vs_refresh.c 2008-05-01 18:16:01.000000000 +0200
@@ -569,7 +569,7 @@
* for the number option offset.
*/
cnt = vs_columns(sp, NULL, LNO, &CNO, NULL);
- if (O_ISSET(sp, O_NUMBER))
+ if (O_ISSET(sp, O_NUMBER) && cnt)
cnt -= O_NUMBER_LENGTH;
/* Adjust the window towards the beginning of the line. */

View File

@ -0,0 +1,64 @@
From: <hesso@pool.math.tu-berlin.de>
Subject: This patch tries to cope with the fact that widechar support
in nvi is at best rudimentary.
Hunk 1)
* Due to "ch = *t", this code is not wide-char aware, so
cast the value to a proper type so the KEY_ macros make
the right choice.
Hunk 2)
* Printing of the in-/decreased number back into the screen
buffer is not widechar-aware, either. Add a dirty fix.
Cf. #497349.
--- nvi-1.81.6.orig/vi/vs_msg.c 2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/vi/vs_msg.c 2009-03-01 14:51:08.211414132 +0100
@@ -472,10 +472,10 @@
*/
if (ch == '\t')
ch = ' ';
- chlen = KEY_LEN(sp, ch);
+ chlen = KEY_LEN(sp, (unsigned char)ch);
if (cbp + chlen >= ecbp)
FLUSH;
- for (kp = KEY_NAME(sp, ch); chlen--;)
+ for (kp = KEY_NAME(sp, (unsigned char)ch); chlen--;)
*cbp++ = *kp++;
}
if (cbp > cbuf)
--- nvi-1.81.6.orig/vi/v_increment.c 2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/vi/v_increment.c 2009-03-01 15:12:50.950415874 +0100
@@ -57,7 +57,7 @@
long change, ltmp, lval;
size_t beg, blen, end, len, nlen, wlen;
int base, isempty, rval;
- char *ntype, nbuf[100];
+ char *ntype, nbuf[100 * sizeof(CHAR_T)];
CHAR_T *bp, *p, *t;
/* Validate the operator. */
@@ -202,7 +202,7 @@
/* If we cross 0, signed numbers lose their sign. */
if (lval == 0 && ntype == fmt[SDEC])
ntype = fmt[DEC];
- nlen = snprintf(nbuf, sizeof(nbuf), ntype, lval);
+ nlen = snprintf(nbuf, sizeof(nbuf)/sizeof(CHAR_T), ntype, lval);
} else {
if ((nret = nget_uslong(sp, &ulval, t, NULL, base)) != NUM_OK)
goto err;
@@ -224,7 +224,15 @@
if (base == 16)
wlen -= 2;
- nlen = snprintf(nbuf, sizeof(nbuf), ntype, wlen, ulval);
+ nlen = snprintf(nbuf, sizeof(nbuf)/sizeof(CHAR_T), ntype, wlen, ulval);
+ }
+
+ /* Inflate the printed char buffer to CHAR_T elements if necessary */
+ if (sizeof(CHAR_T) > sizeof(char)) {
+ int nlen_inflate;
+ for (nlen_inflate = nlen; nlen_inflate >= 0; nlen_inflate--) {
+ ((CHAR_T *)nbuf)[nlen_inflate] = nbuf[nlen_inflate];
+ }
}
/* Build the new line. */

View File

@ -0,0 +1,28 @@
From: <hesso@pool.math.tu-berlin.de>
Subject: Fixes to the private regex library; includes fix for #523934.
diff -Naur regex.orig/regcomp.c regex/regcomp.c
--- nvi-1.81.6.orig/regex/regcomp.c 2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/regex/regcomp.c 2008-05-01 18:37:57.000000000 +0200
@@ -606,7 +606,8 @@
REQUIRE(starordinary, REG_BADRPT);
/* FALLTHROUGH */
default:
- ordinary(p, c &~ BACKSL);
+ /* ordinary(p, c &~ BACKSL); -- Fix potential overflow */
+ ordinary(p, c & 0xff);
break;
}
diff -Naur regex.orig/regexec.c regex/regexec.c
--- nvi-1.81.6.orig/regex/regexec.c 2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/regex/regexec.c 2008-05-01 18:38:00.000000000 +0200
@@ -63,7 +63,7 @@
/* macros for manipulating states, small version */
#define states int
-#define states1 states /* for later use in regexec() decision */
+typedef states states1; /* for later use in regexec() decision */
#define CLEAR(v) ((v) = 0)
#define SET0(v, n) ((v) &= ~(1 << (n)))
#define SET1(v, n) ((v) |= 1 << (n))

View File

@ -0,0 +1,26 @@
From: Al Viro <viro@ZenIV.linux.org.uk>
Subject: Fix {^A} command. (End-of-word was not included in search
regexp leading to false positives.)
--- nvi-1.81.6.orig/vi/v_search.c 2007-11-18 11:41:42.000000000 -0500
+++ nvi-1.81.6/vi/v_search.c 2009-03-05 15:37:37.000000000 -0500
@@ -322,15 +322,16 @@
v_searchw(SCR *sp, VICMD *vp)
{
size_t blen, len;
+ size_t olen = STRLEN(VIP(sp)->keyw);
int rval;
CHAR_T *bp, *p;
- len = VIP(sp)->klen + RE_WSTART_LEN + RE_WSTOP_LEN;
+ len = olen + RE_WSTART_LEN + RE_WSTOP_LEN;
GET_SPACE_RETW(sp, bp, blen, len);
MEMCPY(bp, RE_WSTART, RE_WSTART_LEN);
p = bp + RE_WSTART_LEN;
- MEMCPY(p, VIP(sp)->keyw, VIP(sp)->klen);
- p += VIP(sp)->klen;
+ MEMCPY(p, VIP(sp)->keyw, olen);
+ p += olen;
MEMCPY(p, RE_WSTOP, RE_WSTOP_LEN);
rval = v_search(sp, vp, bp, len, SEARCH_SET, FORWARD);

View File

@ -0,0 +1,767 @@
From: <hesso@pool.math.tu-berlin.de>
Subject: Fix a truckload of roff markup glitches.
diff -Naur nvi-1.81.6.orig/docs/vi.man/vi.1 nvi-1.81.6/docs/vi.man/vi.1
--- nvi-1.81.6.orig/docs/vi.man/vi.1 2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/docs/vi.man/vi.1 2008-05-01 18:17:59.000000000 +0200
@@ -17,35 +17,35 @@
.SH SYNOPSIS
.B ex
[\c
-.B -eFRrSsv\c
+.B \-eFRrSsv\c
] [\c
-.BI -c " cmd"\c
+.BI \-c " cmd"\c
] [\c
-.BI -t " tag"\c
+.BI \-t " tag"\c
] [\c
-.BI -w " size"\c
+.BI \-w " size"\c
] [file ...]
.br
.B vi
[\c
-.B -eFlRrSv\c
+.B \-eFlRrSv\c
] [\c
-.BI -c " cmd"\c
+.BI \-c " cmd"\c
] [\c
-.BI -t " tag"\c
+.BI \-t " tag"\c
] [\c
-.BI -w " size"\c
+.BI \-w " size"\c
] [file ...]
.br
.B view
[\c
-.B -eFRrSv\c
+.B \-eFRrSv\c
] [\c
-.BI -c " cmd"\c
+.BI \-c " cmd"\c
] [\c
-.BI -t " tag"\c
+.BI \-t " tag"\c
] [\c
-.BI -w " size"\c
+.BI \-w " size"\c
] [file ...]
.SH LICENSE
The vi program is freely redistributable. You are welcome to copy,
@@ -57,7 +57,7 @@
.I \&Vi
is a screen oriented text editor.
.I \&Ex
-is a line-oriented text editor.
+is a line\(hyoriented text editor.
.I \&Ex
and
.I \&vi
@@ -66,7 +66,7 @@
.I View
is the equivalent of using the
.B \-R
-(read-only) option of
+(read\(hyonly) option of
.IR \&vi .
.PP
This manual page is the one provided with the
@@ -75,7 +75,7 @@
.I ex/vi
text editors.
.I Nex/nvi
-are intended as bug-for-bug compatible replacements for the original
+are intended as bug\(hyfor\(hybug compatible replacements for the original
Fourth Berkeley Software Distribution (4BSD)
.I \&ex
and
@@ -93,7 +93,7 @@
editor before this manual page.
If you're in an unfamiliar environment, and you absolutely have to
get work done immediately, read the section after the options
-description, entitled ``Fast Startup''.
+description, entitled \(lqFast Startup\(rq.
It's probably enough to get you going.
.PP
The following options are available:
@@ -105,7 +105,7 @@
Particularly useful for initial positioning in the file, however
.B cmd
is not limited to positioning commands.
-This is the POSIX 1003.2 interface for the historic ``+cmd'' syntax.
+This is the POSIX 1003.2 interface for the historic \(lq+cmd\(rq syntax.
.I Nex/nvi
supports both the old and new syntax.
.TP
@@ -122,7 +122,7 @@
Start editing with the lisp and showmatch options set.
.TP
.B \-R
-Start editing in read-only mode, as if the command name was
+Start editing in read\(hyonly mode, as if the command name was
.IR view ,
or the
.B readonly
@@ -151,7 +151,7 @@
Prompts, informative messages and other user oriented message
are turned off,
and no startup files or environmental variables are read.
-This is the POSIX 1003.2 interface for the historic ``\-'' argument.
+This is the POSIX 1003.2 interface for the historic \(lq\-\(rq argument.
.I \&Nex/nvi
supports both the old and new syntax.
.TP
@@ -215,8 +215,8 @@
There are commands that switch you into input mode.
There is only one key that takes you out of input mode,
and that is the <escape> key.
-(Key names are written using less-than and greater-than signs, e.g.
-<escape> means the ``escape'' key, usually labeled ``esc'' on your
+(Key names are written using less\(hythan and greater\(hythan signs, e.g.
+<escape> means the \(lqescape\(rq key, usually labeled \(lqesc\(rq on your
terminal's keyboard.)
If you're ever confused as to which mode you're in,
keep entering the <escape> key until
@@ -227,9 +227,9 @@
will beep at you if you try and do something that's not allowed.
It will also display error messages.)
.PP
-To start editing a file, enter the command ``vi file_name<carriage-return>''.
+To start editing a file, enter the command \(lqvi file_name<carriage\(hyreturn>\(rq.
The command you should enter as soon as you start editing is
-``:set verbose showmode<carriage-return>''.
+\(lq:set verbose showmode<carriage\(hyreturn>\(rq.
This will make the editor give you verbose error messages and display
the current mode at the bottom of the screen.
.PP
@@ -247,11 +247,11 @@
.B l
Move the cursor right one character.
.TP
-.B <cursor-arrows>
+.B <cursor\(hyarrows>
The cursor arrow keys should work, too.
.TP
-.B /text<carriage-return>
-Search for the string ``text'' in the file,
+.B /text<carriage\(hyreturn>
+Search for the string \(lqtext\(rq in the file,
and move the cursor to its first character.
.PP
The commands to enter new text are:
@@ -303,30 +303,30 @@
.PP
The commands to write the file are:
.TP
-.B :w<carriage-return>
+.B :w<carriage\(hyreturn>
Write the file back to the file with the name that you originally used
as an argument on the
.I \&vi
command line.
.TP
-.B ":w file_name<carriage-return>"
-Write the file back to the file with the name ``file_name''.
+.B ":w file_name<carriage\(hyreturn>"
+Write the file back to the file with the name \(lqfile_name\(rq.
.PP
The commands to quit editing and exit the editor are:
.TP
-.B :q<carriage-return>
+.B :q<carriage\(hyreturn>
Quit editing and leave vi (if you've modified the file, but not
saved your changes,
.I \&vi
will refuse to quit).
.TP
-.B :q!<carriage-return>
+.B :q!<carriage\(hyreturn>
Quit, discarding any modifications that you may have made.
.PP
One final caution.
Unusual characters can take up more than one column on the screen,
and long lines can take up more than a single screen line.
-The above commands work on ``physical'' characters and lines,
+The above commands work on \(lqphysical\(rq characters and lines,
i.e. they affect the entire line no matter how many screen lines it
takes up and the entire character no matter how many screen columns
it takes up.
@@ -339,87 +339,87 @@
character.
.PP
.TP
-.B "[count] <control-A>"
+.B "[count] <control\(hyA>"
Search forward
.I count
times for the current word.
.TP
-.B "[count] <control-B>"
+.B "[count] <control\(hyB>"
Page backwards
.I count
screens.
.TP
-.B "[count] <control-D>"
+.B "[count] <control\(hyD>"
Scroll forward
.I count
lines.
.TP
-.B "[count] <control-E>"
+.B "[count] <control\(hyE>"
Scroll forward
.I count
lines, leaving the current line and column as is, if possible.
.TP
-.B "[count] <control-F>"
+.B "[count] <control\(hyF>"
Page forward
.I count
screens.
.TP
-.B "<control-G>"
+.B "<control\(hyG>"
Display the file information.
.TP
-.B "<control-H>"
+.B "<control\(hyH>"
.TP
.B "[count] h"
Move the cursor back
.I count
characters in the current line.
.TP
-.B "[count] <control-J>"
+.B "[count] <control\(hyJ>"
.TP
-.B "[count] <control-N>"
+.B "[count] <control\(hyN>"
.TP
.B "[count] j"
Move the cursor down
.I count
lines without changing the current column.
.TP
-.B "<control-L>"
+.B "<control\(hyL>"
.TP
-.B "<control-R>"
+.B "<control\(hyR>"
Repaint the screen.
.TP
-.B "[count] <control-M>"
+.B "[count] <control\(hyM>"
.TP
.B "[count] +"
Move the cursor down
.I count
lines to the first nonblank character of that line.
.TP
-.B "[count] <control-P>"
+.B "[count] <control\(hyP>"
.TP
.B "[count] k"
Move the cursor up
.I count
lines, without changing the current column.
.TP
-.B "<control-T>"
+.B "<control\(hyT>"
Return to the most recent tag context.
.TP
-.B "<control-U>"
+.B "<control\(hyU>"
Scroll backwards
.I count
lines.
.TP
-.B "<control-W>"
+.B "<control\(hyW>"
Switch to the next lower screen in the window, or, to the first
screen if there are no lower screens in the window.
.TP
-.B "<control-Y>"
+.B "<control\(hyY>"
Scroll backwards
.I count
lines, leaving the current line and column as is, if possible.
.TP
-.B "<control-Z>"
+.B "<control\(hyZ>"
Suspend the current editor session.
.TP
.B "<escape>"
@@ -427,10 +427,10 @@
.I \&ex
commands or cancel partial commands.
.TP
-.B "<control-]>"
+.B "<control\(hy]>"
Push a tag reference onto the tag stack.
.TP
-.B "<control-^>"
+.B "<control\(hy^>"
Switch to the most recently edited file.
.TP
.B "[count] <space>"
@@ -440,10 +440,10 @@
.I count
characters without changing the current line.
.TP
-.B "[count] ! motion shell-argument(s)"
+.B "[count] ! motion shell\(hyargument(s)"
Replace text with results from a shell command.
.TP
-.B "[count] # #|+|-"
+.B "[count] # #|+|\-"
Increment or decrement the cursor number.
.TP
.B "[count] $"
@@ -457,7 +457,7 @@
.TP
.B "'<character>"
.TP
-.B "`<character>"
+.B "\`<character>"
Return to a context marked by the character
.IR <character> .
.TP
@@ -476,7 +476,7 @@
.I count
times.
.TP
-.B "[count] -"
+.B "[count] \-"
Move to first nonblank of the previous line,
.I count
times.
@@ -486,13 +486,13 @@
.I \&vi
command that modified text.
.TP
-.B "/RE<carriage-return>"
+.B "/RE<carriage\(hyreturn>"
.TP
-.B "/RE/ [offset]<carriage-return>"
+.B "/RE/ [offset]<carriage\(hyreturn>"
.TP
-.B "?RE<carriage-return>"
+.B "?RE<carriage\(hyreturn>"
.TP
-.B "?RE? [offset]<carriage-return>"
+.B "?RE? [offset]<carriage\(hyreturn>"
.TP
.B "N"
.TP
@@ -527,15 +527,15 @@
bigwords.
.TP
.B "[buffer] [count] C"
-Change text from the current position to the end-of-line.
+Change text from the current position to the end\(hyof\(hyline.
.TP
.B "[buffer] D"
-Delete text from the current position to the end-of-line.
+Delete text from the current position to the end\(hyof\(hyline.
.TP
.B "[count] E"
Move forward
.I count
-end-of-bigwords.
+end\(hyof\(hybigwords.
.TP
.B "[count] F <character>"
Search
@@ -552,7 +552,7 @@
.TP
.B "[count] H"
Move to the screen line
-.I "count - 1"
+.I "count \- 1"
lines below the top of the screen.
.TP
.B "[count] I"
@@ -563,7 +563,7 @@
.TP
.B "[count] L"
Move to the screen line
-.I "count - 1"
+.I "count \- 1"
lines above the bottom of the screen.
.TP
.B " M"
@@ -614,7 +614,7 @@
characters before the cursor.
.TP
.B "[buffer] [count] Y"
-Copy (or ``yank'')
+Copy (or \(lqyank\(rq)
.I count
lines into the specified buffer.
.TP
@@ -637,7 +637,7 @@
.TP
.B "[count] _"
Move down
-.I "count - 1"
+.I "count \- 1"
lines, to the first nonblank character.
.TP
.B "[count] a"
@@ -657,7 +657,7 @@
.B "[count] e"
Move forward
.I count
-end-of-words.
+end\(hyof\(hywords.
.TP
.B "[count] f<character>"
Search forward,
@@ -709,12 +709,12 @@
characters.
.TP
.B "[buffer] [count] y motion"
-Copy (or ``yank'')
+Copy (or \(lqyank\(rq)
a text region specified by the
.I count
and motion into a buffer.
.TP
-.B "[count1] z [count2] -|.|+|^|<carriage-return>"
+.B "[count1] z [count2] \-|.|+|^|<carriage\(hyreturn>"
Redraw, optionally repositioning and resizing the screen.
.TP
.B "[count] {"
@@ -735,13 +735,20 @@
.B "[count] ~"
Reverse the case of the next
.I count
-character(s).
+character(s), if the
+.B tildeop
+option is
+.IR unset .
.TP
.B "[count] ~ motion"
Reverse the case of the characters in a text region specified by the
.I count
and
-.IR motion .
+.IR motion ,
+if the
+.B tildeop
+option is
+.IR set .
.TP
.B "<interrupt>"
Interrupt the current operation.
@@ -755,18 +762,18 @@
.B "<nul>"
Replay the previous input.
.TP
-.B "<control-D>"
+.B "<control\(hyD>"
Erase to the previous
.B shiftwidth
column boundary.
.TP
-.B "^<control-D>"
+.B "^<control\(hyD>"
Erase all of the autoindent characters, and reset the autoindent level.
.TP
-.B "0<control-D>"
+.B "0<control\(hyD>"
Erase all of the autoindent characters.
.TP
-.B "<control-T>"
+.B "<control\(hyT>"
Insert sufficient
.I <tab>
and
@@ -777,7 +784,7 @@
.TP
.B "<erase>
.TP
-.B "<control-H>"
+.B "<control\(hyH>"
Erase the last character.
.TP
.B "<literal next>"
@@ -789,7 +796,7 @@
.B "<line erase>"
Erase the current line.
.TP
-.B "<control-W>"
+.B "<control\(hyW>"
.TP
.B "<word erase>"
Erase the last word.
@@ -799,7 +806,7 @@
.B ttywerase
options.
.TP
-.B "<control-X>[0-9A-Fa-f]+"
+.B "<control\(hyX>[0\-9A\-Fa\-f]+"
Insert a character with the specified hexadecimal value into the text.
.TP
.B "<interrupt>"
@@ -811,7 +818,7 @@
In each entry below, the tag line is a usage synopsis for the command.
.PP
.TP
-.B "<end-of-file>"
+.B "<end\(hyof\(hyfile>"
Scroll the screen.
.TP
.B "! argument(s)"
@@ -932,7 +939,7 @@
.I file
if it was previously saved.
.TP
-.B "res[ize] [+|-]size"
+.B "res[ize] [+|\-]size"
.I \&Vi
mode only.
Grow or shrink the current screen.
@@ -1034,7 +1041,10 @@
.I \&ex
and
.I \&vi
-modes, unless otherwise specified.
+modes, unless otherwise specified. Multiple options can be given in
+one set or unset, separated by spaces or tabs. Spaces and tabs can be
+included in string options (eg. tags or filec) by preceding each with
+a backslash. There's no way to get backslash itself into an option.
.PP
.TP
.B "altwerase [off]"
@@ -1071,7 +1081,7 @@
command.
.TP
.B "cedit [no default]"
-Set the character to edit the colon command-line history.
+Set the character to edit the colon command\(hyline history.
.TP
.B "columns, co [80]"
Set the number of columns in the screen.
@@ -1085,7 +1095,7 @@
The directory where temporary files are created.
.TP
.B "edcompatible, ed [off]"
-Remember the values of the ``c'' and ``g'' suffices to the
+Remember the values of the \(lqc\(rq and \(lqg\(rq suffices to the
.B substitute
commands, instead of initializing them as unset for each new
command.
@@ -1114,8 +1124,8 @@
Set the spacing between hardware tab settings.
.TP
.B "iclower [off]"
-Makes all Regular Expressions case-insensitive,
-as long as an upper-case letter does not appear in the search string.
+Makes all Regular Expressions case\(hyinsensitive,
+as long as an upper\(hycase letter does not appear in the search string.
.TP
.B "ignorecase, ic [off]"
Ignore case differences in regular expressions.
@@ -1128,7 +1138,7 @@
.B "leftright [off]"
.I \&Vi
only.
-Do left-right scrolling.
+Do left\(hyright scrolling.
.TP
.B "lines, li [24]"
.I \&Vi
@@ -1227,7 +1237,7 @@
Display a command prompt.
.TP
.B "readonly, ro [off]"
-Mark the file and session as read-only.
+Mark the file and session as read\(hyonly.
.TP
.B "recdir [/var/tmp/vi.recover]"
The directory where recovery files are stored.
@@ -1278,7 +1288,7 @@
.\" to save my life. The ONLY way I've been able to get this to work
.\" is with the .tr command.
.tr Q"
-.ds ms shellmeta [~{[*?$`'Q\e]
+.ds ms shellmeta [~{[*?$\`'Q\e]
.TP
.B "\*(ms"
.tr QQ
@@ -1291,17 +1301,17 @@
.B "showmatch, sm [off]"
.I \&Vi
only.
-Note matching ``{'' and ``('' for ``}'' and ``)'' characters.
+Note matching \(lq{\(rq and \(lq(\(rq for \(lq}\(rq and \(lq)\(rq characters.
.TP
.B "showmode, smd [off]"
.I \&Vi
only.
-Display the current editor mode and a ``modified'' flag.
+Display the current editor mode and a \(lqmodified\(rq flag.
.TP
.B "sidescroll [16]"
.I \&Vi
only.
-Set the amount a left-right scroll will shift.
+Set the amount a left\(hyright scroll will shift.
.TP
.B "slowopen, slow [off]"
Delay display updating during text input.
@@ -1379,7 +1389,7 @@
.I \&Vi
only.
Break lines automatically, the specified number of columns from the
-left-hand margin.
+left\(hyhand margin.
If both the
.B wraplen
and
@@ -1392,7 +1402,7 @@
.I \&Vi
only.
Break lines automatically, the specified number of columns from the
-right-hand margin.
+right\(hyhand margin.
If both the
.B wraplen
and
@@ -1405,7 +1415,7 @@
Set searches to wrap around the end or beginning of the file.
.TP
.B "writeany, wa [off]"
-Turn off file-overwriting checks.
+Turn off file\(hyoverwriting checks.
.SH "ENVIRONMENT VARIABLES
.TP
.I COLUMNS
@@ -1430,7 +1440,7 @@
.TP
.I HOME
The user's home directory, used as the initial directory path
-for the startup ``$\fIHOME\fP/.nexrc'' and ``$\fIHOME\fP/.exrc''
+for the startup \(lq$\fIHOME\fP/.nexrc\(rq and \(lq$\fIHOME\fP/.exrc\(rq
files.
This value is also used as the default directory for the
.I \&vi
@@ -1462,7 +1472,7 @@
.TP
.I TERM
The user's terminal type.
-The default is the type ``unknown''.
+The default is the type \(lqunknown\(rq.
If the
.I TERM
environmental variable is not set when
@@ -1482,7 +1492,7 @@
SIGALRM
.I \&Vi/ex
uses this signal for periodic backups of file modifications and to
-display ``busy'' messages when operations are likely to take a long time.
+display \(lqbusy\(rq messages when operations are likely to take a long time.
.TP
SIGHUP
.TP
@@ -1492,7 +1502,7 @@
be later recovered.
See the
.I \&vi/ex
-Reference manual section entitled ``Recovery'' for more information.
+Reference manual section entitled \(lqRecovery\(rq for more information.
.TP
SIGINT
When an interrupt occurs,
@@ -1506,7 +1516,7 @@
The screen is resized.
See the
.I \&vi/ex
-Reference manual section entitled ``Sizing the Screen'' for more information.
+Reference manual section entitled \(lqSizing the Screen\(rq for more information.
.TP
SIGCONT
.TP
@@ -1521,7 +1531,7 @@
The default user shell.
.TP
/etc/vi.exrc
-System-wide vi startup file.
+System\(hywide vi startup file.
.TP
/tmp
Temporary file directory.
@@ -1546,38 +1556,38 @@
.IR curses (3),
.IR dbopen (3)
.sp
-The ``Vi Quick Reference'' card.
+The \(lqVi Quick Reference\(rq card.
.sp
-``An Introduction to Display Editing with Vi'', found in the
-``UNIX User's Manual Supplementary Documents''
+\(lqAn Introduction to Display Editing with Vi\(rq, found in the
+\(lqUNIX User's Manual Supplementary Documents\(rq
section of both the 4.3BSD and 4.4BSD manual sets.
This document is the closest thing available to an introduction to the
.I \&vi
screen editor.
.sp
-``Ex Reference Manual (Version 3.7)'',
+\(lqEx Reference Manual (Version 3.7)\(rq,
found in the
-``UNIX User's Manual Supplementary Documents''
+\(lqUNIX User's Manual Supplementary Documents\(rq
section of both the 4.3BSD and 4.4BSD manual sets.
This document is the final reference for the
.I \&ex
editor, as distributed in most historic 4BSD and System V systems.
.sp
-``Edit: A tutorial'',
+\(lqEdit: A tutorial\(rq,
found in the
-``UNIX User's Manual Supplementary Documents''
+\(lqUNIX User's Manual Supplementary Documents\(rq
section of the 4.3BSD manual set.
This document is an introduction to a simple version of the
.I \&ex
screen editor.
.sp
-``Ex/Vi Reference Manual'',
+\(lqEx/Vi Reference Manual\(rq,
found in the
-``UNIX User's Manual Supplementary Documents''
+\(lqUNIX User's Manual Supplementary Documents\(rq
section of the 4.4BSD manual set.
This document is the final reference for the
.I \&nex/nvi
-text editors, as distributed in 4.4BSD and 4.4BSD-Lite.
+text editors, as distributed in 4.4BSD and 4.4BSD\(hyLite.
.PP
.I Roff
source for all of these documents is distributed with
@@ -1588,7 +1598,7 @@
.I nex/nvi
source code.
.sp
-The files ``autowrite'', ``input'', ``quoting'' and ``structures''
+The files \(lqautowrite\(rq, \(lqinput\(rq, \(lqquoting\(rq and \(lqstructures\(rq
found in the
.I nvi/docs/internals
directory of the
@@ -1602,7 +1612,7 @@
editor first appeared in 4.4BSD.
.SH STANDARDS
.I \&Nex/nvi
-is close to IEEE Std1003.2 (``POSIX'').
+is close to IEEE Std1003.2 (\(lqPOSIX\(rq).
That document differs from historical
.I ex/vi
practice in several places; there are changes to be made on both sides.

View File

@ -0,0 +1,60 @@
From: Unknown
Subject: Fix typos in the nvi tutorial.
--- nvi-1.81.6.orig/nvi-1.79/docs/tutorial/vi.beginner
+++ nvi-1.81.6/nvi-1.79/docs/tutorial/vi.beginner
@@ -505,7 +505,7 @@
j - moves the cursor DOWN one line
h - moves the cursor one character to the LEFT
-Section 22: {i} {a} {I} {A} {o} {O} ^[ (escape key)
+Section 22: {i} {a} {I} {A} {o} {O} {^[} (escape key)
For this and following sections you will need to use the ESCAPE key on your
terminal. It is usually marked ESC. Since the escape key is the same as
@@ -525,9 +525,9 @@
on the word 'of'.)
Now carefully type the following string and observe the effects:
- {iexample ^[} (remember: ^[ is the escape key)}
+ {iexample ^[} (remember: ^[ is the escape key)
The {i} begins the insert mode, and 'example ' is inserted into the line:
-be sure to notice the blank in 'example '. The ^[ ends insertion mode,
+be sure to notice the blank in 'example '. The {^[} ends insertion mode,
and the line is updated to include the new string. Line 1 should look exactly
like Line 2.
@@ -541,9 +541,9 @@
of 'line'. You can do this in several ways, one way is the following:
First, type {/line /^M}. This puts us on the word 'line' in Line 4
(the blank in the search string is important!). Next, type {e}. The 'e' puts
-us at the end of the word. Now, type {as^[ (^[ is the escape character)}.
+us at the end of the word. Now, type {as^[} (^[ is the escape character).
The 'a' puts us in insert mode, AFTER the current character. We appended the
-'s', and the escape ^[ ended the insert mode.
+'s', and the escape '^[' ended the insert mode.
The difference between {i} (insert) and {a} (append) is that {i} begins
inserting text BEFORE the cursor, and {a} begins inserting AFTER the cursor.
--- nvi-1.81.6.orig/nvi-1.79/docs/tutorial/vi.advanced
+++ nvi-1.81.6/nvi-1.79/docs/tutorial/vi.advanced
@@ -26,8 +26,8 @@
1 introduction: {^F} {ZZ}
2 introduction (con't) and positioning: {^F} {^B}
3 introduction (con't) and positioning: {^F} {^B}
- 4 positioning: {^F} {^B} ^M (return key)
- 5 quitting: {:q!} ^M key
+ 4 positioning: {^F} {^B} {^M} (return key)
+ 5 quitting: {:q!} {^M} (return key)
6 marking, cursor and screen positioning: {m} {G} {'} {z}
7 marking, cursor and screen positioning: {m} {G} {'} {z}
8 marking, cursor and screen positioning: {z} {m} {'}
@@ -44,7 +44,7 @@
19 screen positioning: {H} {M} {L}
20 character positioning: {w} {b} {0} {W} {B} {e} {E} {'} {`}
21 cursor positioning: {l} {k} {j} {h}
- 22 adding text: {i} {a} {I} {A} {o} {O} ^[ (escape key)
+ 22 adding text: {i} {a} {I} {A} {o} {O} {^[} (escape key)
23 character manipulation: {f} {x} {X} {w} {l} {r} {R} {s} {S} {J}
24 undo: {u} {U}
25 review

View File

@ -0,0 +1,22 @@
From: <hesso@pool.math.tu-berlin.de>
Subject: Make sure that the pagesize passed to db__set_pagesize() is
a power of two.
--- nvi-1.81.6.orig/common/exf.c 2009-03-09 01:48:01.695862889 +0100
+++ nvi-1.81.6/common/exf.c 2009-03-09 10:42:41.147866272 +0100
@@ -249,11 +249,10 @@
* (vi should have good locality) or smaller than 1K.
*/
psize = ((sb.st_size / 15) + 1023) / 1024;
- if (psize > 10)
- psize = 10;
- if (psize == 0)
- psize = 1;
- psize *= 1024;
+ if (psize >= 8) psize=8<<10;
+ else if (psize >= 4) psize=4<<10;
+ else if (psize >= 2) psize=2<<10;
+ else psize=1<<10;
F_SET(ep, F_DEVSET);
ep->mdev = sb.st_dev;

View File

@ -0,0 +1,25 @@
From: <hesso@pool.math.tu-berlin.de>
Subject: Add <term.h> to the include list to suppress a few warnings.
diff -Naur nvi-1.81.6.orig/cl/cl_funcs.c nvi-1.81.6/cl/cl_funcs.c
--- nvi-1.81.6.orig/cl/cl_funcs.c 2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/cl/cl_funcs.c 2008-05-01 18:23:08.000000000 +0200
@@ -18,6 +18,7 @@
#include <sys/time.h>
#include <bitstring.h>
+#include <term.h>
#include <ctype.h>
#include <signal.h>
#include <stdio.h>
diff -Naur nvi-1.81.6.orig/cl/cl_screen.c nvi-1.81.6/cl/cl_screen.c
--- nvi-1.81.6.orig/cl/cl_screen.c 2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/cl/cl_screen.c 2008-05-01 18:23:02.000000000 +0200
@@ -17,6 +17,7 @@
#include <sys/queue.h>
#include <bitstring.h>
+#include <term.h>
#include <errno.h>
#include <signal.h>
#include <stdio.h>

View File

@ -0,0 +1,58 @@
From: <hesso@pool.math.tu-berlin.de>
Subject: No description.
diff -Naur nvi-1.81.6.orig/ex/ex_init.c nvi-1.81.6/ex/ex_init.c
--- nvi-1.81.6.orig/ex/ex_init.c 2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/ex/ex_init.c 2008-05-01 18:24:45.000000000 +0200
@@ -26,6 +26,9 @@
#include <string.h>
#include <unistd.h>
+#include <pwd.h>
+#include <grp.h>
+
#include "../common/common.h"
#include "tag.h"
#include "pathnames.h"
@@ -346,6 +349,9 @@
int nf1, nf2;
char *a, *b, buf[MAXPATHLEN];
+ struct group *grp_p;
+ struct passwd *pwd_p;
+
/* Check for the file's existence. */
if (stat(path, sbp))
return (NOEXIST);
@@ -359,10 +365,30 @@
}
/* Check writeability. */
- if (sbp->st_mode & (S_IWGRP | S_IWOTH)) {
+ if (sbp->st_mode & S_IWOTH) {
etype = WRITER;
goto denied;
}
+ if (sbp->st_mode & S_IWGRP) {
+ /* on system error (getgrgid or getpwnam return NULL) set etype to WRITER
+ * and continue execution */
+ if( (grp_p = getgrgid(sbp->st_gid)) == NULL) {
+ etype = WRITER;
+ goto denied;
+ }
+
+ /* lookup the group members' uids for an uid different from euid */
+ while( ( *(grp_p->gr_mem) ) != NULL) { /* gr_mem is a null-terminated array */
+ if( (pwd_p = getpwnam(*(grp_p->gr_mem)++)) == NULL) {
+ etype = WRITER;
+ goto denied;
+ }
+ if(pwd_p->pw_uid != euid) {
+ etype = WRITER;
+ goto denied;
+ }
+ }
+ }
return (RCOK);
denied: a = msg_print(sp, path, &nf1);

View File

@ -0,0 +1,26 @@
From: <hesso@pool.math.tu-berlin.de>
Subject: If there's no $TERM around, just fall back to "dumb".
diff -Naur nvi-1.81.6.orig/cl/cl_main.c nvi-1.81.6/cl/cl_main.c
--- nvi-1.81.6.orig/cl/cl_main.c 2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/cl/cl_main.c 2008-05-01 18:29:13.000000000 +0200
@@ -96,6 +96,7 @@
if ((ttype = getenv("TERM")) == NULL)
ttype = "unknown";
term_init(gp->progname, ttype);
+ ttype = getenv("TERM");
/* Add the terminal type to the global structure. */
if ((OG_D_STR(gp, GO_TERM) =
@@ -233,6 +234,11 @@
/* Set up the terminal database information. */
setupterm(ttype, STDOUT_FILENO, &err);
+ if (err == 0) {
+ (void)fprintf(stderr, "%s: %s: unknown terminal type, falling back to 'dumb'\n", name, ttype);
+ setenv("TERM", "dumb", 1);
+ setupterm("dumb", STDOUT_FILENO, &err);
+ }
switch (err) {
case -1:
(void)fprintf(stderr,

View File

@ -0,0 +1,55 @@
From: <hesso@pool.math.tu-berlin.de>
Subject: Replace the manpage paragraph about the '-F' commandline option
with a notice that is has been dropped.
--- nvi-1.81.6+debian-1.orig/docs/vi.man/vi.1 2008-06-13 00:52:45.000000000 +0200
+++ nvi-1.81.6+debian-1/docs/vi.man/vi.1 2008-06-13 00:55:40.000000000 +0200
@@ -17,7 +17,7 @@
.SH SYNOPSIS
.B ex
[\c
-.B \-eFRrSsv\c
+.B \-eRrSsv\c
] [\c
.BI \-c " cmd"\c
] [\c
@@ -28,7 +28,7 @@
.br
.B vi
[\c
-.B \-eFlRrSv\c
+.B \-elRrSv\c
] [\c
.BI \-c " cmd"\c
] [\c
@@ -39,7 +39,7 @@
.br
.B view
[\c
-.B \-eFRrSv\c
+.B \-eRrSv\c
] [\c
.BI \-c " cmd"\c
] [\c
@@ -113,11 +113,6 @@
Start editing in ex mode, as if the command name were
.IR \&ex .
.TP
-.B \-F
-Don't copy the entire file when first starting to edit.
-(The default is to make a copy in case someone else modifies
-the file during your edit session.)
-.TP
.B \-l
Start editing with the lisp and showmatch options set.
.TP
@@ -169,6 +164,9 @@
or
.IR view .
.PP
+Note that the \fB-F\fP option (which prevented \fIex/vi\fP from making
+a full backup of the target file) has been removed and is no longer available.
+.PP
Command input for
.I ex/vi
is read from the standard input.

View File

@ -0,0 +1,15 @@
From: <hesso@pool.math.tu-berlin.de>
Subject: Prevent a segfault if a trailing tab is pushed to a new line by inserting
characters before it if 'set number' is in effect.
--- nvi-1.81.6+debian.orig/vi/vs_relative.c 2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6+debian/vi/vs_relative.c 2008-06-13 03:22:55.000000000 +0200
@@ -133,7 +133,7 @@
* Initialize the pointer into the buffer and current offset.
*/
p = lp;
- curoff = 0;
+ curoff = scno;
/* Macro to return the display length of any signal character. */
#define CHLEN(val) (ch = *(UCHAR_T *)p++) == '\t' && \

View File

@ -0,0 +1,27 @@
From: <hesso@pool.math.tu-berlin.de>
Subject: Allow users to edit 8-bit files even under LC_CTYPE=C.
--- nvi-1.81.6.orig/common/conv.c 2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/common/conv.c 2009-03-09 16:45:37.812022582 +0100
@@ -322,11 +322,16 @@
else {
setlocale(LC_ALL, "");
#ifdef USE_WIDECHAR
- sp->conv.sys2int = cs_char2int;
- sp->conv.int2sys = cs_int2char;
- sp->conv.file2int = fe_char2int;
- sp->conv.int2file = fe_int2char;
- sp->conv.input2int = ie_char2int;
+ if (!strcmp(LANGCODESET, "ANSI_X3.4-1968")) {
+ sp->conv.file2int = sp->conv.input2int = sp->conv.sys2int = raw2int;
+ sp->conv.int2sys = sp->conv.int2file = int2raw;
+ } else {
+ sp->conv.sys2int = cs_char2int;
+ sp->conv.int2sys = cs_int2char;
+ sp->conv.file2int = fe_char2int;
+ sp->conv.int2file = fe_int2char;
+ sp->conv.input2int = ie_char2int;
+ }
#endif
#ifdef USE_ICONV
o_set(sp, O_FILEENCODING, OS_STRDUP, nl_langinfo(CODESET), 0);

View File

@ -0,0 +1,32 @@
From: <hesso@pool.math.tu-berlin.de>
Subject: Save the intermediate CHAR2INT conversion pointer because
that pointer is reused by later conversions in calls below.
--- nvi-1.81.6.orig/common/exf.c 2009-07-24 11:30:05.962060755 +0200
+++ nvi-1.81.6/common/exf.c 2009-07-24 12:09:57.511311177 +0200
@@ -1092,8 +1092,8 @@
size_t blen;
int flags, maxnum, nr, num, nw, rfd, wfd, version;
char *bp, *estr, *p, *pct, *slash, *t, *wfname, buf[8192];
- CHAR_T *wp;
- size_t wlen;
+ CHAR_T *wp, *wp2;
+ size_t wlen, wlen2;
size_t nlen;
char *d = NULL;
@@ -1148,8 +1148,13 @@
} else
version = 0;
CHAR2INT(sp, bname, strlen(bname) + 1, wp, wlen);
- if (argv_exp2(sp, &cmd, wp, wlen - 1))
+ GET_SPACE_RETW(sp, wp2, wlen2, wlen);
+ MEMCPY(wp2, wp, wlen);
+ if (argv_exp2(sp, &cmd, wp2, wlen2 - 1)) {
+ FREE_SPACEW(sp, wp2, wlen2);
return (1);
+ }
+ FREE_SPACEW(sp, wp2, wlen2);
/*
* 0 args: impossible.

171
testing/nvi/APKBUILD Normal file
View File

@ -0,0 +1,171 @@
# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net>
pkgname=nvi
pkgver=1.81.6
pkgrel=0
pkgdesc="Re-implementation of the vi editor"
url="http://www.bostic.com/vi"
arch="all"
license="BSD"
depends=""
depends_dev=""
makedepends="db-dev ncurses-dev"
install=""
subpackages="$pkgname-doc $pkgname-catalog"
source="http://ftp.debian.org/debian/pool/main/n/$pkgname/${pkgname}_${pkgver}.orig.tar.gz
01additional_upstream_data.patch
03db4.patch
04confdefs.patch
06default_value_escapetime.patch
07flush_cache.patch
08lfs.patch
08safe_printf.patch
08tempfile_umask.patch
09casting.patch
10no_one_line_visual.patch
11backward_sentence_moving.patch
12horiz_scroll_count.patch
13widechar_horrors.patch
14private_regex_fixes.patch
15search_word.patch
16manpage_errors.patch
17tutorial_typos.patch
18dbpagesize_binpower.patch
19include_term_h.patch
21exrc_writability_check.patch
24fallback_to_dumb_term.patch
25manpage_note_dropped_F.patch
26trailing_tab_segv.patch
27support_C_locale.patch
29file_backup.patch"
_builddir="$srcdir"/$pkgname-$pkgver
prepare() {
cd "$_builddir"
update_config_sub || return 1
for i in $source; do
case $i in
*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
esac
done
}
build() {
cd "$_builddir"/dist
./configure \
--build=$CBUILD \
--host=$CHOST \
--prefix=/usr \
--sysconfdir=/etc \
--mandir=/usr/share/man \
--localstatedir=/var \
--program-prefix=n \
--enable-widechar \
--enable-threads \
--disable-static \
|| return 1
make || return 1
}
package() {
mkdir -p "$pkgdir"/usr/bin || return 1
make -j1 PREFIX=/usr DESTDIR="$pkgdir" \
install -C "$_builddir"/dist || return 1
# Remove tcl and perl scripts.
rm -rf "$pkgdir"/usr/share/vi/tcl
rm -rf "$pkgdir"/usr/share/vi/perl
# Remove cat man pages.
rm -rf "$pkgdir"/usr/share/man/cat1
}
catalog() {
pkgdesc="$pkgdesc (catalog files)"
depends=""
arch="noarch"
mkdir -p "$subpkgdir"/usr/share/vi/
mv "$pkgdir"/usr/share/vi/catalog/ \
"$subpkgdir"/usr/share/vi/ || return 1
}
md5sums="f7e65a969045dafd53aea7e3e80b8cf2 nvi_1.81.6.orig.tar.gz
7b54dcc34076857127e4a555db7987f5 01additional_upstream_data.patch
b4a2947050cf3c3bba907dce1fe92b94 03db4.patch
936f99d503b1b9ccd12bd90ab2cf9bf4 04confdefs.patch
15c8eb6006a0ae554c79a95eab68e6d3 06default_value_escapetime.patch
a26c89008d6a739e1325abf27067353b 07flush_cache.patch
90d7e4004327473cb9caec998e45b1f7 08lfs.patch
48b1c7b5c7e92389b5def6c41af9faa5 08safe_printf.patch
f69d0024e73e924184157db83cf21151 08tempfile_umask.patch
f1e3574b9249d6559b8b07014c713388 09casting.patch
2995a5dadb8dea7201bf7a732037ae81 10no_one_line_visual.patch
1adde09ecc00e5aedbe1bba9e89867c7 11backward_sentence_moving.patch
9bcaa4dcc6b6605e1b81804aa59a1714 12horiz_scroll_count.patch
d8985b75ddc1e6bbdb95b15e8af75885 13widechar_horrors.patch
de4a3d239fb0bce60c40473d342398a4 14private_regex_fixes.patch
441fbe26900747892cfd0680b0265e58 15search_word.patch
ce43f59a26fc445586b00bd53b8b81c8 16manpage_errors.patch
8ba107264cc9dbfe83d1ec72ff2c3ec0 17tutorial_typos.patch
7646959e48fdf3a91f0f06d4305de6fa 18dbpagesize_binpower.patch
b0066d3cf7f9689cecc487bfbdc976d5 19include_term_h.patch
33a5d7f1ec10a688c429b78ccd82d044 21exrc_writability_check.patch
bf9b5d890869069963e0233129debf79 24fallback_to_dumb_term.patch
25c66adcfe779a5deaa7636f9076f2e3 25manpage_note_dropped_F.patch
724d2369993aadd1388f9ede54d0e28f 26trailing_tab_segv.patch
ad5cd0869a18e8f027435b9c0643a039 27support_C_locale.patch
77d8610f0a37e5575d5ae73173e7b449 29file_backup.patch"
sha256sums="8bc348889159a34cf268f80720b26f459dbd723b5616107d36739d007e4c978d nvi_1.81.6.orig.tar.gz
a7a3fb399359f492943d6e72e5c1233023184f0ae96ab1bebec64c0d08641f4f 01additional_upstream_data.patch
0affc8e156ab1666edec12254d87d427fd45dbebb51da184b47ab82bc9334ea1 03db4.patch
bb3e29a84602f8477e6bf6e2756057cf0164fddf7dc80863e15858dbdbe8dbf4 04confdefs.patch
3b15340e9bb51da467bcbea1ad97589fa084bed68a2ee4ce7fd9797a4279e2cf 06default_value_escapetime.patch
c26a36151ee4f839724a70e22d9b5fdac9ed3686a10842ecc807c5a9d8d63c10 07flush_cache.patch
26f39687f25de32a5c448b71c820a72cfc9310686842d291160cd830e44c673b 08lfs.patch
c5ea81a9e8da852c846d004603df49829342048e8b3959c7e1f074c9195ec866 08safe_printf.patch
56e82712e8df73b1c64dd28da6ea503555ec6b65286e42519fe023f28382064c 08tempfile_umask.patch
c06373abfd4054fb86edcb8b3844bfc773b4badd313d452d775029beb2ce25da 09casting.patch
8ed25a56255c5cf68464d8b6958be7f48aefd19a77a6eec13556505cb8f49843 10no_one_line_visual.patch
7649b5e154377a1eea7e4882eb333c51d2395b4042bc7e67c59b58d0df496995 11backward_sentence_moving.patch
c7266a713911a7b8d7d178311f089e587a8e5dfd89e3e926c68b10158bb809ea 12horiz_scroll_count.patch
ebf75d78a72bf12f812b734bcea9893c8499dfc3e7080b1552ca9f0d748ca337 13widechar_horrors.patch
b0c8209cb4f96e2843ba58a266ad6a52339b2d6cf9b9fd877692d78c5e2608cd 14private_regex_fixes.patch
05d1398e3c6611a2a62af73f55590d9a2e43ef17ac75522eff46f156a8135161 15search_word.patch
130285cfce4e4a4c726570da61ec270cba9a27eddac6efffa3fd45070b6d86d0 16manpage_errors.patch
15f2f46652e48513e272cd07cb6208cde83643db554a76eda77d84c66ea5ae35 17tutorial_typos.patch
0a9e321b571bddabd502b7f58fa365dd2095f2e344cdb3cb87888f4027b78e28 18dbpagesize_binpower.patch
31d51075014635fd3cad77f4e6bebfa192ee2c2ee0bba2b6c331a20eaca3b04c 19include_term_h.patch
ba47cf3e453d20cb584c68b5da898a79d3263efb3b95b50598f0d269ff4ecc0f 21exrc_writability_check.patch
e77f879c208d45e77c1d86558aef42bdfa4aa534f8f46c0e3dfe5de58272b003 24fallback_to_dumb_term.patch
7bcecd8a722582d2888d92a6d99849332ef27539cc09dce258ea97c1ca3867c0 25manpage_note_dropped_F.patch
8c59c97350ea8641eb86c330bf95dc2da3c6d7d61c205a8dbb3dc1f1ace63ac6 26trailing_tab_segv.patch
9bd2a5070858143dd4cde5a292890b50d209da9726883e1fb1809439c5a568fd 27support_C_locale.patch
2ef8ba25a45f264f8c63f115e7e922bc4b838f8c5d324640087be6387e4610dc 29file_backup.patch"
sha512sums="1be798daf0cd05010ddaf0aa0510dc799708fd79d4b243e2700adff18e931ddd9d11621796fa8086088c3e93ba20f15ab86783732665169c52b73eaf587ff0b3 nvi_1.81.6.orig.tar.gz
ec998baba23d15c957dbdb121a4ba7eddf0aac15503e381a1318a7e7127b0c06f3bd05ebd474175f39a6fb050ed6fd3a1f4bd348d92770355e8bc3d8d37277c9 01additional_upstream_data.patch
d635c86c52cf16ccc947ee8a4593160adf183b236ae7c2eb03ff2ea628f493e484f906b762eb1d90ec1febc48119cac955382af3ebc223e29622123500a45f97 03db4.patch
9b45e0639a30b81204e1c9b43877a6a83df2a5bba3b85a410427ead1e639cc9882f0ca162721074782870742af449c5a3f00b5051d459491bf9afb7cd718450d 04confdefs.patch
4820b584614d321b6528b9400429440b126c5c8ccc502f9e61ec7ff9cd7769e7c53e04f83ffcd4804c6baed5ac55953834644444c11e9cf42841e8fb371196ca 06default_value_escapetime.patch
df74b0977e7d864e7ea9833404f818cfb644c9fa188024b6174c7a2360350cc63f8cd8cd7fc19e54dbc5db8e2b6310be9807bb7bd108ab56dbc2d3d9cf8bff14 07flush_cache.patch
0a432a0823d0d0b2bba2dba6ee24f1b173b4552245c1bba1727804dfa8eff09dfd88129fb615eae5846aa6ef929c08a0a23a505b000dc77ecc6de578d3dc8026 08lfs.patch
2c1afb271f60031a15d4e2093b4e04c02462cc1d1815ce557049364bcdc81f83d3c6e25766a7a7efa8d04cc1c8284e9684df12ab161aba16bb479c9ee4660012 08safe_printf.patch
af723124cef36966c57785f9066cc924d155a0d495375849db36a1bf1ef1b166afd8f057d258ada9367fbf82cd30694efeeeb246d0fb14ff07fcdb807230e109 08tempfile_umask.patch
e70ee763a5c54424f75143ce892b93d8046618935bdc50bc3e646848b9b0f3d4bacf0a362b4203984527dbd98ea321a12b81b69eee7aa340e745b5d77492aca0 09casting.patch
65776b87d86cde21ef8034a1c1fe88daaac03a960223a05fdb2e1005b7e44348dc4571abe0addeef65f08fbeef72fb376486b3dccaaff4cc7d4c39bdc206026d 10no_one_line_visual.patch
f99afc8f83ea84ce059dbd5dc7b1bf726dbb2c64de8b12a7de21ca42a76e0a3b9f19d0c8c73bd046d7e0ad5ae81afed7f8e472232bcc55eb221b479ab4671f48 11backward_sentence_moving.patch
3f77c69d08d8c807eb62332eca84af898849214660e238915cadf60e46014295889bb4c66fc116846d1d9cdc2cd4d3b89b4c9c4c6a5e908ebd530f6b9fee00f0 12horiz_scroll_count.patch
97e403723934bf634120e53b7d629ca87dbae73ed0a736cf2c15d4d3f7432792535a106fbf5eb959d3b1706a868d79bf24f450e24c9b2fe295df9443ef017504 13widechar_horrors.patch
e5b1c0d7d7f96a2066f637f848564877920f163c715a1b2c4248298ed0b6a420fd3fe4e61c3925c48bd96168352cb3935b713abff8cb33d069362192f99047d7 14private_regex_fixes.patch
eadc89e64b93043dfcf8493ff8a36bc7c2f147c313a958a68edbea577cef92d10f9f2262dbb464016e4008e232a6efdb83cc0b3469cdc75b49eab7419a9ef01e 15search_word.patch
21ab846548101d58d1d9d2a93c6f309729dfdc3df33a0dd73bf55d30fc42314e4dabdeb605178a6bd256ecdab4f4331e3c156b1071c0bbf82046acb40434b7ce 16manpage_errors.patch
2dfc294f98302afad67095c8376de4de3bd582f890151ba495d1c4212964c360a9fc2afc7d988be0715b4e5d498c99f228f01d516ad57435baf07993c21c13a1 17tutorial_typos.patch
4d8999b235634fc040d45036624d880ed3c6be614cd52c7f642f8144d24726ad764a71e385445c6346f101f65febe3e609e9c9452744ee4cef5774f9048f0029 18dbpagesize_binpower.patch
27be473dc1628c407963eb4c828caa8c41ad57abb75ddf9adefe7a065ce9f8cfe16536aabeb1f078f859fa7a8817ea8d5d2ca1cb36c47be27436a9789faeb504 19include_term_h.patch
4065b814649cbbc57535941b4f20ceacc925b0ef6decfbaa5a60c6c4b943f2a5b6c68371fa87f8dce5b6c219740a10339948ffdce226c88509a807580e19864d 21exrc_writability_check.patch
b0a4c9ba713d8fb8fa8559b6038bcb70d0fb6e411a3a73cf677c38d8288f28a2febfa92f387aef899ac3959fb7bdf5220334e025b71260157f935b0f79f01e66 24fallback_to_dumb_term.patch
9a6a71574c3fb6073d3fdd0abf783f0053fbfb1ee8408e208c9368a72c3b25a5f56156da50bdd06ebf381210278c91036cca29333b48a0d5f432bbaa1d82bbd5 25manpage_note_dropped_F.patch
89ae70a8a2dd4fbb51e1f6e570f958e7dc63e4f60076446f5f0ce063f4dac19d2d1c8da241b4a709ef028459e4b43c682f1a3021ef4f04a72be98b7e2c7b9fd1 26trailing_tab_segv.patch
c091a870efc7181b3480998b8b8427cdec4b37ef66358ae8bfd2c79d6037c9b64fd6e004e39400680d1d67f608c35d56e7e36d91810ded04f984fe89a052925a 27support_C_locale.patch
4c050c5d8ee298f88bc59fd7282739dfe9202610285ca64c59b579698667ac6c8940ecf91b2b3df34d31a8ee818b9c18b1a4f9a0b47894dd4c6f8bd20c9f1c75 29file_backup.patch"