Mike Gerdts wrote:
> The code that then tries to determine the man section list from the
> directories /usr/bin/man/* fails when it tries to
> opendir(/usr/bin/man) and returns without building the section list.
> The crash is happening as duplicate man directories and sections are
> removed because it assumes the section list is non-null.  An empty
> section list would be OK, but a NULL section list blows up.
> 
> There are two obvious ways to address this:
> 
> 1) Use realpath() on each path directory prior to turning it into a
> man directory.  This will break the functionality of allowing
> $prefix/bin -> $prefix/$arch/bin with a shared $prefix/man (no
> $prefix/arch/man).
> 2) Use the a special pathmap
> (http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/cmd/man/src/man.c#204)
> entry to map /usr/bin/X11 to /usr/X11/share/man.
> 
> I'm leaning toward fixing it with #2.  As I was looking into this I
> came across the following that I will address at the same time.
> 
> - path_to_manpath() should not allow a directory to be added to
> manpath if no sections are found.
> - When checking for the existence of man and share/man directories, be
> sure they are directories

I agree /usr/bin/X11 is a special case and probably needs to be handled as
such.   (And yes, it was added for compatibility with .cshrc/.profiles for
users of other Unixes.)

Does the second item mean you'll be adding checks to the path_to_manpath
code to protect against segfaults in other special cases, by basically
doing something like changing the check from:
    if (stat(mand, &sb) == 0)
to:
    if ((stat(mand, &sb) == 0) && (S_ISDIR(sb.mode))
?   (I realize that's not safe against race conditions, but since man isn't
setuid, that seems okay.)

-- 
        -Alan Coopersmith-           [EMAIL PROTECTED]
         Sun Microsystems, Inc. - X Window System Engineering

_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org

Reply via email to