[news.software.b] Cnews and long message-ids

evan@telly.on.ca (Evan Leibovitch) (06/20/89)

Sometime back I recall a minor debate going on concerning the
length of message IDs. As I recall, there was some resistance to the
Cnews practice of scrapping an on-disk 'sequence number' for message
IDs, instead building ones from an entire readable date, such as

<1989Jun20.043129.10202@telly.on.ca>

I suggested, as a compromise between this and truly unreadable
compressions, going to an ID such as

<614318400.11247@telly.on.ca>

This is essentially, the internal Unix date in seconds since 01/01/70,
and the process ID. It's also 7 characters shorter than the default
Cnews action and still quite unlikely to be duplicated.

If it's worth it to you, the fix is a trivial one, using tools supplied
with Cnews.  The actual file to be changed is $NEWSBIN/inject/anne.jones.
I achieved the Unix internal format within this shell script with

d=`date`
gdat=`$NEWSBIN/getdate "$d"`

Assuming the above variables have been assigned and gdat is
exported, the last line of anne.jones can be changed to:

defmsgid="`echo \<$gdat.$$@$host\>`" -

Well, it's worked for me. So far. That's all I promise.
-- 

Evan Leibovitch, SA, Telly Online, located in beautiful Brampton, Ontario
   evan@telly.on.ca / {uunet!attcan,utzoo}!telly!evan / (416) 452-0504
    Computer salesman's credo:  There's an end-user born every minute

henry@utzoo.uucp (Henry Spencer) (06/21/89)

In article <614318400.11519@telly.on.ca> evan@telly.on.ca (Evan Leibovitch) writes:
>d=`date`
>gdat=`$NEWSBIN/getdate "$d"`

This is actually unnecessarily roundabout.  Try

	gdat=`getdate now`

which is used elsewhere in C News.
-- 
You *can* understand sendmail, |     Henry Spencer at U of Toronto Zoology
but it's not worth it. -Collyer| uunet!attcan!utzoo!henry henry@zoo.toronto.edu

chip@ateng.com (Chip Salzenberg) (06/21/89)

According to evan@telly.on.ca (Evan Leibovitch), message IDs that encode
the date in decimal are better than the default C News message IDs that
show the date in human-readable form.

Well, I've got one better.  Instead of encoding the time in decimal, encode
it in hex!  Check this article header for an example.

To get hex message IDs, apply the following patch.

*** relay/sh/anne.jones.P	Tue Jun 13 12:37:47 1989
--- relay/sh/anne.jones	Wed Jun 21 11:05:36 1989
***************
*** 101,104 ****
--- 101,107 ----
  	esac
  `"				# for defdate, defmsgid
+ # date and pid in base 36 to make them shorter
+ gdat=`(echo 16o; getdate now; echo p) | dc`
+ # name of organization
  case "$ORGANIZATION" in
  "")	deforg="`sed 1q $NEWSCTL/organi[sz]ation`" ;;	# look in a file
***************
*** 118,120 ****
  deffrom="$FROM" deforg="$deforg" \
  defdate="` set $date; echo $1, $3 $2 \` echo $6 | sed 's/^..//' \` $4 $5`" \
! defmsgid="`set $date; echo \<$6$2$3.\`  echo $4 | tr -d : \`.$$@$host\>`" -
--- 121,123 ----
  deffrom="$FROM" deforg="$deforg" \
  defdate="` set $date; echo $1, $3 $2 \` echo $6 | sed 's/^..//' \` $4 $5`" \
! defmsgid="`echo \<$gdat.$$@$host\>`" -
-- 
You may redistribute this article only to those who may freely do likewise.
Chip Salzenberg         |       <chip@ateng.com> or <uunet!ateng!chip>
A T Engineering         |       Me?  Speak for my company?  Surely you jest!

kdg@nirvo.uucp (Kurt Gollhardt) (07/23/89)

In <249FB1D6.12100@ateng.com>, chip@ateng.com (Chip Salzenberg) goes
evan@telly.on.ca (Evan Leibovitch) once step better, encoding message-id
dates in hex instead of decimal.

Chip's patch, while very handy, claims to do more than it actually does:

>+ # date and pid in base 36 to make them shorter

Contrary to what this comment says, the pid is still in decimal.  I'll add
my contribution by taking it that extra little bit further.  Here's a diff
(on top of Chip's <249FB1D6.12100@ateng.com> diff) which really does put the
pid in hex:


*** relay/sh/anne.jones.old Sat 07/22/89 19:27:24
--- relay/sh/anne.jones Sat 07/22/89 19:58:44
***************
*** 102,107
  `"				# for defdate, defmsgid
  # date and pid in base 36 to make them shorter
  gdat=`(echo 16o; getdate now; echo p) | dc`
  # name of organization
  case "$ORGANIZATION" in
  "")	deforg="`sed 1q $NEWSCTL/organi[sz]ation`" ;;	# look in a file

--- 102,108 -----
  `"				# for defdate, defmsgid
  # date and pid in base 36 to make them shorter
  gdat=`(echo 16o; getdate now; echo p) | dc`
+ pid=`(echo 16o; echo $$; echo p) | dc`
  # name of organization
  case "$ORGANIZATION" in
  "")	deforg="`sed 1q $NEWSCTL/organi[sz]ation`" ;;	# look in a file
***************
*** 120,123
  defpath="$badsites$USER" \
  deffrom="$FROM" deforg="$deforg" \
  defdate="` set $date; echo $1, $3 $2 \` echo $6 | sed 's/^..//' \` $4 $5`" \
! defmsgid="`echo \<$gdat.$$@$host\>`" -

--- 121,124 -----
  defpath="$badsites$USER" \
  deffrom="$FROM" deforg="$deforg" \
  defdate="` set $date; echo $1, $3 $2 \` echo $6 | sed 's/^..//' \` $4 $5`" \
! defmsgid="<$gdat.$pid@$host>" -

-- 
  ==============                                          ==============
  #  Kurt Gollhardt                 Nirvonics, Inc. -- Plainfield, NJ  #
  #  ...!rutgers!nirvo!kdg            Software Design and Consulting   #
  ==============                                          ==============