GNU bug report logs -
#58472
[PATCH] Make `message-unique-id' less prone to collisions
Previous Next
Reported by: Stefan Kangas <stefankangas <at> gmail.com>
Date: Wed, 12 Oct 2022 16:09:01 UTC
Severity: wishlist
Tags: patch
Done: Stefan Kangas <stefankangas <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 58472 <at> debbugs.gnu.org (full text, mbox):
On 2022-10-12 09:07, Stefan Kangas wrote:
> This seems
> unnecessary now that, AFAIU, `time-convert' can do that for us portably
> (please correct me if I'm wrong, Paul).
>
> I suggest that we instead base the left-hand side of the Message-ID on:
>
> 1. (time-convert nil (expt 10 9))
> 2. 2^N bits of pseudo random data (e.g. N=32)
(time-convert nil t) would be a bit more efficient.
If the goal is to avoid collisions, though, wouldn't it be better to
avoid the time entirely? time is not very random in the high order bits.
Also, the comment about ".fsf" and other newsreaders is wrong. If we're
generating IDs at random it doesn't matter whether we append ".fsf" as
the ".fsf" itself could be randomly generated by another newsreader. The
".fsf" is just a comment or advertisement or debugging aid or what have
you. And if we're changing the algorithm perhaps we should change ".fsf"
to something else.
Something like this, perhaps, where you can choose LEN as you like:
(concat
(let ((len 18))
;; Pass LEN, not -1, to message-number-base36 so that it never
;; returns "" which would make the message-ID nonconforming.
(message-number-base36 (random (expt 36 len)) len))
;; Append ".gnu" to advertise that we're GNU Emacs.
".gnu")
This bug report was last modified 2 years and 174 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.