tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* put back the chdir(2) in mandocdb(8)
@ 2011-11-28  1:09 Ingo Schwarze
  2011-11-28  8:40 ` Kristaps Dzonsons
  0 siblings, 1 reply; 4+ messages in thread
From: Ingo Schwarze @ 2011-11-28  1:09 UTC (permalink / raw)
  To: tech

OK to merge to bsd.lv?

----- Forwarded message from Ingo Schwarze <schwarze@cvs.openbsd.org> -----

From: Ingo Schwarze <schwarze@cvs.openbsd.org>
Date: Sun, 27 Nov 2011 17:57:28 -0700 (MST)
To: source-changes@cvs.openbsd.org
Subject: CVS: cvs.openbsd.org: src

CVSROOT:	/cvs
Module name:	src
Changes by:	schwarze@cvs.openbsd.org	2011/11/27 17:57:28

Modified files:
	usr.bin/mandoc : mandocdb.c 

Log message:
Put back the chdir(2) to the right man page tree before parsing manuals;
this got lost during the bsd.lv sync in rev. 1.10; oops.
This is required for processing .so links: otherwise, several files
in Xenocara fail to parse and cause ugly complaints instead.

----- End forwarded message -----

Index: mandocdb.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/mandocdb.c,v
retrieving revision 1.13
diff -u -p -r1.13 mandocdb.c
--- mandocdb.c	27 Nov 2011 23:27:16 -0000	1.13
+++ mandocdb.c	28 Nov 2011 00:51:51 -0000
@@ -27,6 +27,7 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 #include <db.h>
 
 #include "man.h"
@@ -374,10 +375,12 @@ mandocdb(int argc, char *argv[])
 		index_prune(of, db, fbuf, idx, ibuf,
 				&maxrec, &recs, &recsz);
 
-		if (OP_UPDATE == op)
+		if (OP_UPDATE == op) {
+			chdir(dir);
 			index_merge(of, mp, &dbuf, &buf, hash,
 					db, fbuf, idx, ibuf,
 					maxrec, recs, reccur);
+		}
 
 		goto out;
 	}
@@ -446,6 +449,7 @@ mandocdb(int argc, char *argv[])
 
 		of = of->first;
 
+		chdir(dirs.paths[i]);
 		index_merge(of, mp, &dbuf, &buf, hash, db, fbuf,
 				idx, ibuf, maxrec, recs, reccur);
 	}
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: put back the chdir(2) in mandocdb(8)
  2011-11-28  1:09 put back the chdir(2) in mandocdb(8) Ingo Schwarze
@ 2011-11-28  8:40 ` Kristaps Dzonsons
  2011-11-28 10:06   ` Ingo Schwarze
  0 siblings, 1 reply; 4+ messages in thread
From: Kristaps Dzonsons @ 2011-11-28  8:40 UTC (permalink / raw)
  To: tech

On 28/11/2011 02:09, Ingo Schwarze wrote:
> OK to merge to bsd.lv?
>
> ----- Forwarded message from Ingo Schwarze<schwarze@cvs.openbsd.org>  -----
>
> From: Ingo Schwarze<schwarze@cvs.openbsd.org>
> Date: Sun, 27 Nov 2011 17:57:28 -0700 (MST)
> To: source-changes@cvs.openbsd.org
> Subject: CVS: cvs.openbsd.org: src
>
> CVSROOT:	/cvs
> Module name:	src
> Changes by:	schwarze@cvs.openbsd.org	2011/11/27 17:57:28
>
> Modified files:
> 	usr.bin/mandoc : mandocdb.c
>
> Log message:
> Put back the chdir(2) to the right man page tree before parsing manuals;
> this got lost during the bsd.lv sync in rev. 1.10; oops.
> This is required for processing .so links: otherwise, several files
> in Xenocara fail to parse and cause ugly complaints instead.

Yes, please do.  However, can you add a little explanation for the 
chdir() and check its return value?

Thanks,

Kristaps

--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: put back the chdir(2) in mandocdb(8)
  2011-11-28  8:40 ` Kristaps Dzonsons
@ 2011-11-28 10:06   ` Ingo Schwarze
  2011-11-28 21:10     ` Kristaps Dzonsons
  0 siblings, 1 reply; 4+ messages in thread
From: Ingo Schwarze @ 2011-11-28 10:06 UTC (permalink / raw)
  To: tech

Hi Kristaps,

Kristaps Dzonsons wrote on Mon, Nov 28, 2011 at 09:40:23AM +0100:
> On 28/11/2011 02:09, Ingo Schwarze wrote:

>> Put back the chdir(2) to the right man page tree before parsing manuals;
>> this got lost during the bsd.lv sync in rev. 1.10; oops.
>> This is required for processing .so links: otherwise, several files
>> in Xenocara fail to parse and cause ugly complaints instead.

> Yes, please do.
> However, can you add a little explanation for the chdir()

Yes.

> and check its return value?

No.

OK?
  Ingo


Index: mandocdb.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/mandocdb.c,v
retrieving revision 1.14
diff -u -p -r1.14 mandocdb.c
--- mandocdb.c	28 Nov 2011 00:57:28 -0000	1.14
+++ mandocdb.c	28 Nov 2011 10:04:58 -0000
@@ -375,6 +375,12 @@ mandocdb(int argc, char *argv[])
 		index_prune(of, db, fbuf, idx, ibuf,
 				&maxrec, &recs, &recsz);
 
+		/*
+		 * Go to the root of the respective manual tree
+		 * such that .so links work.  In case of failure,
+		 * just prod on, even though .so links won't work.
+		 */
+
 		if (OP_UPDATE == op) {
 			chdir(dir);
 			index_merge(of, mp, &dbuf, &buf, hash,
@@ -448,6 +454,12 @@ mandocdb(int argc, char *argv[])
 			continue;
 
 		of = of->first;
+
+		/*
+		 * Go to the root of the respective manual tree
+		 * such that .so links work.  In case of failure,
+		 * just prod on, even though .so links won't work.
+		 */
 
 		chdir(dirs.paths[i]);
 		index_merge(of, mp, &dbuf, &buf, hash, db, fbuf,
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: put back the chdir(2) in mandocdb(8)
  2011-11-28 10:06   ` Ingo Schwarze
@ 2011-11-28 21:10     ` Kristaps Dzonsons
  0 siblings, 0 replies; 4+ messages in thread
From: Kristaps Dzonsons @ 2011-11-28 21:10 UTC (permalink / raw)
  To: tech

>>> Put back the chdir(2) to the right man page tree before parsing manuals;
>>> this got lost during the bsd.lv sync in rev. 1.10; oops.
>>> This is required for processing .so links: otherwise, several files
>>> in Xenocara fail to parse and cause ugly complaints instead.
>
>> Yes, please do.
>> However, can you add a little explanation for the chdir()
>
> Yes.
>
>> and check its return value?
>
> No.

Ingo,

Well, now that the explanation is there, I can see why no check's needed. :)

Yes, please check this in!

Thanks,

Kristaps
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-11-28 21:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-28  1:09 put back the chdir(2) in mandocdb(8) Ingo Schwarze
2011-11-28  8:40 ` Kristaps Dzonsons
2011-11-28 10:06   ` Ingo Schwarze
2011-11-28 21:10     ` Kristaps Dzonsons

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 NNTP newsgroup(s).