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: Wed, 20 Dec 2017 18:21:36 -0800 Message-ID: <87tvwk253j.fsf@ericabrahamsen.net> References: <87y3nga0lv.fsf@killashandra.ballybran.fr> <87lgimpdhp.fsf@ericabrahamsen.net> <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> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1513822819 25724 195.159.176.226 (21 Dec 2017 02:20:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 21 Dec 2017 02:20:19 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 29220@debbugs.gnu.org, "Eric M. Ludlam" , Pierre =?UTF-8?Q?T=C3=A9choueyres?= , Noam Postavsky To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Dec 21 03:20:14 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 1eRqT0-0006K8-52 for geb-bug-gnu-emacs@m.gmane.org; Thu, 21 Dec 2017 03:20:14 +0100 Original-Received: from localhost ([::1]:53714 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRqUy-0007M4-DW for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Dec 2017 21:22:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52648) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRqUp-0007KH-0u for bug-gnu-emacs@gnu.org; Wed, 20 Dec 2017 21:22:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRqUk-0008Ch-2v for bug-gnu-emacs@gnu.org; Wed, 20 Dec 2017 21:22:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36359) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRqUj-0008CU-VL for bug-gnu-emacs@gnu.org; Wed, 20 Dec 2017 21:22:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eRqUj-000255-L5 for bug-gnu-emacs@gnu.org; Wed, 20 Dec 2017 21:22:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eric Abrahamsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Dec 2017 02:22:01 +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: fixed Original-Received: via spool by 29220-submit@debbugs.gnu.org id=B29220.15138229007973 (code B ref 29220); Thu, 21 Dec 2017 02:22:01 +0000 Original-Received: (at 29220) by debbugs.gnu.org; 21 Dec 2017 02:21:40 +0000 Original-Received: from localhost ([127.0.0.1]:45040 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRqUN-00024X-WD for submit@debbugs.gnu.org; Wed, 20 Dec 2017 21:21:40 -0500 Original-Received: from mail.ericabrahamsen.net ([50.56.99.223]:34675) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRqUM-00024O-BW for 29220@debbugs.gnu.org; Wed, 20 Dec 2017 21:21:38 -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 4AC72C06C3; Thu, 21 Dec 2017 02:21:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.ericabrahamsen.net; s=mail; t=1513822897; bh=OgGtnixCTCDrxEHWVYQNI6mGRlXyJVwRKpE2PrpfsA0=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=nV/ups/CfNMcVwaVvj0o69gaeQgjDUN8JkVrq04VWQz4/npgEbH7ojo1MkmJqqUvJ T1RA1V8gfrTXnukH6+9wss67EduxWw3td/Qxwg+gT5y+CfbTr9vZAAC8qDfr8KN2bm /ru2wE/OXg0zOyZ6MyJAkNHBc8e2G9ZfxYl2tF/I= In-Reply-To: (Stefan Monnier's message of "Wed, 20 Dec 2017 15:54:26 -0500") 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:141319 Archived-At: 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. 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. In this bug report I tried to do a simple fix for pcache, by looking for objects inside hash tables and vectors, and using `object-write' for them, too. That works (though it only goes one layer deeper), but it caused new bugs in the Gnus registry, because now lists inside hash tables are quoted, but not un-quoted during the restore process. The persistence process is fundamentally only set up to do single-layer processing of objects and their slot values. Probably, people are going to continue to use eieio-persistent for more complex things (it's only luck that I didn't run into trouble with EBDB), and I think eieio-persistent should be able to handle whatever gets thrown at it. 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. Three items for consideration: 1. What do you think about the above proposal? Have you had some ideas in this direction already? 2. Stefan pointed out that, if we don't quote lists, there's a potential ambiguity during restore time between lists that are lists, and lists that represent an object. Do you have any thoughts about this? 3. Emacs 26 is looming, and our current solutions either break pcache, or break the Gnus registry. We might want to do a stop-gap for Emacs 26, and a more complete fix for master/27. Sorry if I've over-explained, I'm using this opportunity to continue thinking about the problem. Eric