From bbde877d96be57490d6f44cc2bdf863c04a1e0b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Sat, 20 Aug 2022 00:29:51 +0700 Subject: [PATCH] nvi: fix character class regex Fix #38742 --- .../nvi-30-regex-character-class.patch | 26 +++++++++ srcpkgs/nvi/patches/nvi-50-nvi-o_path.patch | 53 +++++++++++++++++++ srcpkgs/nvi/patches/nvi-51-path-msgcat.patch | 11 ++++ srcpkgs/nvi/template | 11 ++-- 4 files changed, 97 insertions(+), 4 deletions(-) create mode 100644 srcpkgs/nvi/patches/nvi-30-regex-character-class.patch create mode 100644 srcpkgs/nvi/patches/nvi-50-nvi-o_path.patch create mode 100644 srcpkgs/nvi/patches/nvi-51-path-msgcat.patch diff --git a/srcpkgs/nvi/patches/nvi-30-regex-character-class.patch b/srcpkgs/nvi/patches/nvi-30-regex-character-class.patch new file mode 100644 index 00000000000..889a47da9b1 --- /dev/null +++ b/srcpkgs/nvi/patches/nvi-30-regex-character-class.patch @@ -0,0 +1,26 @@ +From: Wolfgang Jenkner +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 + diff --git a/srcpkgs/nvi/patches/nvi-50-nvi-o_path.patch b/srcpkgs/nvi/patches/nvi-50-nvi-o_path.patch new file mode 100644 index 00000000000..99414bc1c73 --- /dev/null +++ b/srcpkgs/nvi/patches/nvi-50-nvi-o_path.patch @@ -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 diff --git a/srcpkgs/nvi/patches/nvi-51-path-msgcat.patch b/srcpkgs/nvi/patches/nvi-51-path-msgcat.patch new file mode 100644 index 00000000000..d72d38f87fe --- /dev/null +++ b/srcpkgs/nvi/patches/nvi-51-path-msgcat.patch @@ -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 diff --git a/srcpkgs/nvi/template b/srcpkgs/nvi/template index 5650f3bbd91..fa1e77d3437 100644 --- a/srcpkgs/nvi/template +++ b/srcpkgs/nvi/template @@ -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 " 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.