🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nn
7 messages
7 total messages Started by Arctic Fidelity Wed, 02 Mar 2005 23:15
[long] nntpserver error and debug logged
#10606
Author: Arctic Fidelity
Date: Wed, 02 Mar 2005 23:15
242 lines
7499 bytes
Alright, I mentioned I would put up this log, all the problems I was having
with nn, so, here's my debugging thread. :-) Keep in mind that I have a
working nn-6.6.5 which works with all the values I have tested here.

Problem: nn-6.6.4 built using Slack and slack packages, errors out with
"NNTPSERVER is invalid." error no. 01.

***
What I've done, noticed, etc.
***

Alright I can verify that the problems I'm having are not because of bad
configuration of the /etc/nntpserver file which contains:

% cat /etc/nntpserver
news.gvtc.com

%

Now, here's a quote of the current config file for nn-6.6.4:

% cat /usr/lib/nn/conf
VERSION="6.6.4 (NOV)"
INEWS="/usr/lib/news/inews"
INEWS_DIR="/usr/lib/news"
AWK="awk"
NOV=true	NNTP=true	ACTIVE=/usr/lib/nn/.nn/ACTIVE
NNTPCACHE=
LOG=/usr/lib/nn/Log
TMP=${TMPDIR-/var/tmp}
DB=/usr/lib/nn/.nn
BIN=/usr/bin
LIB=/usr/lib/nn
RECMAIL="/usr/sbin/sendmail -t"
SPOOL=/usr/spool/news
NLIB=/usr/lib/news
MASTER=/usr/lib/nn
HELP=/usr/lib/nn/help
DBDATA=""
DBSHORTNAME=true
OWNER=news	GROUP=news
AUTH=false
#include <stdio.h>
#include <ctype.h>
#define NOV
#define DO_NOV_DIGEST
#define NOV_DIRECTORY	"/var/spool/news/over.view"
#define NNTP
#define NNTP_SERVER	"/etc/nntpserver"
#define HIDDENNET
#include "s-linux.h"
#include "m-sparc.h"
#define BIN_DIRECTORY	"/usr/bin"
#define LIB_DIRECTORY	"/usr/lib/nn"
#define DONT_COUNT_LINES
#define REC_MAIL	"/usr/sbin/sendmail -t"
#define APPEND_SIGNATURE
#define BUG_REPORT_ADDRESS	"mtpins@nndev.org"
#define DEFAULT_PAGER		"more"
#define DEFAULT_PRINTER		"lpr -JNEWS"
#define	OWNER	"news"
#define	GROUP	"news"
#define FOLDER_DIRECTORY	"~/News"
#define NAME_LENGTH	16
#define PUT_TIMESTAMP_IN_SCRIPTS
#include "global.h"
%

And here's the output of my nn-6.6.5 conf:

% cat /usr/local/lib/nn/conf
VERSION="6.6.5 (NOV)"
INEWS="/usr/lib/news/inews"
INEWS_DIR="/usr/lib/news"
AWK="awk"
NOV=true	NNTP=true	ACTIVE=/usr/local/lib/nn/.nn/ACTIVE
NNTPCACHE=
LOG=/usr/local/lib/nn/Log
TMP=${TMPDIR-/var/tmp}
DB=/usr/local/lib/nn/.nn
BIN=/usr/local/bin
LIB=/usr/local/lib/nn
RECMAIL="/usr/lib/sendmail -t"
SPOOL=/usr/spool/news
NLIB=/usr/lib/news
MASTER=/usr/local/lib/nn
HELP=/usr/local/lib/nn/help
DBDATA=""
DBSHORTNAME=true
OWNER=news	GROUP=news
AUTH=false
INEWSWAIT=0
SYNCHRO=true
#include <stdio.h>
#include <ctype.h>
#define NOV
#define DO_NOV_DIGEST
#define NNTP
#define NNTP_SERVER	"/etc/nntpserver"
#define HIDDENNET
#include "s-linux.h"
#include "m-i80386.h"
#define BIN_DIRECTORY	"/usr/local/bin"
#define LIB_DIRECTORY	"/usr/local/lib/nn"
#define DONT_COUNT_LINES
#define REC_MAIL	"/usr/lib/sendmail -t"
#define APPEND_SIGNATURE
#define BUG_REPORT_ADDRESS	"mtpins@nndev.org"
#define DEFAULT_PAGER		"more"
#define DEFAULT_PRINTER		"lpr -p -JNEWS"
#define	OWNER	"news"
#define	GROUP	"news"
#define FOLDER_DIRECTORY	"~/News"
#define NAME_LENGTH	16
#define INEWS_IS_FAST
#define SYNCHRONOUS_POSTING
#define PUT_TIMESTAMP_IN_SCRIPTS
#include "global.h"
%

And the diff:

