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

[leafnode-list] Leafnode 1.9.2 bug?



Last night, I subscribed to the list and sent the following.  Since I
have not seen it, I'll take the liberty of sending it again.  If this
is a duplicate, my apologies.  Please e-mail me privately if this got
onto the list.


I believe I have discovered a bug in leafnode 1.9.2, or at least a bad
interaction between it and trn 3.6 (20 Nov 1994, distributed with
RedHat Linux 5.2).

The symptom is that I would read some of a newsgroup and "q" out.  Trn
would show me the next newsgroup name and the articles it had.  If I
did "p" to go back to the previous newsgroup, when I tried to read
articles it would say "Article is now missing" or some message like
that for every article I tried to read.

The problem is shown below.  This is part of the debug log.  I added
some logging messages.  The short explanation: the first time I enter
the newsgroup, it does XOVER before the first HEAD or BODY.  The XOVER
puts it into the /var/spool/news/rec/arts/sf/written.  The second time
I enter, it does "list active", which chdir()s us into
/var/spool/news, and does NOT do XOVER.  It goes straight to "BODY",
which assumes wrongly that we're in the newsgroup's spool directory.

[going into rec.arts.sf.written.]

May 15 20:25:05 tmcd leafnode[7605]: <list active rec.arts.sf.written 
May 15 20:25:05 tmcd leafnode[7605]: mychdir: try '/var/spool/news' OK '/newsspool/leafnode'

[dolist() chdirs into the main spool directory.  The message means
that it attempted a chdir into /var/spool/news, it succeeded, and the
resulting directory name is '/newsspool/leafnode'.  That is correct:
on my system /var/spool/news is truly a symlink to /newsspool/leafnode.]

May 15 20:25:05 tmcd leafnode[7605]: >215 Newsgroups in form "group high low flags".
May 15 20:25:05 tmcd leafnode[7605]: <list active rec.arts.sf.written 
May 15 20:25:05 tmcd leafnode[7605]: mychdir: try '/var/spool/news' OK '/newsspool/leafnode'

[trn lists the active again, harmlessly.]

May 15 20:25:05 tmcd leafnode[7605]: >215 Newsgroups in form "group high low flags".
May 15 20:25:06 tmcd leafnode[7605]: <GROUP rec.arts.sf.written 
May 15 20:25:06 tmcd leafnode[7605]: mychdir: try '/var/spool/news/rec/arts/sf/written' OK '/newsspool/leafnode/rec/arts/sf/written'

[the GROUP command chdirs into the newsgroup directory]

May 15 20:25:06 tmcd leafnode[7605]: >211 5101 2361 7461 rec.arts.sf.written group selected
May 15 20:25:06 tmcd leafnode[7605]: <list active rec.arts.sf.written 
May 15 20:25:06 tmcd leafnode[7605]: mychdir: try '/var/spool/news' OK '/newsspool/leafnode'

[back to /var/spool/news]

May 15 20:25:06 tmcd leafnode[7605]: >215 Newsgroups in form "group high low flags".
May 15 20:25:06 tmcd leafnode[7605]: <XOVER 6204-6243 
May 15 20:25:06 tmcd leafnode[7605]: mychdir: try '/var/spool/news/rec/arts/sf/written' OK '/newsspool/leafnode/rec/arts/sf/written'
May 15 20:25:07 tmcd leafnode[7605]: >224 Overview information for postings 6204-6243:

[XOVER does a chdir back to the newsgroup directory]
[more XOVERS, and I read the group; I delete those log lines here]

May 15 20:26:22 tmcd leafnode[7605]: fopenart: artno 7393
May 15 20:26:22 tmcd leafnode[7605]: >221 7393 <01be9eac$8fb945c0$a45cffd0@default> article retrieved - head follows
May 15 20:26:28 tmcd leafnode[7605]: <HEAD 7373 
May 15 20:26:28 tmcd leafnode[7605]: fopenart: arg '7373' group '?;F^H¸:F^H9^I' a 7373 t-arg 4l
May 15 20:26:28 tmcd leafnode[7605]: fopenart: succeed 1
May 15 20:26:28 tmcd leafnode[7605]: fopenart: artno 7373
May 15 20:26:28 tmcd leafnode[7605]: >221 7373 <373798AF.7189@xxxxxxxxxxxxxxx> article retrieved - head follows

[I "q" out of rec.arts.sf.written here.  The next newsgroup in my
.newsrc is comp.answers.]

May 15 20:26:29 tmcd leafnode[7605]: <list active comp.answers 
May 15 20:26:29 tmcd leafnode[7605]: mychdir: try '/var/spool/news' OK '/newsspool/leafnode'

[back to /var/spool/news.  I do a "p" command to get back to
rec.arts.sf.written.]

May 15 20:26:29 tmcd leafnode[7605]: >215 Newsgroups in form "group high low flags".
May 15 20:26:30 tmcd leafnode[7605]: <list active rec.arts.sf.written 
May 15 20:26:30 tmcd leafnode[7605]: mychdir: try '/var/spool/news' OK '/newsspool/leafnode'

[still in /var/spool/news]

May 15 20:26:30 tmcd leafnode[7605]: >215 Newsgroups in form "group high low flags".
May 15 20:26:30 tmcd leafnode[7605]: <GROUP rec.arts.sf.written 
May 15 20:26:30 tmcd leafnode[7605]: mychdir: try '/var/spool/news/rec/arts/sf/written' OK '/newsspool/leafnode/rec/arts/sf/written'

[trn does a GROUP command, which puts us back in the newsgroup's directory]

May 15 20:26:30 tmcd leafnode[7605]: >211 5101 2361 7461 rec.arts.sf.written group selected
May 15 20:26:30 tmcd leafnode[7605]: <list active rec.arts.sf.written 
May 15 20:26:30 tmcd leafnode[7605]: mychdir: try '/var/spool/news' OK '/newsspool/leafnode'

[trn lists the active info again, which chdirs us back to /var/spool/news]

May 15 20:26:30 tmcd leafnode[7605]: >215 Newsgroups in form "group high low flags".
May 15 20:26:32 tmcd leafnode[7605]: <BODY 7373 

[but trn does NOT do another XOVER the second time I enter the group.
I presume that it knows no new articles have arrived and it has cached
all the XOVER information from the last time I was in the newsgroup.
It just tries to get the first article to present to me.]

May 15 20:26:32 tmcd leafnode[7605]: fopenart: arg '7373' group '?;F^H¸:F^H9^I' a 7373 t-arg 4l
May 15 20:26:32 tmcd leafnode[7605]: fopenart: pseudo 2 errno 2 'No such file or directory'
May 15 20:26:32 tmcd leafnode[7605]: rec.arts.sf.written: first 2361 last 7461 artno 7373
May 15 20:26:32 tmcd leafnode[7605]: fopenart: fail 1
May 15 20:26:32 tmcd leafnode[7605]: >430 No such article: 7373

That means fopenart() fails to open the article in this way:

    if (a && t && !*t && group) { // true
	if ( pseudogroup ) { // false
	} else { // true
	    f = fopen(arg, "r");
	    if (!f) { // true; the open failed because we're still in
                      // /var/spool/news 
		f = fopenpseudoart( arg, a ); // fails also; f == NULL after

I don't know what the "right" way to fix it is, or the "clever" way.
What I did was change dolist() to get the current directory when it
starts and chdir() to it when it ends, and syslog it if a problem
occurs.  LOG_DEBUG severity is certainly wrong, I believe, but it's
what I used.  Perhaps a better way to do the same thing would be to
make list() not depend on being in /var/spool/news -- perhaps it
should use absolute paths and not relative paths?  Perhaps other
functions should be wrapped like this?  Perhaps fopenart() should
instead chdir to the group's newsgroup spool directory?

void dolist(const char *arg) {
    /* attempt to save and restore CWD */
    char cwd[16*1024], *cwdp;
    int terrno;

    cwdp = getcwd(cwd, sizeof cwd);
    terrno = errno;
    if (cwdp != cwd) {
        sprintf(cwd, "(unknown: %d %s)", terrno, strerror(terrno));
        syslog(LOG_DEBUG, "dolog: cannot get cwd: %s",
               cwd);
        cwdp = NULL; /* should be NULL already if this branch taken */
    } else {
        terrno = 0;
    }

    ... the existing body of the function ...

    if (cwdp) {
        if (mychdir (cwd)) {
            syslog(LOG_DEBUG, "dolog: cannot go home again to '%s': %d %s",
                   cwd, errno, strerror(errno));  /*tmcd*/
        }
    }
}
    
-- 
                   *** NEW HOME E-MAIL ADDRESS ***
Tim McDaniel (home); Reply-To: tmcd@xxxxxxxx; 
if that fail, my work addresses are  tmcd@xxxxxxxxxxxxxx and tmcd@xxxxxxxxxxx
tmcd@xxxxxxxxxxxxxxxxx is a lie; tmcd@xxxxxxx is old and will go away.

-- 
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list