nvi: fix character class regex

Fix #38742
This commit is contained in:
Đoàn Trần Công Danh 2022-08-20 00:29:51 +07:00
parent dba2b8aa65
commit bbde877d96
4 changed files with 97 additions and 4 deletions

View file

@ -0,0 +1,26 @@
From: Wolfgang Jenkner <wjenkner@inode.at>
Date: Thu, 22 May 2008 16:33:57 +0200
Subject: [PATCH] p_b_cclass found the wrong cclass, due to a logical glitch.
E.g., it would find the cclass corresponding to [:alpha:] when searching
for the [:alnum:] one.
---
regex/regcomp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/regex/regcomp.c b/regex/regcomp.c
index b7509413..0b276aff 100644
--- a/regex/regcomp.c
+++ b/regex/regcomp.c
@@ -818,7 +818,7 @@ p_b_cclass(register struct parse *p, register cset *cs)
NEXT();
len = p->next - sp;
for (cp = cclasses; cp->name != NULL; cp++)
- if (STRLEN(cp->name) == len && MEMCMP(cp->name, sp, len))
+ if (STRLEN(cp->name) == len && !MEMCMP(cp->name, sp, len))
break;
if (cp->name == NULL) {
/* oops, didn't find it */
--
2.37.2

View file

@ -0,0 +1,53 @@
--- a/common/exf.c
+++ b/common/exf.c
@@ -542,7 +542,7 @@ file_spath(SCR *sp, FREF *frp, struct st
/*
* If the name is NULL or an explicit reference (i.e., the first
- * component is . or ..) ignore the O_PATH option.
+ * component is . or ..) ignore the NVI_O_PATH option.
*/
name = frp->name;
if (name == NULL) {
@@ -561,8 +561,8 @@ file_spath(SCR *sp, FREF *frp, struct st
return (0);
}
- /* Try the O_PATH option values. */
- for (found = 0, p = t = O_STR(sp, O_PATH);; ++p)
+ /* Try the NVI_O_PATH option values. */
+ for (found = 0, p = t = O_STR(sp, NVI_O_PATH);; ++p)
if (*p == ':' || *p == '\0') {
if (t < p - 1) {
savech = *p;
--- a/common/options.c
+++ b/common/options.c
@@ -147,7 +147,7 @@ OPTLIST const optlist[] = {
{L("optimize"), NULL, OPT_1BOOL, 0},
/* O_PARAGRAPHS 4BSD */
{L("paragraphs"), f_paragraph, OPT_STR, 0},
-/* O_PATH 4.4BSD */
+/* NVI_O_PATH 4.4BSD */
{L("path"), NULL, OPT_STR, 0},
/* O_PRINT 4.4BSD */
{L("print"), f_print, OPT_STR, 0},
@@ -364,7 +364,7 @@ opts_init(SCR *sp, int *oargs)
OI(O_REPORT, L("report=5"));
OI(O_PARAGRAPHS, L("paragraphs=IPLPPPQPP LIpplpipbp"));
(void)SPRINTF(b2, SIZE(b2), L("path=%s"), "");
- OI(O_PATH, b2);
+ OI(NVI_O_PATH, b2);
(void)SPRINTF(b2, SIZE(b2), L("recdir=%s"), _PATH_PRESERVE);
OI(O_RECDIR, b2);
OI(O_SECTIONS, L("sections=NHSHH HUnhsh"));
--- a/common/options_def.h
+++ b/common/options_def.h
@@ -40,7 +40,7 @@
#define O_OPEN 38
#define O_OPTIMIZE 39
#define O_PARAGRAPHS 40
-#define O_PATH 41
+#define NVI_O_PATH 41
#define O_PRINT 42
#define O_PROMPT 43
#define O_READONLY 44

View file

@ -0,0 +1,11 @@
--- a/dist/pathnames.h.in
+++ b/dist/pathnames.h.in
@@ -13,7 +13,7 @@
#endif
#ifndef _PATH_MSGCAT
-#define _PATH_MSGCAT "./"
+#define _PATH_MSGCAT "/usr/share/vi/catalog/"
#endif
#ifndef _PATH_NEXRC

View file

@ -4,7 +4,7 @@ version=1.81.6
revision=17
build_wrksrc=dist
build_style=gnu-configure
makedepends="ncurses-devel db-devel"
makedepends="ncurses-devel db-devel quilt"
short_desc="Berkeley Vi Editor"
maintainer="Enno Boland <gottox@voidlinux.org>"
license="BSD-3-Clause"
@ -22,17 +22,20 @@ alternatives="
vi:view.1:/usr/share/man/man1/nview.1
"
post_extract() {
chmod +w $wrksrc/common/options_def.h
}
do_configure() {
export OPTFLAG="$CFLAGS"
./configure ${configure_args} --enable-widechar --disable-shared \
vi_cv_path_preserve=/var/tmp --program-prefix=n \
vi_cv_sprintf_count=yes
}
pre_build() {
sed -i -e '/define.*_PATH_MSGCAT/ s/".*"/"\/usr\/share\/vi\/catalog\/"/' pathnames.h
}
post_install() {
vlicense ../LICENSE
vlicense ../regex/COPYRIGHT regex.LICENSE
# remove cat pages.
rm -rf ${DESTDIR}/usr/share/man/cat1
# remove lib.