GNU bug report logs - #75188
persist.el should recursively copy hash tables

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Joseph Turner <joseph@HIDDEN>; Keywords: patch; Done: Stefan Kangas <stefankangas@HIDDEN>; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 75188-done <at> debbugs.gnu.org:


Received: (at 75188-done) by debbugs.gnu.org; 13 Feb 2025 09:54:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 13 04:54:27 2025
Received: from localhost ([127.0.0.1]:40579 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tiVvJ-0006yQ-Cp
	for submit <at> debbugs.gnu.org; Thu, 13 Feb 2025 04:54:27 -0500
Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]:51443)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>)
 id 1tiVvG-0006y0-Gd
 for 75188-done <at> debbugs.gnu.org; Thu, 13 Feb 2025 04:54:20 -0500
Received: by mail-ej1-x62b.google.com with SMTP id
 a640c23a62f3a-ab7fa1bc957so138147166b.2
 for <75188-done <at> debbugs.gnu.org>; Thu, 13 Feb 2025 01:54:18 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1739440452; x=1740045252; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=IIHVK01YbgaG+x0AlxWXFwVbItKz+OCj+PUTRRihPlU=;
 b=RU2j0eZrWyBRzPg4V2noHX5aoR2sqKlZuLYAZw17K99YBWAtP9/TpQuF49guF009KB
 cZMqmfRFT5cTs+eBBsflq8Lde/CLlgged2PPDplJO70b5RrIJsOmALRWnccP5NQ2WTsU
 Npyp5tJmekx9Qkh0xoN+9hw2+a+9TKG61V+XqQK8q7dpsE1NRsV0gZtnYZsB93RZmdZz
 cWt+X/ZDv3KTQFU6dep9fOpTf+acBNyzy+jbFGSe25yHhbRb9wln2V4I2as1eu91TYS8
 LBGTVle9bsTThbTmfUya27LG8zCXgYXbjkjRZKB2BR4zsiD5IRHVdjVASzWkUG4//WGV
 VzFw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1739440452; x=1740045252;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=IIHVK01YbgaG+x0AlxWXFwVbItKz+OCj+PUTRRihPlU=;
 b=I72a9BOFZrdTrmw8sx2/emJOD2UR+PaBx11Pn0t2HDPWmz9yPvxM6FHLd2GDbfzzQk
 5oOHWoNWG1ZFgVji0hFCwSlkUla3Q7vzCcV92fF4JA3YNY5+RNPdyq/WsitZoTGae9Tz
 wL8h3nWI7sxvGB9DuWGxLkCidsZ9iC8SSdxNkIX2or8EkZ+qrrnOOhMeVWLp4OzH3a+N
 +0x3YyT0mj82d40z/Ii/nk5PCaMrjpbaN0hwy6N+SP38a3vKQr1rjkeA+6YvjOi6+5Fm
 9BX3nt6G3fi8p8tS9Np5eJBL0d8EeI2w/AFzMmYywqy109a9ZrHNW4yUqgny2cYgad8T
 gQsQ==
X-Forwarded-Encrypted: i=1;
 AJvYcCU7y77r9gDa8lYqpzMdQ2NqkT//XAQa3VK9XPRSd6fkWQjyQvrMbny7DNV8ko8vhB1klRydh2xckLUk <at> debbugs.gnu.org
X-Gm-Message-State: AOJu0YxJpW2Bh2Hi72Tkgg9Yb6je1t3iq2FJzgF3YelWxGXVkOPIqAZj
 IwQF8TyyaWLLbj5y6tc2ewHvQ85z1G++F/oc12dNasca8qQ+WTTyjjIDGa650bZfJdKxiY0KiIl
 QFF/niv5lxes7RfV5uaPci5D/97o=
X-Gm-Gg: ASbGncvYvmTOdCPVei275WjsDR+QwALSUmA1fHdvr4mEC0oRKWORDlHInt/Znp9gyQY
 uCKRKI5Jy1XelrNGslIwM+hPQ4XxCJmNS31B+qytZEy/hflWdE5d2c2IfipbFQQezVj1GvJsxzu
 A=
