groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] asking for help


From: Ralph Corderoy
Subject: Re: [Groff] asking for help
Date: Fri, 13 Jul 2001 13:41:53 +0100

Hi Werner,

> I need some help in debugging the pre-grohtml

If I describe where I've got so far it may help.

>   pre-grohtml: dup: Bad file descriptortrying to replace fd=1
>                     with -1 dup used -1
> 
> while doing a `make' in the doc subdirectory.

I've found

    pre-grohtml </dev/null

constantly re-produces the error.

> An analysis with strace shows an `ERESTARTSYS' error during a call to
> write() -- according to the file include/linux/errno.h, this error
> `should never be seen by user programs'.

I think this may be a red-herring.  Here's my debugging changes.

    --- src/preproc/html/pre-html.cc        12 Jul 2001 22:11:05 -0000      1.11
    +++ src/preproc/html/pre-html.cc        13 Jul 2001 12:28:41 -0000
    @@ -1260,6 +1260,8 @@
       if (pid == 0) {
         // child
     
    +    write(0, psFileName, 0);
    +    write(0, regionFileName, 0);
         int psFd     = creat(psFileName,     S_IWUSR|S_IRUSR);
         int regionFd = creat(regionFileName, S_IWUSR|S_IRUSR);
     
    @@ -1365,7 +1367,7 @@
       htmlFileName   = "/tmp/prehtml-html";
     #else
     
    -#if 0
    +#if 1
       FILE *f;
     
       f = xtmpfile(&psFileName,

It produces this strace output.  This is the child only being straced,
after the fork.

    write(0, NULL, 0)         = -1 EBADF (Bad file descriptor)
    write(0, NULL, 0)         = -1 EBADF (Bad file descriptor)
    open(0, O_WRONLY|O_CREAT|O_TRUNC, 0600)     = -1 EFAULT (Bad address)
    open(0, O_WRONLY|O_CREAT|O_TRUNC, 0600)     = -1 EFAULT (Bad address)
    close(1)                  = 0
    dup(-1)                   = -1 EBADF (Bad file descriptor)
    write(2, "../src/preproc/html/pre-grohtml: dup: ", 57) = 57
    write(2, "trying to replace fd=1 with -1 dup use", 43) = 43
    munmap(0x4000b000, 4096)  = 0
    _exit(1)                  = ?

The first parameter to open(2) looked dodgy.  To confirm I was looking
at the right piece of source I added the two writes, again using the
same variables, and it confirms they're 0.  So they're not getting set
by the temporary filename code.

open returns -1 which gets passed to dup.  dup returns -1 and that
triggers the error.  I guess the creat(2) calls should be checked for
an error in addition to the temporary filename problem being fixed.

> I'm working on a Linux 2.2.14 box, and I've indeed never seen this
> error before.  To me the code in pre-html.cc looks perfectly legal,
> but apparently there is something wrong.

    % uname -a
    Linux inputplus 2.0.36 #1 Tue Dec 29 13:11:13 EST 1998 i586 unknown


Ralph.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]