Dear LyX Developers,

I have encountered a bug when compiling LyX 1.0 PR6 on a HP-UX platform.

Machine:  HP 720, HP-UX 9.01
Compiler: gcc 2.8.1

The problem occurs in the file spellchecker.C.  The compiler produces the
following error:

gcc -c -g -O2 -fpcc-struct-return -I. -I. -I../images   -I/usr/include/X11R5
spellchecker.C

spellchecker.C: In function `void create_ispell_pipe(const class LString
&)':
spellchecker.C:335: passing `fd_set *' as argument 2 of `select(unsigned
int, int *, int *, int *, const timeval *)'

The line in spellchecker.C causing the problem is

retval = select(pipeout[0]+1, &infds, 0, 0, &tv);

"infds" is declared a few lines previously as

fd_set infds;

which is what is causing the problem.  I did some digging around, and the
following is the best explanation I could come up with (along with an ugly
hack to fix the problem).

In "sys/time.h", the protoype for the function "select" is:

extern int select(size_t, int *, int *, int *, const struct timeval *);

In "sys/types.h", "fd_set" is defined as

typedef struct fd_set{
        fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
} fd_set;

In the same header, "fd_mask" is defined as

typedef long fd_mask;

On this machine, int and long int both use 4 bytes.  So, without having any
idea what it all means, here's my nasty hack to get spellchecker.C to
compile:

I assumed that, since fd_set has only a single member, fds_bits, that this
is the value to be passed as the second argument to the function "select"

So, I modified line 335 of spellchecker.C as follows:

retval = select(pipeout[0]+1, (int *)infds.fds_bits, 0, 0, &tv);

A little knowledge is a dangerous thing, but this allows LyX to compile, and
run.  The spellchecker seems to work okay too.

I hope this helps,
Daragh.
--------------------------
Daragh McDonnell,
D.S.P. Research Group,
University College Dublin.
e-mail: [EMAIL PROTECTED]
Tel:     (+353 1) 706 1964

Reply via email to