On 01/21/2015 04:03 PM, Ludovic Courtès wrote:
I agree with Andreas: there are 20 patches, and that level of patching
goes beyond our mission, IMO.

I would rather leave it as is if it’s usable, or remove it, or point to
a new upstream if there is one.

In that case, I think at least two of the patches should be allowed to get in, the ones about the Berkely db library, since it's spewing out errors without them. (but the editor itself works)

I'm attaching a lighter version of the patch.


Thanks,
Ludo’.

>From 3c7dd8afb7f464077b850f1143144cf2c4663a92 Mon Sep 17 00:00:00 2001
From: Marek Benc <merku...@gmail.com>
Date: Wed, 21 Jan 2015 16:19:41 +0100
Subject: [PATCH] gnu: nvi: Fix Berkely DB compatability issues.

* gnu/packages/patches/nvi-db4.patch: New file.
* gnu/packages/patches/nvi-dbpagesize-binpower.patch: New file.
* gnu/packages/nvi.scm (nvi): Make use of them.
* gnu-system.am (dist_patch_DATA): Add them.

---
 gnu-system.am                                      |  4 ++-
 gnu/packages/nvi.scm                               |  4 ++-
 gnu/packages/patches/nvi-db4.patch                 | 29 ++++++++++++++++++++++
 gnu/packages/patches/nvi-dbpagesize-binpower.patch | 25 +++++++++++++++++++
 4 files changed, 60 insertions(+), 2 deletions(-)
 create mode 100644 gnu/packages/patches/nvi-db4.patch
 create mode 100644 gnu/packages/patches/nvi-dbpagesize-binpower.patch

diff --git a/gnu-system.am b/gnu-system.am
index f29b452..8200458 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -433,7 +433,9 @@ dist_patch_DATA =						\
   gnu/packages/patches/net-tools-bitrot.patch			\
   gnu/packages/patches/ninja-tests.patch			\
   gnu/packages/patches/nss-pkgconfig.patch			\
-  gnu/packages/patches/nvi-assume-preserve-path.patch           \
+  gnu/packages/patches/nvi-assume-preserve-path.patch		\
+  gnu/packages/patches/nvi-dbpagesize-binpower.patch		\
+  gnu/packages/patches/nvi-db4.patch				\
   gnu/packages/patches/orpheus-cast-errors-and-includes.patch	\
   gnu/packages/patches/ots-no-include-missing-file.patch	\
   gnu/packages/patches/patchelf-page-size.patch			\
diff --git a/gnu/packages/nvi.scm b/gnu/packages/nvi.scm
index 8fd736d..128715f 100644
--- a/gnu/packages/nvi.scm
+++ b/gnu/packages/nvi.scm
@@ -37,7 +37,9 @@
                          ".tar.bz2"))
         (sha256
           (base32 "0nbbs1inyrqds0ywn3ln5slv54v5zraq7lszkg8nsavv4kivhh9l"))
-        (patches (list (search-patch "nvi-assume-preserve-path.patch")))
+        (patches (list (search-patch "nvi-assume-preserve-path.patch")
+                       (search-patch "nvi-dbpagesize-binpower.patch")
+                       (search-patch "nvi-db4.patch")))
         (snippet
           ;; Create a wrapper for the configure script, make it executable.
           '(let ((conf-wrap (open-output-file "configure")))
diff --git a/gnu/packages/patches/nvi-db4.patch b/gnu/packages/patches/nvi-db4.patch
new file mode 100644
index 0000000..c6a2db9
--- /dev/null
+++ b/gnu/packages/patches/nvi-db4.patch
@@ -0,0 +1,29 @@
+This patch originates from the Debian project, see https://www.debian.org/
+
+03db4.dpatch  by  <he...@pool.math.tu-berlin.de>
+
+
+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);
diff --git a/gnu/packages/patches/nvi-dbpagesize-binpower.patch b/gnu/packages/patches/nvi-dbpagesize-binpower.patch
new file mode 100644
index 0000000..f37eeb2
--- /dev/null
+++ b/gnu/packages/patches/nvi-dbpagesize-binpower.patch
@@ -0,0 +1,25 @@
+This patch originates from the Debian project, see https://www.debian.org/
+
+18dbpagesize_binpower.dpatch by  <he...@pool.math.tu-berlin.de>
+
+
+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;
-- 
2.2.1

Reply via email to