X-Google-Smtp-Source: AGHT+IFPV9nxUOAvJJ5fp3z+EI0mmRLGi/DwSFc7lxUR1kaThgSGTp+f5UNyp+0ijf6f4VesR182lI4DyPsjd9nBr30=
X-Received: by 2002:a17:907:da3:b0:ab7:cc43:c52a with SMTP id
 a640c23a62f3a-aba501ab6aemr224415566b.52.1739440452088; Thu, 13 Feb 2025
 01:54:12 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Thu, 13 Feb 2025 01:54:11 -0800
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <86frkygdoz.fsf@HIDDEN>
References: <87wmfhk0bp.fsf@HIDDEN>
 <87y0zv7b9r.fsf@HIDDEN>
 <86a5bocwq3.fsf@HIDDEN> <877c6fsn9i.fsf@HIDDEN>
 <86frkygdoz.fsf@HIDDEN>
MIME-Version: 1.0
Date: Thu, 13 Feb 2025 01:54:11 -0800
X-Gm-Features: AWEUYZmYPYtRjUIkELdzdIMyr6n7eVWGmFXdskfdr7uHMKhEkYH0Nq4GEJlz-4M
Message-ID: <CADwFkm=QsKmwuUU7rWGOZP+jujYMf1FP10CZX-pOhVgSaC=44w@HIDDEN>
Subject: Re: bug#75188: persist.el should recursively copy hash tables
To: Eli Zaretskii <eliz@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75188-done
Cc: yantar92@HIDDEN, mail@HIDDEN,
 Joseph Turner <joseph@HIDDEN>, monnier@HIDDEN,
 adam@HIDDEN, 75188-done <at> debbugs.gnu.org, phillip.lord@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Joseph Turner <joseph@HIDDEN>
>> Cc: 75188 <at> debbugs.gnu.org,  mail@HIDDEN,  yantar92@HIDDEN,
>>   monnier@HIDDEN,  adam@HIDDEN,
>>   phillip.lord@HIDDEN
>> Date: Mon, 27 Jan 2025 18:08:57 -0800
>>
>> Eli Zaretskii <eliz@HIDDEN> writes:
>>
>> >> From: Joseph Turner <joseph@HIDDEN>
>> >> Cc:  Daniel Mendler <mail@HIDDEN>,
>> >> 	Ihor Radchenko <yantar92@HIDDEN>,
>> >> 	Stefan Monnier <monnier@HIDDEN>,
>> >> 	Adam Porter <adam@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>,
>> >> 	phillip.lord@HIDDEN
>> >> Date: Tue, 31 Dec 2024 14:12:00 -0800
>> >>
>> >> > Hello!
>> >> >
>> >> > This patch demonstrates a bug in persist.el
>> >>
>> >> [...]
>> >>
>> >> This issue also relates to the bug#63513, in which the suggestion was
>> >> made to replace persist-copy-tree with (compat-call copy-tree) now that
>> >> Compat 30 is available:
>> >>
>> >> https://yhetil.org/emacs-bugs/80479897-500e-fe60-6586-0a44ccb5993b@HIDDEN/
>> >
>> > Thanks, would you like to submit a patch along those lines?
>>
>> Please see patch:
>
> LGTM.  Phillip, would you please install?

I'm not Phillip, but I installed the patch now.  Closing.




Notification sent to Joseph Turner <joseph@HIDDEN>:
bug acknowledged by developer. Full text available.
Reply sent to Stefan Kangas <stefankangas@HIDDEN>:
You have taken responsibility. Full text available.

Message received at 75188 <at> debbugs.gnu.org:


