From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#58472: [PATCH] Make `message-unique-id' less prone to collisions Date: Mon, 17 Oct 2022 11:16:53 +0300 Message-ID: <83sfjm3lvu.fsf@gnu.org> References: <871qr794o2.fsf@rfc20.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13241"; mail-complaints-to="usenet@ciao.gmane.io" Cc: matt@rfc20.org, stefankangas@gmail.com, 58472@debbugs.gnu.org To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 17 10:19:04 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1okLKx-0003Cq-JQ for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 17 Oct 2022 10:19:03 +0200 Original-Received: from localhost ([::1]:37152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okLKw-0006hx-2z for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 17 Oct 2022 04:19:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58426) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okLJy-0006hD-Rk for bug-gnu-emacs@gnu.org; Mon, 17 Oct 2022 04:18:11 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48090) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1okLJy-0000V8-Ao for bug-gnu-emacs@gnu.org; Mon, 17 Oct 2022 04:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1okLJy-0003pg-1Y for bug-gnu-emacs@gnu.org; Mon, 17 Oct 2022 04:18:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 17 Oct 2022 08:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58472 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 58472-submit@debbugs.gnu.org id=B58472.166599464914690 (code B ref 58472); Mon, 17 Oct 2022 08:18:02 +0000 Original-Received: (at 58472) by debbugs.gnu.org; 17 Oct 2022 08:17:29 +0000 Original-Received: from localhost ([127.0.0.1]:47168 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1okLJR-0003or-6Q for submit@debbugs.gnu.org; Mon, 17 Oct 2022 04:17:29 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:56328) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1okLJP-0003od-0N for 58472@debbugs.gnu.org; Mon, 17 Oct 2022 04:17:27 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:58888) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okLJI-0000SZ-Vk; Mon, 17 Oct 2022 04:17:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=okl3KW7lrxxLP8mcfPp6CE6/nG6q6H/iSYb8kBJ+UM0=; b=jIhwMt1j/3zKudgkq/7Q h5ThAqqf7qxGRnnvVYP2hMiyGJg4W6VRuHLXbX3z3wlrAw08dIBTsRTzQE3mdn3J1NtqwRySlBotT L0bZHGh40yBwQe8YmWXObFeuyME3GwAtBqqIe0luBciKcifQL9WFJvRmsJaNHl117BJzid+pK7RKQ rxzVLsNDQ+wlVyJ7fkPFygUL0+4EdND4lAKwylEjlNXCYcE78gOYRPWWdvTx9/j7FWHYJPbKiJBoM OosN8GglLzwtDGWwNIPWwvfE8mb1BUBY7zyF6roTnSnx4w+Owr1SPVEZ5T1fsJtRaGnwtUGYEjKKP 89CabfkwCKWBdw==; Original-Received: from [87.69.77.57] (port=1678 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okLJ3-0002xL-3g; Mon, 17 Oct 2022 04:17:19 -0400 In-Reply-To: (message from Paul Eggert on Mon, 17 Oct 2022 00:30:49 -0700) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:245695 Archived-At: > Cc: 58472@debbugs.gnu.org > Date: Mon, 17 Oct 2022 00:30:49 -0700 > From: Paul Eggert > > I've been looking into this and have several patches along these lines. > None of them address message-unique-id directly yet (I plan to tackle > this soon) but they do address the general problem area. The basic idea > is to use a new make-nonce primitive. > > I thought I'd email the patches now to see what others think about the > direction they're headed. IMNSHO, this thread has long passed the point of being reasonable. There's nothing particularly wrong with the current message-id we use, and as mentioned several times, its exact form and contents are not very important anyway. So I'm objected to any of these wide-sweeping changes for a reason that is so minor it IMO shouldn't have been brought up in the first place. I regret I didn't stop this discussion back then, because it has now snowballed into a monster. But better late than never. > --- a/src/sysdep.c > +++ b/src/sysdep.c > @@ -2163,17 +2163,11 @@ seed_random (void *seed, ptrdiff_t seed_size) > init_random (void) > { > random_seed v; > - bool success = false; > > /* First, try seeding the PRNG from the operating system's entropy > source. This approach is both fast and secure. */ > -#ifdef WINDOWSNT > - /* FIXME: Perhaps getrandom can be used here too? */ > - success = w32_init_random (&v, sizeof v) == 0; > -#else > verify (sizeof v <= 256); > - success = getrandom (&v, sizeof v, 0) == sizeof v; > -#endif > + bool success = getrandom (&v, sizeof v, 0) == sizeof v; > > /* If that didn't work, just use the current time value and PID. > It's at least better than XKCD 221. */ Please never replace w32-specific code with Gnulib without auditing. Gnulib doesn't support old versions of Windows which we still do, and so its replacement break Emacs on those old platforms. > * lisp/calc/calc-comb.el (math-random-table, math-last-RandSeed) > (math-random-ptr1, math-random-ptr2, math-random-shift) > (var-RandSeed, math-random-cache, math-init-random-base) > (math-random-base, math-random-last) > (math-random-three-digit-number): > Now obsolete, as we can assume that ‘random’ is good enough. > (math-random-digits): Simplify by using ‘random’. Why do we need to touch Calc, for crying out loud?! > From 7113ce5ab4a265db7f2870c6614da88d09407604 Mon Sep 17 00:00:00 2001 > From: Paul Eggert > Date: Sun, 16 Oct 2022 16:33:05 -0700 > Subject: [PATCH 06/10] New function make-nonce > > * src/alloc.c (clear_nonce, Fmake_nonce): New functions. > * src/fns.c: Do not include . > (extract_data_from_object): Simplify by calling get_entropy. > * src/sysdep.c (get_entropy): New function, taken from > the old extract_data_from_object. I don't want this new function in Emacs, with all the code churn and other strings with which it comes attached. Please leave our random functions alone, they do their job just fine! Bottom line: please don't install any of this, certainly not so close to cutting a release branch, and hopefully not ever. There were much easier and smaller changes proposed for message-id; let's use one of those, or even leave the original message-id intact, as there's nothing particularly wrong with it. We have much more important jobs to do. TIA.