Bug 25405

Summary: misleading warning from catman(1), etc.
Product: Documentation Reporter: rdm <rdm>
Component: Books & ArticlesAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description rdm 2001-02-27 07:00:01 UTC
	If catman(1) is run as root, the message:

	  Don't start this program as root, use:
	  echo /usr/bin/catman  | nice -5 su -m man

        appears.  There are really several problems here:

        1)  The program should check whether catman is actually
            being run by root before issuing the warning.

        2)  If an error has occurred, the program should exit,
            rather then going on to write root-owned files in
            /usr/share/man/cat* (or wherever...).

        3)  The program should be clever enough to _do_ the
            necessary work, rather than telling the user how to
            do it.  Basically, the programmer has gratuitously
            broken the method of operation for a command.

        4)  The programmer's instructions to the user make use
            of an undocumented feature of man(1).  What, exactly,
	    is going on when we pipe this text string into man?

        In passing, I will note that the warning messages emitted
        by this command string:

	  Unknown FreeBSD version ``),'' at line 320
	  Unknown BSD version ``'' at line 5
	  Unknown BSD version ``'' at line 5
	
	are essentially useless, as the user has no way of knowing
        which man page is being discussed.

Fix: 

Recode catman, as described above.
How-To-Repeat: 
	% su
        # catman
Comment 1 csxbcs 2001-03-01 11:03:32 UTC
Rich Morin wrote:

> 	  Don't start this program as root, use:
> 	  echo /usr/bin/catman  | nice -5 su -m man
> 
>         appears.  There are really several problems here:
> 
>         1)  The program should check whether catman is actually
>             being run by root before issuing the warning.
> 
>         2)  If an error has occurred, the program should exit,
>             rather then going on to write root-owned files in
>             /usr/share/man/cat* (or wherever...).
> 
>         3)  The program should be clever enough to _do_ the
>             necessary work, rather than telling the user how to
>             do it.  Basically, the programmer has gratuitously
>             broken the method of operation for a command.
> 
>         4)  The programmer's instructions to the user make use
>             of an undocumented feature of man(1).  What, exactly,
> 	    is going on when we pipe this text string into man?

RTFM...  That's not what you're doing, you're passing the text string
into 'su', which simply runs a shell as user 'man' which then executes
the command /usr/bin/catman as that user.

That's not to say the other points aren't valid, but I'm a bit busy at
the moment, sorry. :-( Hopefully someone else can deal with it.

-- 
Ben Smithurst / csxbcs@comp.leeds.ac.uk / ben@FreeBSD.org
Comment 2 ru freebsd_committer freebsd_triage 2001-08-21 13:39:25 UTC
Responsible Changed
From-To: freebsd-doc->wosch

Over to the catman(1) maintainer to decide whether it should bail out 
if run under root.
Comment 3 ru freebsd_committer freebsd_triage 2002-05-21 08:03:30 UTC
State Changed
From-To: open->closed

The remnants of this PR have been fixed by the C rewrite. 


Comment 4 ru freebsd_committer freebsd_triage 2002-05-21 08:03:30 UTC
Responsible Changed
From-To: wosch->freebsd-bugs