Received: (at 75188) by debbugs.gnu.org; 1 Feb 2025 10:30:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 01 05:30:20 2025
Received: from localhost ([127.0.0.1]:56500 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1teAlX-0006qy-Pk
	for submit <at> debbugs.gnu.org; Sat, 01 Feb 2025 05:30:20 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:48706)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1teAlU-0006qf-Ml
 for 75188 <at> debbugs.gnu.org; Sat, 01 Feb 2025 05:30:18 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1teAlM-0003nb-3t; Sat, 01 Feb 2025 05:30:08 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=hIRXlgrJGI2cbmBqz/NyLNzNm/XuINhHMngBWCR8OuI=; b=Xfh74fDzAbVL
 JG5fGZ2lOlFGXGItO4H7Kqq4gRzTpAKrwyNcOXTDvf2DmI6pql20mNv8J5hhUovgYjWsONMAEHlEH
 0z1ryy9sSvePbIdGY6KeIHxPzLA9SOhIoNNq9Kfk4i8RPXrkv6Z/45QkvuRz6wv3DicXcnEmnSpEh
 3zYifIdE4BsVUYJdEah2gjZ4f4Ah6LA4Ri8rqdZjS8Vnqmv6PzTFpD4b60NY5SMoVSVSc7yNPEDIM
 h96L+ZYj3UWGdor/XqtoNtrDofAr4Drag73enntPLcB2Rcgev+hO+jc30NH1pNzDgCMXUwxgijW6l
 I8Cxk7v1G7gFJ3CWdJyQXA==;
Date: Sat, 01 Feb 2025 12:30:04 +0200
Message-Id: <86frkygdoz.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Joseph Turner <joseph@HIDDEN>
In-Reply-To: <877c6fsn9i.fsf@HIDDEN> (message from Joseph Turner
 on Mon, 27 Jan 2025 18:08:57 -0800)
Subject: Re: bug#75188: persist.el should recursively copy hash tables
References: <87wmfhk0bp.fsf@HIDDEN>
 <87y0zv7b9r.fsf@HIDDEN> <86a5bocwq3.fsf@HIDDEN>
 <877c6fsn9i.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 75188
Cc: yantar92@HIDDEN, mail@HIDDEN, monnier@HIDDEN,
 75188 <at> debbugs.gnu.org, adam@HIDDEN, phillip.lord@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Joseph Turner <joseph@HIDDEN>
> Cc: 75188 <at> debbugs.gnu.org,  mail@HIDDEN,  yantar92@HIDDEN,
>   monnier@HIDDEN,  adam@HIDDEN,
>   phillip.lord@HIDDEN
> Date: Mon, 27 Jan 2025 18:08:57 -0800
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> >> From: Joseph Turner <joseph@HIDDEN>
> >> Cc:  Daniel Mendler <mail@HIDDEN>,
> >> 	Ihor Radchenko <yantar92@HIDDEN>,
> >> 	Stefan Monnier <monnier@HIDDEN>,
> >> 	Adam Porter <adam@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>,
> >> 	phillip.lord@HIDDEN
> >> Date: Tue, 31 Dec 2024 14:12:00 -0800
> >>
> >> > Hello!
> >> >
> >> > This patch demonstrates a bug in persist.el
> >>
> >> [...]
> >>
> >> This issue also relates to the bug#63513, in which the suggestion was
> >> made to replace persist-copy-tree with (compat-call copy-tree) now that
> >> Compat 30 is available:
> >>
> >> https://yhetil.org/emacs-bugs/80479897-500e-fe60-6586-0a44ccb5993b@HIDDEN/
> >
> > Thanks, would you like to submit a patch along those lines?
> 
> Please see patch:

LGTM.  Phillip, would you please install?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75188; Package emacs. Full text available.

Message received at 75188 <at> debbugs.gnu.org:


