bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#58472: [PATCH] Make `message-unique-id' less prone to collisions


From: Paul Eggert
Subject: bug#58472: [PATCH] Make `message-unique-id' less prone to collisions
Date: Wed, 12 Oct 2022 11:08:12 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2

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")






reply via email to

[Prev in Thread] Current Thread [Next in Thread]