From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.bugs Subject: bug#29220: 26.0.90; eieio-persistent-read fail to restore saved object. Date: Thu, 28 Dec 2017 10:44:45 -0800 Message-ID: <87wp16y9nm.fsf@ericabrahamsen.net> References: <87y3nga0lv.fsf@killashandra.ballybran.fr> <87h8t8is1u.fsf@ericabrahamsen.net> <87zi6zmzh7.fsf@killashandra.ballybran.fr> <87h8t69d7b.fsf@ericabrahamsen.net> <87609lcbip.fsf@ericabrahamsen.net> <87bmjcc2rh.fsf@ericabrahamsen.net> <874lp4aije.fsf@ericabrahamsen.net> <83po7pwlgs.fsf@gnu.org> <87lgib4z2o.fsf@ericabrahamsen.net> <87wp1rcz21.fsf@users.sourceforge.net> <87mv2jkaap.fsf@killashandra.ballybran.fr> <87wp1nsk52.fsf@killashandra.ballybran.fr> <87k1xjke54.fsf@ericabrahamsen.net> <87bmit45je.fsf@ericabrahamsen.net> <87tvwk253j.fsf@ericabrahamsen.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1514486718 9200 195.159.176.226 (28 Dec 2017 18:45:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 28 Dec 2017 18:45:18 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Pierre =?UTF-8?Q?T=C3=A9choueyres?= , 29220@debbugs.gnu.org, "Eric M. Ludlam" , Stefan Monnier , Noam Postavsky To: Eric Ludlam Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Dec 28 19:45:13 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eUdB0-0001r5-BC for geb-bug-gnu-emacs@m.gmane.org; Thu, 28 Dec 2017 19:45:10 +0100 Original-Received: from localhost ([::1]:33865 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eUdCz-0000mt-29 for geb-bug-gnu-emacs@m.gmane.org; Thu, 28 Dec 2017 13:47:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58997) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eUdCr-0000mb-VA for bug-gnu-emacs@gnu.org; Thu, 28 Dec 2017 13:47:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eUdCo-0006Rj-QN for bug-gnu-emacs@gnu.org; Thu, 28 Dec 2017 13:47:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:46777) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eUdCo-0006RE-Jm for bug-gnu-emacs@gnu.org; Thu, 28 Dec 2017 13:47:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eUdCo-0005Q5-5g for bug-gnu-emacs@gnu.org; Thu, 28 Dec 2017 13:47:02 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <87y3nga0lv.fsf@killashandra.ballybran.fr> Resent-From: Eric Abrahamsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 28 Dec 2017 18:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29220 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 29220-submit@debbugs.gnu.org id=B29220.151448680820815 (code B ref 29220); Thu, 28 Dec 2017 18:47:02 +0000 Original-Received: (at 29220) by debbugs.gnu.org; 28 Dec 2017 18:46:48 +0000 Original-Received: from localhost ([127.0.0.1]:55458 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eUdCa-0005Pe-H8 for submit@debbugs.gnu.org; Thu, 28 Dec 2017 13:46:48 -0500 Original-Received: from mail.ericabrahamsen.net ([50.56.99.223]:51410) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eUdCX-0005PV-7z for 29220@debbugs.gnu.org; Thu, 28 Dec 2017 13:46:45 -0500 Original-Received: from localhost (71-212-75-109.tukw.qwest.net [71.212.75.109]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id 46370C0733; Thu, 28 Dec 2017 18:46:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.ericabrahamsen.net; s=mail; t=1514486804; bh=0ThlrxCdb62L2K5pT1TD1Ntx25JQ2IGKeR9HJ1Ugr+s=; h=From:To:Cc:Subject:References:Date:From; b=s09VIcAcWMCcqcFR0sXwBRlyMA2wSLC4Sq7F/mYbeNr09GW2FdRTMgZxq1mROd8Zj Lxg08Fb0EkgSRqrYbVucXe1JvVL8sMO+XracVlRZEB3qS4QX2z0OOzWZWSKVDuWUpF 2NGQKAC6oigpUPX2VuJH8EwmrXCLQqtMQq6UMEAY= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:141579 Archived-At: On 12/23/17 21:18 PM, Eric Ludlam wrote: > On 12/20/2017 09:21 PM, Eric Abrahamsen wrote: >> On 12/20/17 15:54 PM, Stefan Monnier wrote: >>>> As for the quoting thing, my current idea is to not add quotes to lists >>>> when writing, then strip quotes on restore, if the car of the list is a >>>> valid class symbol then try to restore an object, but wrap in >>>> `condition-case' and return the plain list if an error is raised. >>> I recommend you ask the opinion of Eric M. Ludlam >>> (the original author of that code). >> Okay! >> >> Eric, I'm dragging you into this because we're having a little trouble >> with the eieio persistence functionality. Sorry... >> >> In Emacs 26 objects are implemented using records, which (long story >> short) means that their representations from `prin1' are no longer >> reconstructable using `read', which is causing problems for >> eieio-persistent. > Hey, thanks for checking in. > > I know a bunch of eieio was re-written to be faster and better, but I > haven't been keeping up with the latest version.=C2=A0 For mysterious > reasons, Ubuntu is still on Emacs 24 so I'm still on the old stuff. >> The current persistence read/write process basically only handles >> top-level slot values. It looks at the value, does one of the following: >> >> 1. Writes an object using `object-write' >> 2. Writes a list of objects using a "list" plus `object-write' >> 3. Quotes a list and prints it >> 4. Prints value directly >> >> If objects are inside lists, hash tables, or vectors (or anything else), >> they are not written using `object-write'. This used to not be a problem >> because their `prin1' representation was still readable. >> >> This is no longer the case, which leads to failure for libraries that >> put objects inside other data structures. > > The original purpose of object-write on eieio objects was to prevent > circular references which kept popping up in EDE and SemanticDB. The first > version just dumped the old raw vector.=C2=A0 That's one of the reasons w= hy it > doesn't try to be pedantic about carefully going down through every list. > It only had to deal with EDE and Semantic classes. Thanks for the response! It's good to have a bit of background. Would you mind pointing me in the direction of some tests or other code that I can use to make sure the temporary fix works for CEDET and family? It seems likely that what will happen for Emacs 26 is that I'll do a limited set of fixes to ensure that no major packages break, and then try to come up with a more comprehensive solution for Emacs 27. Right now I've got tests aimed at pcache and the Gnus registry, but I'd like to make sure EDE and Semantic work correctly, as well. >> My feeling is that both the write and restore process should walk the >> entire tree of whatever object is being written. The write process >> should turn objects into list representations, nothing more. The restore >> process should restore objects, and strip strings of properties (I've >> got the outline of this in bug#29541), and nothing more. If the restore >> process was destructive, it would save some consing. > I think that makes sense.=C2=A0 I was definitely taking short-cuts in let= ting > lists write themselves b/c I was lazy.=C2=A0 Based on what you describe, = it > probably makes sense to walk entire structures and write each step. > > It might be even better if that was a core Emacs feature, and not somethi= ng > specific to a simple eieio utility base class.=C2=A0 :) Coincidentally, John Wiegley posted a possible generic structure-walking function (called "traverse") to this list not too long ago. [...] > For example, you might say that any list that starts with a class > symbol is an > object and everything else is data.=C2=A0 Of course, then you can't have a > list of > class symbols, and definitely need to avoid having classes with simple > names. [...] > Don't forget that objects can execute code in their 'object-write' to > convert > an inconvenient data structure into something simple, and in the construc= tor > convert it back again. > > For example, have a slot with the hash table be non-savable (no :initarg). > In the object-write, convert the hash table into a simple flat list on > a different slot with an :initarg. > > On load, copy the content of the :initarg slot back into your hash table. > > In this way, you may be able to have the 2 examples avoid having any > problems > with the current system in E26. > > Not that I don't know what the real issues are.=C2=A0 I'm just tossing so= me > options out > there. Okay, thanks very much for these responses. I've got some ideas about the full fix, and will work on those in a separate bug report. Thanks again, Eric