Commit da085140 authored by Leo's avatar Leo
Browse files

testing/nvi: remove as it hard-depends on BerkeleyDB

parent b06a6aef
Pipeline #70806 failed with stages
in 41 seconds
This diff is collapsed.
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);
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
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);
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))
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
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);
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);
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);
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;
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;
/*
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. */
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. */
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))
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);
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] +"