Received: (at 75188) by debbugs.gnu.org; 28 Jan 2025 02:09:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 27 21:09:16 2025
Received: from localhost ([127.0.0.1]:35017 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tcb2S-000845-85
	for submit <at> debbugs.gnu.org; Mon, 27 Jan 2025 21:09:16 -0500
Received: from out-189.mta1.migadu.com ([95.215.58.189]:26874)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <joseph@HIDDEN>)
 id 1tcb2N-00083g-Ca
 for 75188 <at> debbugs.gnu.org; Mon, 27 Jan 2025 21:09:14 -0500
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1738030143;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=DLdU1hR45OLRD5i99QGVj2HVoyegbhsjcfbQkyvalgs=;
 b=lCwoOzM6aP04OopwCOBlDnTPCLJxRHJm2FzTuqHt3gUN0FRRWVe2VhwonAJBZl/eYgZDE4
 rQ/1k1rsNVKA0S+cWunBw5Rlw9zxKU0WpDb4pRvgi+AsUyfF9eoz7Npu4UOMQ7OBgh3j6b
 djoc9Qtdm3+7//ghukzsGsTk8Rr0b9s=
From: Joseph Turner <joseph@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#75188: persist.el should recursively copy hash tables
In-Reply-To: <86a5bocwq3.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 18 Jan
 2025 11:11:48 +0200")
References: <87wmfhk0bp.fsf@HIDDEN>
 <87y0zv7b9r.fsf@HIDDEN> <86a5bocwq3.fsf@HIDDEN>
Date: Mon, 27 Jan 2025 18:08:57 -0800
Message-ID: <877c6fsn9i.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Migadu-Flow: FLOW_OUT
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 75188
Cc: yantar92@HIDDEN, mail@HIDDEN, monnier@HIDDEN,
 75188 <at> debbugs.gnu.org, adam@HIDDEN, phillip.lord@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--=-=-=
Content-Type: text/plain

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Joseph Turner <joseph@HIDDEN>
>> Cc:  Daniel Mendler <mail@HIDDEN>,
>> 	Ihor Radchenko <yantar92@HIDDEN>,
>> 	Stefan Monnier <monnier@HIDDEN>,
>> 	Adam Porter <adam@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>,
>> 	phillip.lord@HIDDEN
>> Date: Tue, 31 Dec 2024 14:12:00 -0800
>>
>> > Hello!
>> >
>> > This patch demonstrates a bug in persist.el
>>
>> [...]
>>
>> This issue also relates to the bug#63513, in which the suggestion was
>> made to replace persist-copy-tree with (compat-call copy-tree) now that
>> Compat 30 is available:
>>
>> https://yhetil.org/emacs-bugs/80479897-500e-fe60-6586-0a44ccb5993b@HIDDEN/
>
> Thanks, would you like to submit a patch along those lines?

Please see patch:


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0001-Depend-on-compat.el-for-new-copy-tree-behavior.patch

From 8c3d276a977010d4b903d9de7344b6fad8de8eab Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@HIDDEN>
Date: Mon, 27 Jan 2025 18:05:10 -0800
Subject: [PATCH] Depend on compat.el for new copy-tree behavior

---
 persist.el | 34 ++++------------------------------
 1 file changed, 4 insertions(+), 30 deletions(-)

diff --git a/persist.el b/persist.el
index 49b3e9b51f..3260df0964 100644
--- a/persist.el
+++ b/persist.el
@@ -5,7 +5,7 @@
 ;; Author: Phillip Lord <phillip.lord@HIDDEN>
 ;; Maintainer: Joseph Turner <persist-el@HIDDEN>
 ;; Package-Type: multi
-;; Package-Requires: ((emacs "26.1"))
+;; Package-Requires: ((emacs "26.1") (compat "30.0.2.0"))
 ;; Version: 0.6.1
 
 ;; The contents of this file are subject to the GPL License, Version 3.0.
@@ -43,6 +43,8 @@
 
 ;;; Code:
 
+(require 'compat)
+
 (defvar persist--directory-location
   (locate-user-emacs-file "persist")
   "The location of persist directory.")
@@ -211,39 +213,11 @@ (defun persist-equal (a b)
              t))
     (equal a b)))
 
