Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

editors/nvi: Fix an issue with editor segfaulting in ex mode on Darwin and suppress benign stderr output regarding locale #463

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion editors/nvi/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.49 2015/09/07 12:02:05 jperkin Exp $

DISTNAME= nvi-1.81.6
PKGREVISION= 10
PKGREVISION= 12
CATEGORIES= editors
MASTER_SITES= ${HOMEPAGE:Q}
EXTRACT_SUFX= .tar.bz2
Expand Down
3 changes: 3 additions & 0 deletions editors/nvi/distinfo
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ SHA1 (patch-ba) = 57edce2dafc630d7e948a5b528242bdcff334228
SHA1 (patch-bb) = 5110c239cd1cc82cdd1eaeba6ceedb11ee797b26
SHA1 (patch-bc) = 6ac8377ae6f2fc513c058c0bf7f5ad18e97141a8
SHA1 (patch-bd) = 9a04f7a247fe6bf800469e81f7a83ffddd45b4b5
SHA1 (patch-cl_funcs__termh.c) = 27a974bf865c8006c6929fa20fde44a4cf53182b
SHA1 (patch-cl_screen__termh.c) = 55d9214a0e1cd740a065ae58defee6f0fa4d4204
SHA1 (patch-common_LC_err.c) = 88808771848deea1af7ba1fc1f11937018aa1331
SHA1 (patch-common_conv.c) = efb2dabf226523a493fc1172013adc8021f4c2b9
SHA1 (patch-common_key.h) = 29f8b89b41b087ff7c2e9a5483fb9e6d2291c750
SHA1 (patch-common_msg.c) = 73c6e8df0d5c85f4fee1316ea65de9da1876340b
Expand Down
20 changes: 20 additions & 0 deletions editors/nvi/patches/patch-cl_funcs__termh.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
$NetBSD: patch-cl_funcs__termh.c, v1.1 21:13:21

- Suppress compile time warning on Linux and prevent segfault on Darwin when
run as nex.
- Original patch was found in release 13 of nvi 1.81.6 for debian under the
name 19include_term_h.patch.

##From: <hesso@pool.math.tu-berlin.de>
##Subject: Add <term.h> to the include list to suppress a few warnings.

--- cl/cl_funcs.c.orig 2007-11-18 17:41:42.000000000 +0100
+++ 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>
20 changes: 20 additions & 0 deletions editors/nvi/patches/patch-cl_screen__termh.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
$NetBSD: patch-cl_funcs__termh.c, v1.1 21:28:34

- Suppress compile time warning on Linux and prevent segfault on Darwin when
run as nex.
- Original patch was found in release 13 of nvi 1.81.6 for debian under the
name 19include_term_h.patch.

##From: <hesso@pool.math.tu-berlin.de>
##Subject: Add <term.h> to the include list to suppress a few warnings.

--- cl/cl_screen.c.orig 2007-11-18 17:41:42.000000000 +0100
+++ 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>
76 changes: 76 additions & 0 deletions editors/nvi/patches/patch-common_LC_err.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
$NetBSD: patch-common_LC_err.c,v 1.1 2017/02/05 21:03:35

## Source: https://trac.macports.org/attachment/ticket/25733/nvilangmsg.patch
# Stop the error message:
$ nvi
./en_US.UTF-8: No such file or directory
$

--- common/msg.c.orig 2007-11-18 10:41:42.000000000 -0600
+++ common/msg.c 2010-08-29 19:14:20.000000000 -0500
@@ -715,7 +715,7 @@
DB *db;
DBT data, key;
db_recno_t msgno;
- char *p, *t, buf[MAXPATHLEN];
+ char *p, *p2, *t, buf[MAXPATHLEN];

if ((p = strrchr(file, '/')) != NULL && p[1] == '\0' &&
(((t = getenv("LC_MESSAGES")) != NULL && t[0] != '\0') ||
@@ -724,16 +724,15 @@
p = buf;
} else
p = file;
- 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) {
- if (first) {
- first = 0;
- return (1);
- }
- msgq_str(sp, M_DBERR, p, "%s");
- return (1);
- }
+
+ p2 = "%s";
+ if ((sp->db_error = db_create(&db, 0, 0)) == 0 &&
+ (sp->db_error = db->set_re_source(db, p)) == 0) {
+ db->set_errcall(db, 0);
+ if ((sp->db_error = db_open(db, NULL, DB_RECNO, 0, 0)) != 0)
+ goto err;
+ } else
+ goto err;

/*
* Test record 1 for the magic string. The msgq call is here so
@@ -749,13 +748,8 @@
data.size != sizeof(VMC) - 1 ||
memcmp(data.data, VMC, sizeof(VMC) - 1)) {
(void)db->close(db, DB_NOSYNC);
- if (first) {
- first = 0;
- return (1);
- }
- msgq_str(sp, M_DBERR, p,
- "030|The file %s is not a message catalog");
- return (1);
+ p2 = "030|The file %s is not a message catalog";
+ goto err;
}
first = 0;

@@ -763,6 +757,14 @@
(void)sp->gp->msg->close(sp->gp->msg, DB_NOSYNC);
sp->gp->msg = db;
return (0);
+
+err:
+ if (first) {
+ first = 0;
+ return (1);
+ }
+ msgq_str(sp, M_DBERR, p, p2);
+ return (1);
}

/*