% diff /usr/lib/nn/conf /usr/local/lib/nn/conf
1c1
< VERSION="6.6.4 (NOV)"
---
> VERSION="6.6.5 (NOV)"
5c5
< NOV=true	NNTP=true	ACTIVE=/usr/lib/nn/.nn/ACTIVE
---
> NOV=true	NNTP=true	ACTIVE=/usr/local/lib/nn/.nn/ACTIVE
7c7
< LOG=/usr/lib/nn/Log
---
> LOG=/usr/local/lib/nn/Log
9,12c9,12
< DB=/usr/lib/nn/.nn
< BIN=/usr/bin
< LIB=/usr/lib/nn
< RECMAIL="/usr/sbin/sendmail -t"
---
> DB=/usr/local/lib/nn/.nn
> BIN=/usr/local/bin
> LIB=/usr/local/lib/nn
> RECMAIL="/usr/lib/sendmail -t"
15,16c15,16
< MASTER=/usr/lib/nn
< HELP=/usr/lib/nn/help
---
> MASTER=/usr/local/lib/nn
> HELP=/usr/local/lib/nn/help
20a21,22
> INEWSWAIT=0
> SYNCHRO=true
25d26
< #define NOV_DIRECTORY	"/var/spool/news/over.view"
30,32c31,33
< #include "m-sparc.h"
< #define BIN_DIRECTORY	"/usr/bin"
< #define LIB_DIRECTORY	"/usr/lib/nn"
---
> #include "m-i80386.h"
> #define BIN_DIRECTORY	"/usr/local/bin"
> #define LIB_DIRECTORY	"/usr/local/lib/nn"
34c35
< #define REC_MAIL	"/usr/sbin/sendmail -t"
---
> #define REC_MAIL	"/usr/lib/sendmail -t"
38c39
< #define DEFAULT_PRINTER		"lpr -JNEWS"
---
> #define DEFAULT_PRINTER		"lpr -p -JNEWS"
42a44,45
> #define INEWS_IS_FAST
> #define SYNCHRONOUS_POSTING
%

Here are my additions coupled with the diffs for Slackware regarding the
nntp.c file, 

% diff nntp.c nntp.c.new
215a216
>             printf("Gathered nntp_server: %s\n", nntp_server);
840a842
>     printf("nntpserver: %s\nhostname: %s\n", nntp_server, host_name);
842c844,845
<     if ((hp = gethostbyname(nntp_server)) != NULL)
---
>     if ((hp = gethostbyname(nntp_server)) != NULL) {
> 	printf("Setting server_real_name\n");
843a847
>     }
844a849
> 	printf("NNTP host %s is unknown -- edit /etc/nntpserver\n",nntp_server);
%

And here's the grep for NNTPSERVER in the directory:

