[news.software.nntp] Bug in GROUP command ?

dp@adagio.chorus.fr (Didier Poirot) (06/19/89)

	I think there is a bug in the GROUP command:

Description
-----------

 In the same session I query the server with the GROUP command two times 
(with the same newsgroup).
If there is a new article posted in the concerned group  between the 2 
calls, the second call gives me the same results as the first !! 
I have to close the server, and to start it again to get the right answer.

I dont think it's the normal way for an interactive  application to work.

Solution
--------

 I have made a little mod. in group.c to call read_groups() if the stat()
of the active file has changed since the last invokation of the command.
It slow down  a little when I enter the GROUP command, but now I have the right result. It is more faster than closing then starting the server.

	Can my mod be retained in the next patch ?

					didier

Internet Adress: dp@chorus.fr

nagel@paris.ics.uci.edu (Mark Nagel) (06/21/89)

In article <2692@chorus.fr>, dp@adagio (Didier Poirot) writes:

|	I think there is a bug in the GROUP command:

|If there is a new article posted in the concerned group  between the 2 
|calls, the second call gives me the same results as the first !! 
|I have to close the server, and to start it again to get the right answer.

I don't think it is a bug, but it is unfortunate.  Another change for
the new RFC?  Or was there some rationale for doing it this way?  I
don't recall seeing any in RFC 977.

| I have made a little mod. in group.c to call read_groups() if the stat()
|of the active file has changed since the last invokation of the command.
|It slow down  a little when I enter the GROUP command, but now I have the right result. It is more faster than closing then starting the server.

If your patch isn't huge, I'm sure many people would appreciate seeing
it here (I would!).  Since this is a pretty transparent type of
change, I think it should at least be an option in conf.h in the next
official patch...

Mark Nagel @ UC Irvine, Department of Information and Computer Science
                            +----------------------------------------+
ARPA: nagel@ics.uci.edu     | N = 1 implies P = NP                   |
UUCP: ucbvax!ucivax!nagel   |                                        |

dp@chorus.fr (Didier Poirot) (06/22/89)

In article <18381@paris.ics.uci.edu>, nagel@paris.ics.uci.edu (Mark
Nagel) writes:
> 
> | I have made a little mod. in group.c to call read_groups() if the stat()
> |of the active file has changed since the last invokation of the command.
> |It slow down  a little when I enter the GROUP command, but now I have
the right result. It is more faster than closing then starting the server.
> 
> If your patch isn't huge, I'm sure many people would appreciate seeing
> it here (I would!).  Since this is a pretty transparent type of
> change, I think it should at least be an option in conf.h in the next
> official patch...
> 

So, hope you'll be heard! Here it is. As you can see, it is rather small.
It has been constructed on the version 1.12 of group.c.

*** group.c.old Thu Jun 22 11:01:55 1989
--- group.c     Mon Jun  5 16:25:55 1989
***************
*** 24,29 ****
--- 24,32 ----
        char    *reqlist[2];


+       static long     last_mtime;
+       struct stat     statbuf;        /* struct for stat() call */
+
        if (argc != 2) {
                printf("%d Usage: GROUP newsgroup.\r\n", ERR_CMDSYN);
                (void) fflush(stdout);
***************
*** 42,47 ****
--- 45,59 ----
                (void) fflush(stdout);
                return;
        }
+
+       if (stat(activefile, &statbuf) < 0)
+               return;
+
+       if (statbuf.st_mtime != last_mtime) {     /* active file modified ?? */
+               last_mtime = statbuf.st_mtime;
+               num_groups = read_groups();       /* Read in the active file */
+       }
+
        if (find_group(argv[1], num_groups, &low_msg, &high_msg) < 0) {
                printf("%d Invalid group name (not in active).\r\n",
                        ERR_NOGROUP);


                                              Didier.

          /     /               Didier Poirot
       __/ o __/ o _  __        Chorus Systemes
      (_(_(_(_(_(_(<_/ (_       6 avenue Gustave Eiffel
                                F-78182, St-Quentin-en-Yvelines-Cedex

dp@chorus.fr (Internet)