-(defun persist-copy-tree (tree &optional vectors-and-records)
-  "Make a copy of TREE.
-If TREE is a cons cell, this recursively copies both its car and its cdr.
-Contrast to `copy-sequence', which copies only along the cdrs.
-With the second argument VECTORS-AND-RECORDS non-nil, this
-traverses and copies vectors and records as well as conses."
-  (declare (side-effect-free error-free))
-  (if (consp tree)
-      (let (result)
-	(while (consp tree)
-	  (let ((newcar (car tree)))
-	    (if (or (consp (car tree))
-                    (and vectors-and-records
-                         (or (vectorp (car tree)) (recordp (car tree)))))
-		(setq newcar (persist-copy-tree (car tree) vectors-and-records)))
-	    (push newcar result))
-	  (setq tree (cdr tree)))
-	(nconc (nreverse result)
-               (if (and vectors-and-records (or (vectorp tree) (recordp tree)))
-                   (persist-copy-tree tree vectors-and-records)
-                 tree)))
-    (if (and vectors-and-records (or (vectorp tree) (recordp tree)))
-	(let ((i (length (setq tree (copy-sequence tree)))))
-	  (while (>= (setq i (1- i)) 0)
-	    (aset tree i (persist-copy-tree (aref tree i) vectors-and-records)))
-	  tree)
-      tree)))
-
 (defun persist-copy (obj)
   "Return copy of OBJ."
   (if (hash-table-p obj)
       (copy-hash-table obj)
-    (persist-copy-tree obj t)))
+    (compat-call copy-tree obj t)))
 
 (provide 'persist)
 ;;; persist.el ends here
-- 
2.46.0


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75188; Package emacs. Full text available.

Message received at 75188 <at> debbugs.gnu.org:


Received: (at 75188) by debbugs.gnu.org; 18 Jan 2025 09:12:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 18 04:12:20 2025
Received: from localhost ([127.0.0.1]:40126 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tZ4sN-0000dK-Qz
	for submit <at> debbugs.gnu.org; Sat, 18 Jan 2025 04:12:20 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:56822)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tZ4sL-0000d7-As
 for 75188 <at> debbugs.gnu.org; Sat, 18 Jan 2025 04:12:18 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1tZ4sE-0001WD-Uh; Sat, 18 Jan 2025 04:12:10 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=LFFwQyjuI3Nee+iH1qYAnv/OqTQn2EnQbITazwEZ+S0=; b=MoC/WibHZhKn
 5lutUFbtmC1dPYBhjC121oqrkOy2KEvAfUgh4qoRaXYR0t2Peig0NCLzyLC7DkruNx0IuWfDodDJA
 vg8VcUKDrsnnjSpBmIKRBEikCD8XjQhDg+ZfczJJuIG7tX2iB6MAxhLTe72k7s/8GsUN91qqS/qSM
 Pl42CJRzj31U2rDPWV7yvhVPXbFwiDpRzRqRGEAUC2ppw5ClTYxu7VyA4S5heFPwTnqLOGmw77stw
 NCCZbzKBlOncleeJBMXn4VXcEHN10ndvt8ITRgJgaPTa6eiooJj1aGCHksNg6e58hcI+z0yCgNYj/
 5QHEKvnkm/+GbpAAr2LYwg==;
Date: Sat, 18 Jan 2025 11:11:48 +0200
Message-Id: <86a5bocwq3.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Joseph Turner <joseph@HIDDEN>
In-Reply-To: <87y0zv7b9r.fsf@HIDDEN> (message from Joseph Turner
 on Tue, 31 Dec 2024 14:12:00 -0800)
Subject: Re: bug#75188: persist.el should recursively copy hash tables
References: <87wmfhk0bp.fsf@HIDDEN>
 <87y0zv7b9r.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 75188
Cc: yantar92@HIDDEN, mail@HIDDEN, monnier@HIDDEN,
 75188 <at> debbugs.gnu.org, adam@HIDDEN, phillip.lord@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Joseph Turner <joseph@HIDDEN>
> Cc:  Daniel Mendler <mail@HIDDEN>,
> 	Ihor Radchenko <yantar92@HIDDEN>,
> 	Stefan Monnier <monnier@HIDDEN>,
> 	Adam Porter <adam@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>,
> 	phillip.lord@HIDDEN
> Date: Tue, 31 Dec 2024 14:12:00 -0800
> 
> > Hello!
> >
> > This patch demonstrates a bug in persist.el
> 
> [...]
> 
> This issue also relates to the bug#63513, in which the suggestion was
> made to replace persist-copy-tree with (compat-call copy-tree) now that
> Compat 30 is available:
> 
> https://yhetil.org/emacs-bugs/80479897-500e-fe60-6586-0a44ccb5993b@HIDDEN/

Thanks, would you like to submit a patch along those lines?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75188; Package emacs. Full text available.
Added tag(s) patch. Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 75188 <at> debbugs.gnu.org:


Received: (at 75188) by debbugs.gnu.org; 31 Dec 2024 22:12:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 31 17:12:44 2024
Received: from localhost ([127.0.0.1]:37000 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tSkTk-0003bg-CA
	for submit <at> debbugs.gnu.org; Tue, 31 Dec 2024 17:12:44 -0500
Received: from out-176.mta0.migadu.com ([91.218.175.176]:30788)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1tSkTh-0003bT-Nk
 for 75188 <at> debbugs.gnu.org; Tue, 31 Dec 2024 17:12:42 -0500
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1735683125;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=6qdyhzZhWAcGJs7JXmSDxaDA6O+a30kjBpILMFn7Bl8=;
 b=BXv8p34mKSQvLiFkLKxKD6NoEcs2umVbfYXQmMhneppuu5hjuMTh9SLI8v4LnH4TqFFUkZ
 FasqOptzEZtYaJOirXwKUFR5SqSlloSG170roiOLRHo2bulO1agPaXXCev2mqgrBt3W1ej
 Wsk1DqhyqkMGThm81vX9wcYYjCW5ST8=
From: Joseph Turner <joseph@HIDDEN>
To: 75188 <at> debbugs.gnu.org
Subject: Re: bug#75188: persist.el should recursively copy hash tables
In-Reply-To: <87wmfhk0bp.fsf@HIDDEN> (Joseph Turner via's
 message of "Mon, 30 Dec 2024 01:05:30 -0800")
References: <87wmfhk0bp.fsf@HIDDEN>
Date: Tue, 31 Dec 2024 14:12:00 -0800
Message-ID: <87y0zv7b9r.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Migadu-Flow: FLOW_OUT
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 75188
Cc: Ihor Radchenko <yantar92@HIDDEN>,
 Daniel Mendler <mail@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>, Adam Porter <adam@HIDDEN>,
 Eli Zaretskii <eliz@HIDDEN>, phillip.lord@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> Hello!
>
> This patch demonstrates a bug in persist.el

[...]

This issue also relates to the bug#63513, in which the suggestion was
made to replace persist-copy-tree with (compat-call copy-tree) now that
Compat 30 is available:

https://yhetil.org/emacs-bugs/80479897-500e-fe60-6586-0a44ccb5993b@HIDDEN/




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75188; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 30 Dec 2024 09:05:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 30 04:05:59 2024
Received: from localhost ([127.0.0.1]:57286 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tSBio-00058Z-Tp
	for submit <at> debbugs.gnu.org; Mon, 30 Dec 2024 04:05:59 -0500
Received: from lists.gnu.org ([209.51.188.17]:46572)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joseph@HIDDEN>) id 1tSBim-00058R-L0
 for submit <at> debbugs.gnu.org; Mon, 30 Dec 2024 04:05:57 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <joseph@HIDDEN>)
 id 1tSBil-0006HM-6H
 for bug-gnu-emacs@HIDDEN; Mon, 30 Dec 2024 04:05:55 -0500
Received: from out-170.mta1.migadu.com ([95.215.58.170])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <joseph@HIDDEN>)
 id 1tSBid-0006ZS-Ho
 for bug-gnu-emacs@HIDDEN; Mon, 30 Dec 2024 04:05:53 -0500
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; 
 s=key1; t=1735549540;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type;
 bh=ibYSrThdKKkAyY/WdeU9vIR/UBxXqIy4KzC2voBYptk=;
 b=M/wlQR6EHmTL7YT+Oo7r3sMEAdOdjKUU6NsdQ/WxnLVMBq4TMsIv1g12Tj+gmVz+R+IVNF
 OfhO9fCyHOLnNbF3c8h04y0DmFHLJGs+L6b4R+szvwhZcHrcalIlZoCJDgM03RYdtZx/+Y
 FGyFgCI86nYi+iP17jJvVxWD9ZvdqHM=
From: Joseph Turner <joseph@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: persist.el should recursively copy hash tables
X-Debbugs-Cc: Adam Porter <adam@HIDDEN>
Date: Mon, 30 Dec 2024 01:05:30 -0800
Message-ID: <87wmfhk0bp.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Migadu-Flow: FLOW_OUT
Received-SPF: pass client-ip=95.215.58.170;
 envelope-from=joseph@HIDDEN; helo=out-170.mta1.migadu.com
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
 RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

--=-=-=
Content-Type: text/plain

Hello!

This patch demonstrates a bug in persist.el, which may be the cause of
https://github.com/alphapapa/activities.el/issues/109 and a similar bug
in hyperdrive.el which causes the `persist' variable file to be deleted.
We have not yet found a way to reproduce the bug in either activities.el
or hyperdrive.el, so this `persist' bug may be unrelated.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0001-Test-that-persist-copy-recursively-copies-hash-table.patch

From c28644c957d9fabf883990ff145cec19ed12ff10 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@HIDDEN>
Date: Mon, 30 Dec 2024 00:40:33 -0800
Subject: [PATCH] Test that persist-copy recursively copies hash tables

---
 test/persist-tests.el | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/test/persist-tests.el b/test/persist-tests.el
index 6bf2ed3708..adf37a5bf0 100644
--- a/test/persist-tests.el
+++ b/test/persist-tests.el
@@ -151,3 +151,14 @@ (ert-deftest test-persist-reset ()
      (should-not (eq persist--test-reset-variable initial-value))
      (should-not (eq initial-value
                      (persist-default 'persist--test-reset-variable))))))
+
+(ert-deftest test-persist-copy-hash-table ()
+  "`persist-copy' should copy hash keys and values."
+  (let* ((hash (make-hash-table))
+         (rec (record 'a))
+         (_ (puthash 'foo rec hash))
+         (copy-hash (persist-copy hash)))
+    (setf (aref (gethash 'foo copy-hash) 0) 'b)
+    (should-not (persist-equal hash copy-hash))
+    (should-not (eq (gethash 'foo hash)
+                    (gethash 'foo copy-hash)))))
-- 
2.46.0


--=-=-=
Content-Type: text/plain


IIUC, the solution requires rewriting `persist-copy-tree' (which is
copied from Emacs 30's `copy-tree') so that it handles hash tables.  If
you all agree, I can do this in `persist.el`.

However, would it make sense for `copy-tree' to handle hash tables?

Forgive me if this has been discussed and settled before.  I did find
this thread about comparing hash tables with `equal':

https://yhetil.org/emacs-devel/871qvz4kdw.fsf@localhost/

Thank you!

Joseph

--=-=-=--




Acknowledgement sent to Joseph Turner <joseph@HIDDEN>:
New bug report received and forwarded. Copy sent to adam@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to adam@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#75188; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 13 Feb 2025 10:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.