[marillat at debian.org: Bug#178673: inn2-inews: rnews is broken]

Russ Allbery rra at stanford.edu
Tue Jan 28 02:37:24 UTC 2003


> From: Christian Marillat <marillat at debian.org>
> Subject: Bug#178673: inn2-inews: rnews is broken

> I use get-news to fetch news articles and rnews freeze. below is a
> strace.

> [pid 16152] write(5, "ihave <b14a7v$36m$1 at peinard.chezmoi>\r\n", 38)
> = 38
> [pid 16152] read(4, "335\r\n", 4096)
> = 5
> [pid 16152] read(4, 

I'm mystified.  This is the code.  Note that between the fgets that gets
the 335 reply and the server and the fwrite that sends the article, there
is no other call to any I/O function (REMclean just does some simple
buffer manipulation).  I have no idea what else would be causing that
second read.

Walking through this function in a debugger to see where the other read is
coming from would be useful.  From this, one would even think that fgets
might be doing the wrong thing.

    fprintf(ToServer, "ihave %s\r\n", msgid);
    fflush(ToServer);
    if (UUCPHost)
        notice("offered %s %s", msgid, UUCPHost);
    free(msgid);

    /* Get a reply, see if they want the article. */
    if (fgets(buff, sizeof buff, FromServer) == NULL) {
        free(wirefmt);
        syswarn("cannot fgets after ihave");
        return false;
    }
    REMclean(buff);
    if (!CTYPE(isdigit, buff[0])) {
        free(wirefmt);
        notice("bad_reply after ihave %s", buff);
        return false;
    }
    switch (atoi(buff)) {
    default:
        free(wirefmt);
        Reject(article, "unknown_reply after ihave %s", buff);
        return true;
    case NNTP_RESENDIT_VAL:
        free(wirefmt);
        return false;
    case NNTP_SENDIT_VAL:
        break;
    case NNTP_HAVEIT_VAL:
#if     defined(SYSLOG_RNEWS_LOG_DUPS)
        *p = '\0';
        notice("duplicate %s %s", id, path);
#endif  /* defined(SYSLOG_RNEWS_LOG_DUPS) */
#if     defined(FILE_RNEWS_LOG_DUPS)
        if ((F = fopen(_PATH_RNEWS_DUP_LOG, "a")) != NULL) {
            *p = '\0';
            fprintf(F, "duplicate %s %s\n", id, path);
            fclose(F);
        }
#endif  /* defined(FILE_RNEWS_LOG_DUPS) */
        free(wirefmt);
        return true;
    }

    /* Send the article to the server. */
    if (fwrite(wirefmt, length, 1, ToServer) != 1) {
        free(wirefmt);
        sysnotice("cant sendarticle");
        return false;
    }
    free(wirefmt);

-- 
Russ Allbery (rra at stanford.edu)             <http://www.eyrie.org/~eagle/>

    Please send questions to the list rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.


More information about the inn-workers mailing list