Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 211538 - sys-apps/man-1.6f-r1 fails to build on IRIX
Summary: sys-apps/man-1.6f-r1 fails to build on IRIX
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: All IRIX
: Highest major (vote)
Assignee: Gentoo non-Linux Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-26 16:53 UTC by Stuart Shelton
Modified: 2008-04-28 16:15 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stuart Shelton 2008-02-26 16:53:08 UTC
Notes (due to -Wall/-fullwarn):

man.c:        Line 299 is unreachable
man-config.c: Requires <strings.h> (note the "s") for index()

cc-1119 cc: ERROR File = ../catopen/catopen.c, Line = 57
  The "return" expression type differs from the function return type.

        return open(name, O_RDONLY);
               ^

1 error detected in the compilation of "gripes.c".
make[1]: *** [gripes.o] Error 2
make[1]: Leaving directory `/usr/opt/portage/var/tmp/portage/sys-apps/man-1.6f-r1/work/man-1.6f/src'
make: *** [source] Error 2
 * ERROR: sys-apps/man-1.6f-r1 failed:
 *   emake failed
 * 
 * Call stack:
 *               ebuild.sh:  49: <call src_compile>
 *             environment:2406:     emake || die "emake failed"


This is because catopen.c contains:

    /*
     * "If `name' contains a `/', then `name' specifies a pathname"
     */
    if (index(name, '/')) {
#ifdef __GLIBC__
      /* glibc uses a pointer type for nl_catd, not a fd */
      return fd;
#else
      /* this works under libc5 */
      return open(name, O_RDONLY);
#endif
    }

... but IRIX nl_catd is a (void *) so the condition should be something similar to:

#if defined __GLIBC__ || defined __sgi

(of course, I'm not sure whether this is correct, or whether the lack of type-checking on void * parameters simply hides a bug... but it looks right to me)
Comment 1 Stuart Shelton 2008-02-26 16:58:03 UTC
Also, man-getopt.c lines 236 checks the wrong symbol name!

IRIX lacks 'setenv', and the symbol to check for this should be '__sgi' not '__sgi__'
Comment 2 Fabian Groffen gentoo-dev 2008-04-17 20:30:21 UTC
does man eventually work with your two fixes?
Comment 3 Stuart Shelton 2008-04-18 00:26:43 UTC
It compiles, yes.

When viewing man pages, they have no formatting (bold, underline, etc.) and contain additional characters (which were presumably supposed to be control characters for this missing formatting).

However, I'm not sure whether this is a problem with man, groff, the MANFMT variable, or the pager used to view them...

Since man-1.6f-r1 does compile with the suggested changes, though, I'd suggest that they're good.
Comment 4 Fabian Groffen gentoo-dev 2008-04-18 07:43:34 UTC
I suppose that would be groff, and/or your terminal
Comment 5 Stuart Shelton 2008-04-18 08:38:45 UTC
I doubt it's the terminal, as both the system man/nroff(?) and man/groff installed from NetBSD's pkgsrc both work fine, and it fails in the same way if connected remotely from a different system.

I've just connected remotely from a MacOS machine, and 'man man' produces 'File /opt/portage/usr/share/man/man1/man.1.bz2 is not a printable man page.' which suggests to me that something is lacking bzip2 support...

'man ls' does work (although "Reformatting page.  Wait...
                           File /opt/portage/usr/share/man/man1/ls.1.bz2 is not a printable man page.
" is output to the console), but the output looks like:

1mSYNOPSIS0m
       1mls 22m[4mOPTION24m]... [4mFILE24m]...

1mDESCRIPTION0m
       List  information  about  the FILEs (the current directory by default).
       Sort entries alphabetically if none of 1m-cftuSUX 22mnor 1m--sort22m.

... so it looks as if escape codes are being ignored.  The same happens regardless of the value of 'TERM'.

As a different user, '/opt/portage/usr/bin/man -M /opt/portage/usr/share/man ls' also works?!

I'm wondering if prefix-portage's terminfo files aren't working here... it seems to be the only consistent thing between whether the output is correct or not.

I have no idea at all how interactions with terminfo files occur, though - especially when considering prefixed terminfo files rather than system ones... any thoughts?
Comment 6 Fabian Groffen gentoo-dev 2008-04-18 08:41:47 UTC
We do install ncurses, which comes with a bunch of terminfo files.  May be that they aren't quite right.  I actually expect the same for Mac OS X, but I never really figured out why.
Comment 7 Stuart Shelton 2008-04-28 12:57:28 UTC
Still broken in man-1.6f-r2 :(

Patches are:

--- /opt/portage/var/tmp/portage/sys-apps/man-1.6f-r2/work/man-1.6f/src/man-getopt.c.dist       2008-04-28 13:50:37.838646600 +0100
+++ /opt/portage/var/tmp/portage/sys-apps/man-1.6f-r2/work/man-1.6f/src/man-getopt.c    2008-04-28 13:51:27.102545000 +0100
@@ -233,7 +233,7 @@ get_options_from_string(const char *s) {
 
 static void 
 mysetenv(const char *name, const char *value) {
-#if defined(__sgi__) || defined(__sun__) || defined(sun) || defined(__hpux)
+#if defined(__sgi) || defined(__sun__) || defined(sun) || defined(__hpux)
     int len = strlen(value)+1+strlen(value)+1;
     char *str = my_malloc(len);
     sprintf(str, "%s=%s", name, value);
--- /opt/portage/var/tmp/portage/sys-apps/man-1.6f-r2/work/man-1.6f/catopen/catopen.c.dist      2008-04-28 13:49:21.288051400 +0100
+++ /opt/portage/var/tmp/portage/sys-apps/man-1.6f-r2/work/man-1.6f/catopen/catopen.c   2008-04-28 13:49:38.195837000 +0100
@@ -49,7 +49,7 @@ my_catopen(char *name, int oflag) {
      * "If `name' contains a `/', then `name' specifies a pathname"
      */
     if (index(name, '/')) {
-#ifdef __GLIBC__
+#if defined __GLIBC__ || defined __sgi
       /* glibc uses a pointer type for nl_catd, not a fd */
       return fd;
 #else
Comment 8 Fabian Groffen gentoo-dev 2008-04-28 16:15:47 UTC
added the patch, thanks!