From unknown Sat Jun 21 12:22:13 2025 X-Loop: help-debbugs@gnu.org Subject: bug#75780: persist-defvar symbol bound before definition, causing data loss Resent-From: Joseph Turner Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Jan 2025 07:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 75780 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 75780@debbugs.gnu.org Cc: Adam Porter X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.173761845724084 (code B ref -1); Thu, 23 Jan 2025 07:48:01 +0000 Received: (at submit) by debbugs.gnu.org; 23 Jan 2025 07:47:37 +0000 Received: from localhost ([127.0.0.1]:38997 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tarw9-0006GO-7N for submit@debbugs.gnu.org; Thu, 23 Jan 2025 02:47:37 -0500 Received: from lists.gnu.org ([2001:470:142::17]:32776) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tarw6-0006Fv-Up for submit@debbugs.gnu.org; Thu, 23 Jan 2025 02:47:35 -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 ) id 1tarvs-0007Ul-C9 for bug-gnu-emacs@gnu.org; Thu, 23 Jan 2025 02:47:29 -0500 Received: from out-178.mta0.migadu.com ([2001:41d0:1004:224b::b2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tarvq-0003TZ-5V for bug-gnu-emacs@gnu.org; Thu, 23 Jan 2025 02:47:20 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; s=key1; t=1737618430; 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; bh=ALV93ilclNfpiisYYSJr/1IdXSjz5QKaYdmCJTNAFXg=; b=JFl/j9+gSS4OU4FT/XxWR9Vgj42/K8za0fgFDQ/RtHloWEKz1kBoO2XfaqlQAej/N++XuE /ckW4LOPso8FIXFCr2XES38fYM2kicBS1T+B31sZSE1FAyTHnVMMPQOj1ikba6+Nn1O+jA dS5B6Eh9E+DdNM+YO+DFgjAgrRCv7fk= From: Joseph Turner Date: Wed, 22 Jan 2025 23:47:06 -0800 Message-ID: <87jzamottx.fsf@breatheoutbreathe.in> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:1004:224b::b2; envelope-from=joseph@breatheoutbreathe.in; helo=out-178.mta0.migadu.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) --=-=-= Content-Type: text/plain This bug report was previously submitted as bug#75684, but it appears to have been lost by the mailing list. Here it is again: Variables defined with persist-defvar which have persisted values are sometimes bound to their persisted values before the package is loaded. persist-defvar then incorrectly sets the symbol's persist-default property to its persisted value, which then causes the persist value to sometimes be deleted. The bug in the wild: https://github.com/alphapapa/activities.el/issues/109 I am able to reproduce this issue on Emacs 29.4: --8<---------------cut here---------------start------------->8--- rm -rf /tmp/test-persist-issue/ mkdir /tmp/test-persist-issue cat > /tmp/test-persist-issue/init.el <8--- Wait for Emacs to install test-persist-issue.el and persist.el, then: --8<---------------cut here---------------start------------->8--- (progn (require 'test-persist-issue) (setf test-persist-issue 'foo) (persist-save 'test-persist-issue) (kill-emacs)) --8<---------------cut here---------------end--------------->8--- /tmp/test-persist-issue/persist/test-persist-issue now exists as expected. Now run: --8<---------------cut here---------------start------------->8--- rm -rf /tmp/test-persist-issue/elpa/ emacs --init-directory=/tmp/test-persist-issue/ --8<---------------cut here---------------end--------------->8--- Wait for installation again, then evaluate: --8<---------------cut here---------------start------------->8--- (progn ;; (persist-default 'test-persist-issue) ;; foo (should be nil) (persist-save 'test-persist-issue)) --8<---------------cut here---------------end--------------->8--- The second time Emacs is opened, just before the call to persist-defvar in activities.el, the test-persist-issue variable is already bound to the persisted value, which results in the persisted value being incorrectly set as the default. Why is the persist variable bound before the persist-defvar form? This example uses package-vc for the sake of reliable bug reproduction, but the issue also exists with package.el, as in the Github report. Thank you! Joseph P.S. The linked git.sr.ht repo contains two files, both of which appear to be necessary to reproduce the issue. For the sake of future bug reproduction, I have attached both files to this email: --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=test-persist-issue.el Content-Transfer-Encoding: quoted-printable ;;; test-persist-issue.el -*- lexical-binding: t; -*- ;; Version: 0.1-pre ;; Package-Requires: ((persist "0.6")) (require 'persist) (persist-defvar test-persist-issue nil "Docstring.") (provide 'test-persist-issue) --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=test-persist-issue-other-file.el Content-Transfer-Encoding: quoted-printable ;;; test-persist-issue-other-file.el -*- lexical-binding: t; -*- (require 'test-persist-issue) test-persist-issue (provide 'test-persist-issue-other-file) --=-=-=-- From unknown Sat Jun 21 12:22:13 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Joseph Turner Subject: bug#75780: closed (Re: bug#75780: Acknowledgement (persist-defvar symbol bound before definition, causing data loss)) Message-ID: References: <87bjvyotez.fsf@breatheoutbreathe.in> <87jzamottx.fsf@breatheoutbreathe.in> X-Gnu-PR-Message: they-closed 75780 X-Gnu-PR-Package: emacs Reply-To: 75780@debbugs.gnu.org Date: Thu, 23 Jan 2025 07:57:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1737619022-25929-1" This is a multi-part message in MIME format... ------------=_1737619022-25929-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #75780: persist-defvar symbol bound before definition, causing data loss which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 75780@debbugs.gnu.org. --=20 75780: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D75780 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1737619022-25929-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 75780-done) by debbugs.gnu.org; 23 Jan 2025 07:56:23 +0000 Received: from localhost ([127.0.0.1]:39026 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tas4c-0006j0-V1 for submit@debbugs.gnu.org; Thu, 23 Jan 2025 02:56:23 -0500 Received: from out-185.mta0.migadu.com ([91.218.175.185]:21313) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tas4Z-0006ib-QW for 75780-done@debbugs.gnu.org; Thu, 23 Jan 2025 02:56:20 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; s=key1; t=1737618968; 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=6WHzvRpeZh6bCFm6g17mnnbSteUz5GwLPjFdDlvUqjA=; b=FshA/2skdQ0jApLuzvsZNtGGLnZDWSfBFILodq5ZzgFdW7cCz3mR08HDD9DIAez+FUTMSG nwHEebAhDRRDdoA+vAfzrkzBUgN8nTzfs54hZ2d0QO+ANMj0k/O8852b4ZwT6QRuRiYAN4 ZbDFOasoYtw49zDhGzE7/82hLurI/4c= From: Joseph Turner To: help-debbugs@gnu.org (GNU bug Tracking System) Subject: Re: bug#75780: Acknowledgement (persist-defvar symbol bound before definition, causing data loss) In-Reply-To: (GNU bug Tracking System's message of "Thu, 23 Jan 2025 07:48:02 +0000") References: <87jzamottx.fsf@breatheoutbreathe.in> Date: Wed, 22 Jan 2025 23:56:04 -0800 Message-ID: <87bjvyotez.fsf@breatheoutbreathe.in> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 75780-done Cc: 75780-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Duplicate of bug#75779. Sorry for the noise. help-debbugs@gnu.org (GNU bug Tracking System) writes: > Thank you for filing a new bug report with debbugs.gnu.org. > > This is an automatically generated reply to let you know your message > has been received. > > Your message is being forwarded to the package maintainers and other > interested parties for their attention; they will reply in due course. > > Your message has been sent to the package maintainer(s): > bug-gnu-emacs@gnu.org > > If you wish to submit further information on this problem, please > send it to 75780@debbugs.gnu.org. > > Please do not send mail to help-debbugs@gnu.org unless you wish > to report a problem with the Bug-tracking system. ------------=_1737619022-25929-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 23 Jan 2025 07:47:37 +0000 Received: from localhost ([127.0.0.1]:38997 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tarw9-0006GO-7N for submit@debbugs.gnu.org; Thu, 23 Jan 2025 02:47:37 -0500 Received: from lists.gnu.org ([2001:470:142::17]:32776) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tarw6-0006Fv-Up for submit@debbugs.gnu.org; Thu, 23 Jan 2025 02:47:35 -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 ) id 1tarvs-0007Ul-C9 for bug-gnu-emacs@gnu.org; Thu, 23 Jan 2025 02:47:29 -0500 Received: from out-178.mta0.migadu.com ([2001:41d0:1004:224b::b2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tarvq-0003TZ-5V for bug-gnu-emacs@gnu.org; Thu, 23 Jan 2025 02:47:20 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; s=key1; t=1737618430; 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; bh=ALV93ilclNfpiisYYSJr/1IdXSjz5QKaYdmCJTNAFXg=; b=JFl/j9+gSS4OU4FT/XxWR9Vgj42/K8za0fgFDQ/RtHloWEKz1kBoO2XfaqlQAej/N++XuE /ckW4LOPso8FIXFCr2XES38fYM2kicBS1T+B31sZSE1FAyTHnVMMPQOj1ikba6+Nn1O+jA dS5B6Eh9E+DdNM+YO+DFgjAgrRCv7fk= From: Joseph Turner To: bug-gnu-emacs@gnu.org Subject: persist-defvar symbol bound before definition, causing data loss Date: Wed, 22 Jan 2025 23:47:06 -0800 Message-ID: <87jzamottx.fsf@breatheoutbreathe.in> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:1004:224b::b2; envelope-from=joseph@breatheoutbreathe.in; helo=out-178.mta0.migadu.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit Cc: Adam Porter X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) --=-=-= Content-Type: text/plain This bug report was previously submitted as bug#75684, but it appears to have been lost by the mailing list. Here it is again: Variables defined with persist-defvar which have persisted values are sometimes bound to their persisted values before the package is loaded. persist-defvar then incorrectly sets the symbol's persist-default property to its persisted value, which then causes the persist value to sometimes be deleted. The bug in the wild: https://github.com/alphapapa/activities.el/issues/109 I am able to reproduce this issue on Emacs 29.4: --8<---------------cut here---------------start------------->8--- rm -rf /tmp/test-persist-issue/ mkdir /tmp/test-persist-issue cat > /tmp/test-persist-issue/init.el <8--- Wait for Emacs to install test-persist-issue.el and persist.el, then: --8<---------------cut here---------------start------------->8--- (progn (require 'test-persist-issue) (setf test-persist-issue 'foo) (persist-save 'test-persist-issue) (kill-emacs)) --8<---------------cut here---------------end--------------->8--- /tmp/test-persist-issue/persist/test-persist-issue now exists as expected. Now run: --8<---------------cut here---------------start------------->8--- rm -rf /tmp/test-persist-issue/elpa/ emacs --init-directory=/tmp/test-persist-issue/ --8<---------------cut here---------------end--------------->8--- Wait for installation again, then evaluate: --8<---------------cut here---------------start------------->8--- (progn ;; (persist-default 'test-persist-issue) ;; foo (should be nil) (persist-save 'test-persist-issue)) --8<---------------cut here---------------end--------------->8--- The second time Emacs is opened, just before the call to persist-defvar in activities.el, the test-persist-issue variable is already bound to the persisted value, which results in the persisted value being incorrectly set as the default. Why is the persist variable bound before the persist-defvar form? This example uses package-vc for the sake of reliable bug reproduction, but the issue also exists with package.el, as in the Github report. Thank you! Joseph P.S. The linked git.sr.ht repo contains two files, both of which appear to be necessary to reproduce the issue. For the sake of future bug reproduction, I have attached both files to this email: --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=test-persist-issue.el Content-Transfer-Encoding: quoted-printable ;;; test-persist-issue.el -*- lexical-binding: t; -*- ;; Version: 0.1-pre ;; Package-Requires: ((persist "0.6")) (require 'persist) (persist-defvar test-persist-issue nil "Docstring.") (provide 'test-persist-issue) --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=test-persist-issue-other-file.el Content-Transfer-Encoding: quoted-printable ;;; test-persist-issue-other-file.el -*- lexical-binding: t; -*- (require 'test-persist-issue) test-persist-issue (provide 'test-persist-issue-other-file) --=-=-=-- ------------=_1737619022-25929-1--