[news.software.b] B-news inews patch to Message-ID line

mrapple@quack.sac.ca.us (Nick Sayer) (08/26/90)

B-news 2.11.19 uses a numeric sequence kept in a file in $LIBDIR
to obtain unique message IDs for each message. Below is a small
patch to ifuncs.c that will change the message ID to include
the c-time (num of seconds since the epoch), the process id, and
the system name. The disadvantage to this scheme is that
your system MUST maintain an accurate, or at least constantly
increasing, time-of-day. If your clock backtracks, it is possible
(though still unlikely) to have two messages with the same ID.
Since the PID is also part of the ID, two messages posted at
the same time will still be unique. This falls apart if
getpid() doesn't produce unique results for each process CURRENTLY
running.

send this into patch and remake inews.

This is a NON-STANDARD patch. Keep the patch file around
so you can undo it if someone makes B-news 2.11.20.

If you're a purist, you can also remove references to SEQFILE
from pathinit.c

Feedback cheerfully accepted.

*** ifuncs.c.o	Sat Aug 25 22:24:02 1990
--- ifuncs.c	Sat Aug 25 22:31:15 1990
***************
*** 824,832 ****
--- 824,847 ----
  /*
   * Put a unique name into header.ident.
   */
+ 
+ /* This way is a little quicker */
+ 
  getident(hp)
  struct hbuf *hp;
  {
+ 
+   (void) sprintf(hp->ident,"<%d.%d@%s>",time(0L),getpid(),LOCALSYSNAME);
+ 
+ }
+ 
+ /*
+ 
+ This is the old way
+ 
+ getident(hp)
+ struct hbuf *hp;
+ {
  	long seqn;
  	register FILE *fp;
  	extern char *mydomain();
***************
*** 838,844 ****
  	seqn = atol(bfr) + 1;
  /*
   * For Eunice, this breaks if SEQFILE is not in Unix format.
!  */
  	fp = xfopen(SEQFILE, "r+w");
  	fprintf(fp, "%ld\n", seqn);
  	(void) fclose(fp);
--- 853,859 ----
  	seqn = atol(bfr) + 1;
  /*
   * For Eunice, this breaks if SEQFILE is not in Unix format.
!  * /
  	fp = xfopen(SEQFILE, "r+w");
  	fprintf(fp, "%ld\n", seqn);
  	(void) fclose(fp);
***************
*** 845,850 ****
--- 860,867 ----
  	unlock();
  	(void) sprintf(hp->ident, "<%ld@%s>", seqn, LOCALSYSNAME);
  }
+ 
+ */
  
  /*
   * Check that header.nbuf contains only valid newsgroup names;
-- 
Nick Sayer               |  Disclaimer:
N6QQQ                    |    "Just because you're reading my post doesn't
mrapple@quack.sac.ca.us  |     mean we're gonna take long showers together."
209-952-5347 (Telebit)   |                      -- Gunnery Sgt. Thomas Highway

brad@looking.on.ca (Brad Templeton) (08/27/90)

All I can say is, "huh?"   The change to really long message ids in C
inews was one of the things people complain about, not something people
liked.

You save one file open/read/write on the sequence file, but you add 10
bytes per message + 10 bytes/reference, or about 50,000 bytes/day on
5,000 machines, or 250 megabytes/day spread around.  (If everybody did it.)

To what purpose?

You can probably compact it a bit using the minute, in hexadecimal, rather
than the second, in decimal, if you must do this.  The liklihood of
duplication here is effectively zero.
-- 
Brad Templeton, ClariNet Communications Corp. -- Waterloo, Ontario 519/884-7473

jerry@olivey.olivetti.com (Jerry Aguirre) (08/30/90)

In article <1990Aug26.181014.26880@looking.on.ca> brad@looking.on.ca (Brad Templeton) writes:
>All I can say is, "huh?"   The change to really long message ids in C
>inews was one of the things people complain about, not something people
>liked.
>
>You save one file open/read/write on the sequence file, but you add 10
>bytes per message + 10 bytes/reference, or about 50,000 bytes/day on
>5,000 machines, or 250 megabytes/day spread around.  (If everybody did it.)

And to state what some non-news gurus may not be aware of, the
message-id is only generated for local postings, not for articles coming
in from other sites.  A site is going to envoke this code from a few to
a few hundred times a day.  A drop in the bucket compared to the
overhead of relaying all those extra long message ids around on every
system.  The overhead is compounded when the longer message-ids are
incorporated in refference lines.

There are some legitimate reasons for not using a sequence file.
One is to avoid the need for locking it during updates.  But if the
price is to triple or quadruple their length then it is too high.

				Jerry Aguirre