% cd nn-6.6.4; grep NNTPSERVER *
/home/af/nn/nn-6.6.4/ChangeLog:	no longer segfaults if NNTPSERVER is invalid.
Binary file /home/af/nn/nn-6.6.4/nn matches
/home/af/nn/nn-6.6.4/nntp.c:    if ((cp = getenv("NNTPSERVER")) != NULL) {
/home/af/nn/nn-6.6.4/nntp.c:	nn_exitmsg(1, "NNTPSERVER is invalid");
Binary file /home/af/nn/nn-6.6.4/nntp.o matches
%

And here's the output of gdb test on running nn:

% cat ./cmds
run
quit
% gdb /usr/bin/nn -x cmds
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i486-slackware-linux"...Using host libthread_db library "/lib/libthread_db.so.1".

Gathered nntp_server: news.gvtc.com
nntpserver: news.gvtc.com
hostname: frostbite.homeunix.net
Setting server_real_name
NNTPSERVER is invalid

Program exited with code 01.
%

Now, I know that it's not going through the place I think it's going
through, but now I can't figure out what's going on after this, HOW is
this program exiting like this when nn-6.6.5 works fine? Is it something
in my config? What on earth is wrong? 

I hope one of you can help.

- Arctic Fidelity

-- 
"Beware of bugs in the above code; I have only proved it correct, not
tried it."
		-- Donald Knuth
Re: [long] nntpserver error and debug logged
#10613
Author: Alan J Rosenthal
Date: Thu, 03 Mar 2005 18:38
9 lines
1009 bytes
Arctic Fidelity <spam@sacrificumdeo.net> writes:
>% cat /etc/nntpserver
>news.gvtc.com
>
>%

The extraneous newline makes me suspect all the more that there may be
other undesirable non-printing characters in that file.  How about an
"od -b /etc/nntpserver"?
Re: [long] nntpserver error and debug logged
#10607
Author: Arctic Fidelity
Date: Fri, 04 Mar 2005 02:49
17 lines
1673 bytes
flaps@dgp.toronto.edu (Alan J Rosenthal) writes:

>The extraneous newline makes me suspect all the more that there may be
>other undesirable non-printing characters in that file.  How about an
>"od -b /etc/nntpserver"?

% od -b /etc/nntpserver
0000000 156 145 167 163 056 147 166 164 143 056 143 157 155 012 012
0000017
%

- Arctic Fidelity

-- 
"Beware of bugs in the above code; I have only proved it correct, not
tried it."
		-- Donald Knuth
Re: [long] nntpserver error and debug logged
#10640
Author: Alan J Rosenthal
Date: Sun, 06 Mar 2005 04:11
7 lines
1158 bytes
Arctic Fidelity <spam@sacrificumdeo.net> writes:
>% od -b /etc/nntpserver

Oh well, it was worth a shot.  I don't know how to pursue this remotely, but
if I were there, I would be either using gdb or putting in printf statements,
to figure out whether it's getting the host name, whether it's looking it up
right, etc.
Re: [long] nntpserver error and debug logged
#10634
Author: Arctic Fidelity
Date: Sun, 06 Mar 2005 07:35
37 lines
2740 bytes
flaps@dgp.toronto.edu (Alan J Rosenthal) writes:

>Arctic Fidelity <spam@sacrificumdeo.net> writes:
>>% od -b /etc/nntpserver

>Oh well, it was worth a shot.  I don't know how to pursue this remotely, but
>if I were there, I would be either using gdb or putting in printf statements,
>to figure out whether it's getting the host name, whether it's looking it up
>right, etc.

I did, that's where all the previous stuff I put up there was.
Basically, it's going through all the right steps in nntp.c. It's
finding the correct hostname, and it is registering it as valid, because
I added some lines to the "NNTPSERVER is invalid" error, and it's NOT
going to that error in nntp.c, which is the ONLY occurance of that error
anywhere in the nn source. That is what has me stumped. How on earth is
it still printing that error if it's not even going to that error? The
only conclusion I have is that the error must be somewhere else, in
another function. But that code obviously isn't in NN's source. So where
is it?

I changed nn so that if the error was printed through the logic in
nntp.c, it would print:

Bad something or another, check /etc/nntpserver
NNTPSERVER is invalid.

If you look at the code, you'll see how this can be done easily.
However, my additional lines were not printed, only the last error,
which makes me a very confused person indeed.

- Arctic Fidelity

-- 
"Beware of bugs in the above code; I have only proved it correct, not
tried it."
		-- Donald Knuth
Re: [long] nntpserver error and debug logged
#10641
Author: Mike Hoehn
Date: Mon, 07 Mar 2005 23:13
39 lines
2226 bytes
Arctic Fidelity <spam@sacrificumdeo.net> writes:

>Here are my additions coupled with the diffs for Slackware regarding the
>nntp.c file, 

>% diff nntp.c nntp.c.new
>[...]
>> 	printf("NNTP host %s is unknown -- edit /etc/nntpserver\n",nntp_server);

This line from the nn.badnntphost.diff patch is the problem, because the
the brackets {} of the else statement are missing.

See here (nntp_check() ). The patch inserts above line between these two
lines:

    else
        nn_exitmsg(1, "NNTPSERVER is invalid");

with the result being this:

    else
        printf("NNTP host %s is unknown -- edit /etc/nntpserver\n",nntp_server);
        nn_exitmsg(1, "NNTPSERVER is invalid");

This means nn_exitmsg() is called every time, no matter which part of the
if/else statement is executed.

Instead it should look like this:

    else
    {
        printf("NNTP host %s is unknown -- edit /etc/nntpserver\n",nntp_server);
        nn_exitmsg(1, "NNTPSERVER is invalid");
    }

I just tested it with and without brackets. Without I get the "NNTPSERVER
is invalid" message. With brackets nn works well!

  Mike
Re: [long] nntpserver error and debug logged
#10645
Author: Arctic Fidelity
Date: Tue, 08 Mar 2005 04:38
33 lines
2390 bytes
On Mon, 2005-03-07 at 23:13 +0000, Mike Hoehn wrote:

> This line from the nn.badnntphost.diff patch is the problem, because the
> the brackets {} of the else statement are missing.
> 
> See here (nntp_check() ). The patch inserts above line between these two
> lines:
> 
>     else
>         nn_exitmsg(1, "NNTPSERVER is invalid");
> 
> with the result being this:
> 
>     else
>         printf("NNTP host %s is unknown -- edit /etc/nntpserver\n",nntp_server);
>         nn_exitmsg(1, "NNTPSERVER is invalid");
> 
> This means nn_exitmsg() is called every time, no matter which part of the
> if/else statement is executed.

Wow, um...duuuuhhhhh....:-/ I'm surprised the patch got through like
that...how on earth did it? :-)

I'm going to make sure this is fixed and working in the next rendition
of Slackware's nn package. :-) or else....

- Aaron Hsu

-- 
"Beware of bugs in the above code; I have only proved it correct, not
tried it."
        -- Donald Knuth
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads