tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* chdir() in mandocdb
@ 2011-12-07 11:11 Kristaps Dzonsons
  2011-12-08  1:34 ` Ingo Schwarze
  0 siblings, 1 reply; 5+ messages in thread
From: Kristaps Dzonsons @ 2011-12-07 11:11 UTC (permalink / raw)
  To: tech

Hi,

I notice that the chdir() for mandocdb()'s OP_NEW is into the base 
directory of the manuals (e.g., /usr/share/man).  However, when I run 
mandocdb over OpenBSD 5.0, I see a few inconsistencies:

  /usr/X11R6/man/man3/XTranslateCoordinates.3
  /usr/X11R6/man/man3/XUngrabDevice.3
  /usr/X11R6/man/man3/Xaw.3
  ...

All of these have an `so' in the current directory.  Looking at roff(7) 
for `so', this is the correct behaviour.  However, this means that the 
chdir() should be for each file, not the current directory (of course, 
to avoid overhead we'll keep a buffer of the current chdir() and avoid 
calling chdir() for the same directory over and over again).

Thoughts?

Kristaps

P.S., note that man.cgi is mature enough that, if catman(8) is run, 
man.cgi can be dropped into /cgi-bin and works properly.  It also works 
fine in non-jailed cgi directories, like my ~/public_html.  It's not 
pretty [yet], but it's quite functional.  I'll switch over to it 
exclusively for manuals and flush out bugs that way for a while.
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

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

* Re: chdir() in mandocdb
  2011-12-07 11:11 chdir() in mandocdb Kristaps Dzonsons
@ 2011-12-08  1:34 ` Ingo Schwarze
  2011-12-08  8:07   ` Kristaps Dzonsons
  0 siblings, 1 reply; 5+ messages in thread
From: Ingo Schwarze @ 2011-12-08  1:34 UTC (permalink / raw)
  To: tech

Hi Kristaps,

Kristaps Dzonsons wrote on Wed, Dec 07, 2011 at 12:11:10PM +0100:

> I notice that the chdir() for mandocdb()'s OP_NEW is into the base
> directory of the manuals (e.g., /usr/share/man).  However, when I
> run mandocdb over OpenBSD 5.0, I see a few inconsistencies:
> 
>  /usr/X11R6/man/man3/XUngrabDevice.3

That was a bug in Xenocara, i fixed it here:

http://www.openbsd.org/cgi-bin/cvsweb/xenocara/lib/libXi/man/ \
  XIUngrabDevice.man

>  /usr/X11R6/man/man3/XTranslateCoordinates.3
>  /usr/X11R6/man/man3/Xaw.3
>  ...

These are not .so on my -current system, not sure whether
there is any problem; it doesn't seem so on first sight.

> All of these have an `so' in the current directory.  Looking at
> roff(7) for `so', this is the correct behaviour.

No; the roff(7) manual muddles the point.
What it says is correct, but only makes sense
when you already know that man(1) does a chdir(2)
to the root of the tree.

> However, this means that the chdir() should be for each file,
> not the current directory

No!

Look for the string "chdir(buf)" in the file

  /usr/src/usr.bin/man/man.c

to understand what's really happening.

> Thoughts?

Please don't break this, it's fragile.

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

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

* Re: chdir() in mandocdb
  2011-12-08  1:34 ` Ingo Schwarze
@ 2011-12-08  8:07   ` Kristaps Dzonsons
  2011-12-10 14:11     ` Ingo Schwarze
  0 siblings, 1 reply; 5+ messages in thread
From: Kristaps Dzonsons @ 2011-12-08  8:07 UTC (permalink / raw)
  To: tech

>> I notice that the chdir() for mandocdb()'s OP_NEW is into the base
>> directory of the manuals (e.g., /usr/share/man).  However, when I
>> run mandocdb over OpenBSD 5.0, I see a few inconsistencies:
>>
>>   /usr/X11R6/man/man3/XUngrabDevice.3
>
> That was a bug in Xenocara, i fixed it here:
>
> http://www.openbsd.org/cgi-bin/cvsweb/xenocara/lib/libXi/man/ \
>    XIUngrabDevice.man
>
>>   /usr/X11R6/man/man3/XTranslateCoordinates.3
>>   /usr/X11R6/man/man3/Xaw.3
>>   ...
>
> These are not .so on my -current system, not sure whether
> there is any problem; it doesn't seem so on first sight.
>
>> All of these have an `so' in the current directory.  Looking at
>> roff(7) for `so', this is the correct behaviour.
>
> No; the roff(7) manual muddles the point.
> What it says is correct, but only makes sense
> when you already know that man(1) does a chdir(2)
> to the root of the tree.

