unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Marek Benc <merkur32@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH] gnu: Add most debian patches to nvi.
Date: Thu, 22 Jan 2015 23:17:06 +0100	[thread overview]
Message-ID: <54C176E2.5050806@gmail.com> (raw)
In-Reply-To: <87fvb2zgg5.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 2008 bytes --]


On 01/22/2015 09:52 PM, Ludovic Courtès wrote:
> Marek Benc <merkur32@gmail.com> skribis:
>
>> On 01/22/2015 05:05 PM, Ludovic Courtès wrote:
>>> Marek Benc <merkur32@gmail.com> skribis:
>>>
>>>> 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)
>>> You mean there are run-time errors without nvi-db4.patch?  What kind?
>> I mistyped, it's only warnings, the editor seems to work okay. In
>> particular,
>> the warnings look like this:
>>
>> BDB0635 DB_CREATE must be specified to create databases.
>> BDB0511 page sizes must be a power-of-2
> OK.
>
>>> The second patch is about page sizes apparently.  Do you know what the
>>> deal is?
>> nvi seems to store the data of files in Berkely DB database objects,
>> and when
>> setting up a database for a file, it determines a page size to fit the file
>> into 15 pages or less, using a page size of at least 1K and at most 10K.
>>
>> The way it does the calculation, I quote:
>>    psize = ((sb.st_size / 15) + 1023) / 1024;
>>    if (psize > 10)
>>      psize = 10;
>>    if (psize == 0)
>>      psize = 1;
>>    psize *= 1024;
>>
>> makes psize hold a variable that's a multiple of 1024, but not necessarilya
>> power of two (for example, 3072). This didn't use to be a problem
>> before, but
>> nowadays, BDB requires pages to be powers of two, and so the modified
>> code, I
> Oh, OK.
>
> Could you quote the warnings and fold these explanations at the top of
> the patches?  And then we’ll be all set.

Sure thing, they're in now.

>
> Thanks for the explanation,
> Ludo’.

No problem, and thanks,
Marek.

[-- Attachment #2: nvi-db.patch --]
[-- Type: text/x-patch, Size: 5127 bytes --]

From e101c036615bb22b05744789fbc0f5ddb7f71413 Mon Sep 17 00:00:00 2001
From: Marek Benc <merkur32@gmail.com>
Date: Thu, 22 Jan 2015 23:08:16 +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                 | 35 ++++++++++++++++++++++
 gnu/packages/patches/nvi-dbpagesize-binpower.patch | 35 ++++++++++++++++++++++
 4 files changed, 76 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 d1fc59a..5d773ca 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -443,7 +443,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..03b736c
--- /dev/null
+++ b/gnu/packages/patches/nvi-db4.patch
@@ -0,0 +1,35 @@
+This patch originates from the Debian project, see https://www.debian.org/
+
+03db4.dpatch  by  <hesso@pool.math.tu-berlin.de>
+
+
+libdb4 compatibility adjustments.
+
+In particular, this patch adds extra file permission checking and passes the
+DB_CREATE flag to the first invocation of db_open on the file's database
+structure, which rids us of the following message:
+
+  BDB0635 DB_CREATE must be specified to create databases.
+
+--- 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..7dde693
--- /dev/null
+++ b/gnu/packages/patches/nvi-dbpagesize-binpower.patch
@@ -0,0 +1,35 @@
+This patch originates from the Debian project, see https://www.debian.org/
+
+18dbpagesize_binpower.dpatch by  <hesso@pool.math.tu-berlin.de>
+
+
+Make sure that the pagesize passed to db__set_pagesize() is a power of two.
+
+nvi stores the content of files in BDB database structures. When initiating a
+file, it picks a page size for the database to fit the file within 15 pages,
+with a minimal page size of 1K and maximal of 10K.
+
+In vanilla nvi, this size is calculated as a multiple of 1024. Modern versions
+of BDB, however, require the page size of a database to be a power of two, which
+this patch addresses, ridding us of the following message:
+
+  BDB0511 page sizes must be a power-of-2
+
+--- 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	other threads:[~2015-01-22 22:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <54BFBAED.3090502@gmail.com>
2015-01-21 14:44 ` [PATCH] gnu: Add most debian patches to nvi Marek Benc
2015-01-21 15:03   ` Ludovic Courtès
2015-01-21 15:25     ` Marek Benc
2015-01-22 16:05       ` Ludovic Courtès
2015-01-22 16:39         ` Marek Benc
2015-01-22 16:45           ` Marek Benc
2015-01-22 20:52           ` Ludovic Courtès
2015-01-22 22:17             ` Marek Benc [this message]
2015-01-23  8:48               ` Ludovic Courtès
2015-01-20 18:20 Marek Benc
2015-01-21  9:35 ` Andreas Enge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54C176E2.5050806@gmail.com \
    --to=merkur32@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).