2 2

[alpine-aports] [PATCH] main/mdocml: add patch to support manpages with *p extension

Peter Bui
Details
Message ID
<1422769860-16242-1-git-send-email-pnutzh4x0r@gmail.com>
Sender timestamp
1422769860
DKIM signature
missing
Download raw message
Patch: +62 -1
mdocml only stores the section name in its database and not the file's
extension.  This is problematic for files such as
/usr/share/man/man1/ls.1p since mdocml will try to use the section name
(i.e. 1) as the file extension in the buildnames function, which will
yield a file not found error when you try to do 'man ls'.

This patch modifies mdocml's database by adding a fsec field to the
mlinks table.  This is then used to record the file section and thus
allows for more reliable building of the manpage path.

With this patch, it is now possible to run 'man ls' with mdocml.
---
 main/mdocml/APKBUILD   |  6 +++++-
 main/mdocml/fsec.patch | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+), 1 deletion(-)
 create mode 100644 main/mdocml/fsec.patch

diff --git a/main/mdocml/APKBUILD b/main/mdocml/APKBUILD
index a221a8b..0d67767 100644
--- a/main/mdocml/APKBUILD
+++ b/main/mdocml/APKBUILD
@@ -1,7 +1,7 @@
 # Maintainer:  Natanael Copa <ncopa@alpinelinux.org>
 pkgname=mdocml
 pkgver=1.13.2
-pkgrel=1
+pkgrel=2
 pkgdesc="mdoc/man compiler"
 url="http://mdocml.bsd.lv/"
 arch="all"
@@ -13,6 +13,7 @@ triggers="$pkgname.trigger=/usr/share/man/*"
 subpackages="$pkgname-doc $pkgname-dev $pkgname-man"
 source="http://mdocml.bsd.lv/snapshots/mdocml-$pkgver.tar.gz
 	shared-libmandoc.patch
+	fsec.patch
 	man.conf
 	"
 
