Re: man(1) oddity - was: HEADS UP: bzip2(1) compression for manpages...

From: Ruslan Ermilov <ru_at_freebsd.org>
Date: Mon, 19 May 2003 15:43:29 +0300
On Mon, May 19, 2003 at 10:21:58PM +1000, Andy Farkas wrote:
> On Mon, 19 May 2003, Ruslan Ermilov wrote:
> >
> > Then realize what I've been trying to tell you: this is not the
> > problem of root vs. non-root, rather the message is only displayed
> > if we create a catpage, and we know we'll only display it to the
> > user after the whole manpage is formatted.  My example with
> > renaming cat8 was ought to hint you about this.
> 
> Please realise what I've been trying to tell you: there is a difference in
> the user experience when one types `man ppp` on a 4.8 box and when one
> types `man ppp` on a 5.1-B box.  On a 4.8 box the user types `man ppp`,
> gets a message, then waits around 10 seconds for the page to display. On a
> 5.1-B box the user types `man ppp` and DOES NOT GET A MESSAGE BUT HAS TO
> WAIT 10 SECONDS before the page is displayed.
> 
You got an explanation.  This is not really different between 4.8 and
5.1, nor is it root-specific.  Rather, it's a matter of creating or
nor creating the catpages.  It's up to the administrator to either
enable or disable the creation of catpages.  For slow machines, I'd
suggest formatting the manpages at buildworld time, by setting the
MANBUILDCAT= in /etc/make.conf.

> You keep saying that the page will be displayed quickly because groff is
> piping it to the pager, but this does not happen - there is always a
> considerable delay perhaps because groff is formatting..
> 
I keep saying that formatting and displaying a manpage simultaneously
will give a quicker output than formatting the whole page, compressing
it, saving it, uncompressing it, and start displaying.

> > What are you proposing?  Should we display every action that
> > we're making?
> 
> I want the same behaviour as is in 4.8-RELEASE.
> 
So you want that catpages be again created in 5.1?  Like I said,
I am slowly working on this.

> > In other words: THERE IS NOTHING TO WAIT FOR in the case when
> > a catpage is not created, man(1) already launches the command
> > that will display you the output; the fact that it's somewhat
> > slow is irrelevant here.  When, on the other hand, a catpage
> > is getting created, the command that displays the output is
> > NOT run immediately; rather, a "Please wait, formatting ..."
> > is displayed, the formatting is done (and the result is saved
> > to a .cat file), and only after that the command that shows
> > you the manpage (catpage) is run:
> 
> So it IS a root vs. non-root thing, because non-root cannot create a
> catpage anymore.
> 
So, you want setuid man(1) binary back only to be able to see that
message again?  Be careful in what you ask, you may get it:

%%%
Index: Makefile
===================================================================
RCS file: /home/ncvs/src/gnu/usr.bin/man/man/Makefile,v
retrieving revision 1.33
diff -u -r1.33 Makefile
--- Makefile	15 Jan 2002 14:11:05 -0000	1.33
+++ Makefile	19 May 2003 12:37:36 -0000
_at__at_ -20,6 +20,13 _at__at_
 CFLAGS+= -DDO_COMPRESS -DCATMODE=0644
 CLEANFILES+=	man.1
 
+.if defined(ENABLE_SUID_MAN)
+CFLAGS+= -DSETUID
+BINOWN=	man
+BINMODE= 4555
+INSTALLFLAGS= -fschg
+.endif
+
 .PATH:	${.CURDIR}/../manpath
 
 man.1: ${.CURDIR}/man.man
%%%

But beware of consequences of re-enabling this:

: revision 1.33
: date: 2002/01/15 14:11:05;  author: ru;  state: Exp;  lines: +1 -4
: Do not install man(1) setuid ``man''.
: 
: The catpaging and setuidness features of man(1) combined make
: it vulnerable to a number of security attacks.  Specifically,
: it was possible to overwrite system catpages with arbitrarily
: contents by either setting up a symlink to a directory holding
: system catpages, or by writing custom -mdoc or -man groff(1)
: macro packages and setting up GROFF_TMAC_PATH in environment
: to point to them.  (See PR below for details).
: 
: This means man(1) can no longer create system catpages on a
: regular user's behalf.  (It is still able to if the user has
: write permissions to the directory holding catpages, e.g.,
: user's own manpages, or if the running user is ``root''.)
: 
: To create and install catpages during ``make world'', please
: set MANBUILDCAT=YES in /etc/make.conf.  To rebuild catpages
: on a weekly basis, please set weekly_catman_enable="YES" in
: /etc/periodic.conf.
: 
: PR:             bin/32791

> > Scenario 1:		Scenario 2:
> > Please wait...,		format | display (simultaneously)
> > then format,
> > then display.
> 
> 
> Scene 1 does not happen for a Normal user anymore. Please understand this.
> The message does not appear to the user.
> 
But this doesn't mean that "scenario 2" should display it either.


Cheers,
-- 
Ruslan Ermilov		Sysadmin and DBA,
ru_at_sunbay.com		Sunbay Software AG,
ru_at_FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age

Received on Mon May 19 2003 - 03:43:41 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:08 UTC