Hi Ingo,

Can we disambiguate roff(7) to this effect, assuming that the man(1) 
behaviour is consistent across operating systems?

Best,

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

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

* Re: chdir() in mandocdb
  2011-12-08  8:07   ` Kristaps Dzonsons
@ 2011-12-10 14:11     ` Ingo Schwarze
  2011-12-10 16:08       ` Kristaps Dzonsons
  0 siblings, 1 reply; 5+ messages in thread
From: Ingo Schwarze @ 2011-12-10 14:11 UTC (permalink / raw)
  To: tech; +Cc: jmc

Hi Kristaps,

Kristaps Dzonsons wrote on Thu, Dec 08, 2011 at 09:07:32AM +0100:
> Ingo Schwarze wrote:
>> Kristaps Dzonsons wrote:

>>> I notice that the chdir() for mandocdb()'s OP_NEW is into the base
>>> directory of the manuals (e.g., /usr/share/man).  However, when I
>>> run mandocdb over OpenBSD 5.0, I see a few inconsistencies:
>>>
>>>   /usr/X11R6/man/man3/XUngrabDevice.3

>> That was a bug in Xenocara, i fixed it here:
>>
>> http://www.openbsd.org/cgi-bin/cvsweb/xenocara/lib/libXi/man/ \
>>   XIUngrabDevice.man

[...]
>>> All of these have an `so' in the current directory.  Looking at
>>> roff(7) for `so', this is the correct behaviour.

>> No; the roff(7) manual muddles the point.
>> What it says is correct, but only makes sense
>> when you already know that man(1) does a chdir(2)
>> to the root of the tree.

> Can we disambiguate roff(7) to this effect, assuming that the man(1)
> behaviour is consistent across operating systems?

Well, it has to be, X manuals enforce that consistency.

Hence, OK for the following patch?
  Ingo


Index: roff.7
===================================================================
RCS file: /cvs/src/share/man/man7/roff.7,v
retrieving revision 1.17
diff -u -r1.17 roff.7
--- roff.7	23 Nov 2011 02:12:22 -0000	1.17
+++ roff.7	10 Dec 2011 14:06:50 -0000
@@ -870,6 +870,22 @@
 .Qq ../
 and
 .Qq /.. .
+.Pp
+This request requires
+.Xr man 1
+to change to the right directory before calling
+.Xr mandoc 1 ,
+per convention to the root of the manual tree.
+Typical usage looks like:
+.Pp
+.Dl \&.so man3/Xcursor.3
+.Pp
+As the whole concept is rather fragile, usage of
+.Sx \&so
+is discouraged.
+Use
+.Xr ln 1
+instead.
 .Ss \&ta
 Set tab stops.
 This line-scoped request can take an arbitrary number of arguments.
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

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

* Re: chdir() in mandocdb
  2011-12-10 14:11     ` Ingo Schwarze
@ 2011-12-10 16:08       ` Kristaps Dzonsons
  0 siblings, 0 replies; 5+ messages in thread
From: Kristaps Dzonsons @ 2011-12-10 16:08 UTC (permalink / raw)
  To: tech; +Cc: jmc

>>>> I notice that the chdir() for mandocdb()'s OP_NEW is into the base
>>>> directory of the manuals (e.g., /usr/share/man).  However, when I
>>>> run mandocdb over OpenBSD 5.0, I see a few inconsistencies:
>>>>
>>>>    /usr/X11R6/man/man3/XUngrabDevice.3
>
>>> That was a bug in Xenocara, i fixed it here:
>>>
>>> http://www.openbsd.org/cgi-bin/cvsweb/xenocara/lib/libXi/man/ \
>>>    XIUngrabDevice.man
>
> [...]
>>>> All of these have an `so' in the current directory.  Looking at
>>>> roff(7) for `so', this is the correct behaviour.
>
>>> No; the roff(7) manual muddles the point.
>>> What it says is correct, but only makes sense
>>> when you already know that man(1) does a chdir(2)
>>> to the root of the tree.
>
>> Can we disambiguate roff(7) to this effect, assuming that the man(1)
>> behaviour is consistent across operating systems?
>
> Well, it has to be, X manuals enforce that consistency.
>
> Hence, OK for the following patch?

If Jason ok's it, then it's fine by me too.

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

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

end of thread, other threads:[~2011-12-10 16:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-07 11:11 chdir() in mandocdb Kristaps Dzonsons
2011-12-08  1:34 ` Ingo Schwarze
2011-12-08  8:07   ` Kristaps Dzonsons
2011-12-10 14:11     ` Ingo Schwarze
2011-12-10 16:08       ` 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).