@@ -54,10 +55,13 @@ man() {
 
 md5sums="831ba06ef06bccdf35346fc3310263a5  mdocml-1.13.2.tar.gz
 d249cec65ed75006ca610b9c8b01ba66  shared-libmandoc.patch
+b6bb75fe967f292a3c67f87d581c17d5  fsec.patch
 6e893bef0cf680eec807b230e6619d27  man.conf"
 sha256sums="9074755da96e8afbf9634d7ffa29c1decda2f642e13d9d844f26cd1e06d9716b  mdocml-1.13.2.tar.gz
 9f5a864d993e3f061161756017fcfb9906f68223298ebe7b44f1168beed85d79  shared-libmandoc.patch
+5a3226e3b129de0f6c13bcab1835e13d3bf7bdf7245d3dc413d1bb0c8c9487e4  fsec.patch
 3381c6ceb99e7db1404fdb44419040c3b441a251d594292e53545b5e4e378e2b  man.conf"
 sha512sums="7db73ff83be9acff50e8570de96591869c950dad8b350d119e57fcf39937a3272cf9d70397af2e21ec69877c5f81bc1c4e027910a4aef1033ff54b744904412c  mdocml-1.13.2.tar.gz
 fd69542e4f853827637a28f84e845aea447d63bcad51c9b45abb63ee1233a9c3a143a85016c75a9d596a2da5212460efad765ba8dd52de86e4aa1693da6617d5  shared-libmandoc.patch
+1c06ff6d5469b496fc3c9f83c2b1a9699e004a659b2ac4be0b8ea2ec143dfdccf65ac9aa4ff5a8a82fa71b45219b48a6f222ac2d89bad25ac9e350599e8659dc  fsec.patch
 0723c32ab70e5b1c77768ca78d7437b26bed19b90b27876b10cc463359c41332befc0105fc1e23ceae48de5a892f1aa7ac60ef7eb0b6b8f1616726c4300632fe  man.conf"
diff --git a/main/mdocml/fsec.patch b/main/mdocml/fsec.patch
new file mode 100644
index 0000000..1187604
--- /dev/null
+++ b/main/mdocml/fsec.patch
@@ -0,0 +1,57 @@
+--- ./mandocdb.c.orig	2015-01-31 23:18:52.953414983 +0600
+@@ -2012,6 +2012,7 @@
+ 	SQL_BIND_TEXT(stmts[STMT_INSERT_LINK], i, mlink->dsec);
+ 	SQL_BIND_TEXT(stmts[STMT_INSERT_LINK], i, mlink->arch);
+ 	SQL_BIND_TEXT(stmts[STMT_INSERT_LINK], i, mlink->name);
++	SQL_BIND_TEXT(stmts[STMT_INSERT_LINK], i, mlink->fsec);
+ 	SQL_BIND_INT64(stmts[STMT_INSERT_LINK], i, mlink->mpage->pageid);
+ 	SQL_STEP(stmts[STMT_INSERT_LINK]);
+ 	sqlite3_reset(stmts[STMT_INSERT_LINK]);
+@@ -2322,6 +2323,7 @@
+ 	      " \"sec\" TEXT NOT NULL,\n"
+ 	      " \"arch\" TEXT NOT NULL,\n"
+ 	      " \"name\" TEXT NOT NULL,\n"
++	      " \"fsec\" TEXT NOT NULL,\n"
+ 	      " \"pageid\" INTEGER NOT NULL REFERENCES mpages(pageid) "
+ 		"ON DELETE CASCADE\n"
+ 	      ");\n"
+@@ -2368,7 +2370,7 @@
+ 		"(desc,form) VALUES (?,?)";
+ 	sqlite3_prepare_v2(db, sql, -1, &stmts[STMT_INSERT_PAGE], NULL);
+ 	sql = "INSERT INTO mlinks "
+-		"(sec,arch,name,pageid) VALUES (?,?,?,?)";
++		"(sec,arch,name,fsec,pageid) VALUES (?,?,?,?,?)";
+ 	sqlite3_prepare_v2(db, sql, -1, &stmts[STMT_INSERT_LINK], NULL);
+ 	sql = "SELECT bits FROM names where pageid = ?";
+ 	sqlite3_prepare_v2(db, sql, -1, &stmts[STMT_SELECT_NAME], NULL);
+--- ./mansearch.c.orig	2015-01-31 23:20:08.003811724 +0600
+@@ -317,7 +317,7 @@
+ 		sqlite3_finalize(s);
+ 
+ 		c = sqlite3_prepare_v2(db,
+-		    "SELECT sec, arch, name, pageid FROM mlinks "
++		    "SELECT sec, arch, name, fsec, pageid FROM mlinks "
+ 		    "WHERE pageid=? ORDER BY sec, arch, name",
+ 		    -1, &s, NULL);
+ 		if (SQLITE_OK != c)
+@@ -437,6 +437,7 @@
+ 		sec = (const char *)sqlite3_column_text(s, 0);
+ 		arch = (const char *)sqlite3_column_text(s, 1);
+ 		name = (const char *)sqlite3_column_text(s, 2);
++		fsec = (const char *)sqlite3_column_text(s, 3);
+ 
+ 		/* Remember the first section found. */
+ 
+@@ -479,7 +480,9 @@
+ 
+ 		if (form & FORM_SRC) {
+ 			sep1 = "man";
+-			fsec = sec;
++			if (NULL == fsec) {
++			    fsec = sec;
++			}
+ 		} else {
+ 			sep1 = "cat";
+ 			fsec = "0";
-- 
2.2.2



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---
Natanael Copa
Details
Message ID
<20150312164613.66be823b@ncopa-desktop.alpinelinux.org>
In-Reply-To
<1422769860-16242-1-git-send-email-pnutzh4x0r@gmail.com> (view parent)
Sender timestamp
1426175173
DKIM signature
missing
Download raw message
Sorry late response. Been on vacation.

On Sat, 31 Jan 2015 23:51:00 -0600
Peter Bui <pnutzh4x0r@gmail.com> wrote:

> mdocml only stores the section name in its database and not the file's
> extension.  This is problematic for files such as
> /usr/share/man/man1/ls.1p since mdocml will try to use the section name
> (i.e. 1) as the file extension in the buildnames function, which will
> yield a file not found error when you try to do 'man ls'.
> 
> This patch modifies mdocml's database by adding a fsec field to the
> mlinks table.  This is then used to record the file section and thus
> allows for more reliable building of the manpage path.
> 
> With this patch, it is now possible to run 'man ls' with mdocml.

Have you reported this upsteam?

I don't want change the database schema without upstreams blessing.

I saw they have a new release coming up with support for running the
'man' command without any db. Do you think that will solve the issue?

-nc


---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---
Peter Bui
Details
Message ID
<20150424141750.GT1735@weasel>
In-Reply-To
<20150312164613.66be823b@ncopa-desktop.alpinelinux.org> (view parent)
Sender timestamp
1429885070
DKIM signature
missing
Download raw message
On Thu, Mar 12, 2015 at 04:46:13PM +0100, Natanael Copa wrote:
> Sorry late response. Been on vacation.
> 
> On Sat, 31 Jan 2015 23:51:00 -0600
> Peter Bui <pnutzh4x0r@gmail.com> wrote:
> 
> > mdocml only stores the section name in its database and not the file's
> > extension.  This is problematic for files such as
> > /usr/share/man/man1/ls.1p since mdocml will try to use the section name
> > (i.e. 1) as the file extension in the buildnames function, which will
> > yield a file not found error when you try to do 'man ls'.
> > 
> > This patch modifies mdocml's database by adding a fsec field to the
> > mlinks table.  This is then used to record the file section and thus
> > allows for more reliable building of the manpage path.
> > 
> > With this patch, it is now possible to run 'man ls' with mdocml.
> 
> Have you reported this upsteam?
> 
> I don't want change the database schema without upstreams blessing.
> 
> I saw they have a new release coming up with support for running the
> 'man' command without any db. Do you think that will solve the issue?
> 

mdocml 1.13.3 appears to fix this problem.  Attached is a diff that
updates the package to this version.

-- 
Peter Bui