unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: Noam Postavsky <npostavs@users.sourceforge.net>
Cc: 29220@debbugs.gnu.org
Subject: bug#29220: 26.0.90; eieio-persistent-read fail to restore saved object.
Date: Sat, 18 Nov 2017 10:14:49 -0800	[thread overview]
Message-ID: <87h8trzc6e.fsf@ericabrahamsen.net> (raw)
In-Reply-To: <87efov1zzn.fsf@users.sourceforge.net> (Noam Postavsky's message of "Sat, 18 Nov 2017 08:24:28 -0500")

Noam Postavsky <npostavs@users.sourceforge.net> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> (Are you guys looking at a different version of the pcache repo? The one
>> on Github uses `constructor', not `make-instance'.)
>
> The version mentioned in #23:
>
>     I've put an branch (pte/emacs-26) on github
>     (https://github.com/PierreTechoueyres/pcache.git) with some tests that
>     you can launch with

Oops, I missed that.

[...]

>> But I still think the problem isn't in reading, it's in writing: the
>> entries in the hash table are being written incorrectly, and so this
>> validation step is exploding.
>
> Yes, the way structs and classes are encoded in emacs-26 changed, so the
> way they're written changed also.  It seems the round-tripping loses the
> class/type maybe?  I can still see the '44' entry in the hash table, so
> the hash table itself is still in there...

Here's what I think is going on:

(defclass person ()
  ((name :type string :initarg :name)))

(defclass classy (eieio-persistent)
  ((teacher
    :type person
    :initarg :teacher)
   (students
    :initarg :students :initform (make-hash-table))))

(setq jane (make-instance 'person :name "Jane"))
(setq bob (make-instance 'person :name "Bob"))

(setq class (make-instance 'classy
			   :teacher jane))
(puthash "Bob" bob (slot-value class 'students))

(object-write class) =>
(classy "classy-52080cc"
  :teacher
  (person "person-52080c4"
    :name "Jane")
  :students #s(hash-table size 65 test eql rehash-size 1.5
  rehash-threshold 0.8125 data ("Bob" #s(#s(eieio--class person nil nil
  [#s(cl-slot-descriptor name unbound string nil)] #s(hash-table size 65
  test eq rehash-size 1.5 rehash-threshold 0.8125 data (name 0)) nil
  ((:name . name)) [] [] #s(#2 unbound) (:custom-groups nil)) "Bob"))))

Jane is `read'-able, Bob isn't. `object-write' will recurse and use
`object-write' on any member objects, but the hashtable gets sent to
`prin1', which I assume uses `prin1' on all its values instead:

(object-write bob) =>
(person "person-482ca1c" :name "Bob")

(prin1 bob) =>
#s(#s(eieio--class person nil nil [#s(cl-slot-descriptor
name unbound string nil)] #s(hash-table size 65 test eq rehash-size 1.5
rehash-threshold 0.8125 data (name 0 ...)) nil ((:name . name)) [] []
#s(#1 unbound) (:custom-groups nil)) "Bob")

And I see I have yet again screwed up the changes to `object-write' in
master; off to fix that now.





  reply	other threads:[~2017-11-18 18:14 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-08 22:04 bug#29220: 26.0.90; eieio-persistent-read fail to restore saved object Pierre Téchoueyres
2017-11-08 22:48 ` Eric Abrahamsen
2017-11-10 17:31   ` Pierre Téchoueyres
2017-11-10 18:12     ` Eric Abrahamsen
2017-11-10 18:32       ` Pierre Téchoueyres
2017-11-12 19:10       ` Noam Postavsky
2017-11-14 22:30         ` Pierre Téchoueyres
2017-11-15  2:02           ` Noam Postavsky
2017-11-15 15:29             ` Stefan Monnier
2017-11-17 19:56               ` Pierre Téchoueyres
2017-11-18  3:40             ` Noam Postavsky
2017-11-18  4:39               ` Eric Abrahamsen
2017-11-18 13:24                 ` Noam Postavsky
2017-11-18 18:14                   ` Eric Abrahamsen [this message]
2017-11-19  3:17                     ` Noam Postavsky
2017-11-19  5:57                       ` Eric Abrahamsen
2017-11-23 23:20                       ` Pierre Téchoueyres
2017-11-24  0:09                         ` Noam Postavsky
2017-11-28 21:39                           ` Pierre Téchoueyres
2017-11-28 21:52                             ` Noam Postavsky
2017-11-28 22:18                               ` Pierre Téchoueyres
2017-11-29  1:09                                 ` Noam Postavsky
2017-11-29 15:18                                   ` Stefan Monnier
2017-11-28 22:10                             ` Eric Abrahamsen
2017-11-29 15:15                               ` Stefan Monnier
2017-12-01 17:25                                 ` Eric Abrahamsen
2017-12-01 17:55                                   ` Stefan Monnier
2017-12-03  0:17                                     ` Eric Abrahamsen
2017-12-03 18:35                                       ` Pierre Téchoueyres
2017-12-05  1:27                                         ` Eric Abrahamsen
2017-12-05  2:08                                           ` Stefan Monnier
2017-12-05 17:47                                             ` Eric Abrahamsen
2017-12-05 19:02                                               ` Stefan Monnier
2017-12-05 20:56                                                 ` Eric Abrahamsen
2017-12-05 22:14                                                   ` Stefan Monnier
2017-12-05 22:58                                                     ` Eric Abrahamsen
2017-12-08 10:41                                                       ` Eli Zaretskii
2017-12-09 16:59                                                         ` Eric Abrahamsen
2017-12-12 23:21                                                           ` Noam Postavsky
2017-12-15 20:26                                                             ` Pierre Téchoueyres
2017-12-15 22:26                                                               ` Pierre Téchoueyres
2017-12-16 23:42                                                                 ` Eric Abrahamsen
2018-02-20 19:50                                                                   ` Pierre Téchoueyres
2018-02-24 21:23                                                                     ` Eric Abrahamsen
2018-02-24 23:21                                                                       ` Pierre Téchoueyres
2018-02-24 23:40                                                                         ` Eric Abrahamsen
2018-02-25  0:34                                                                           ` Pierre Téchoueyres
2018-02-25 18:59                                                                             ` Eric Abrahamsen
2019-05-27 23:36                                                                               ` Noam Postavsky
2019-05-28 21:17                                                                                 ` Eric Abrahamsen
2019-05-30 22:50                                                                                 ` Noam Postavsky
2017-12-18 19:52                                                                 ` Eric Abrahamsen
2017-12-18 21:38                                                                   ` Stefan Monnier
2017-12-20 18:29                                                                     ` Eric Abrahamsen
2017-12-20 20:54                                                                       ` Stefan Monnier
2017-12-21  2:21                                                                         ` Eric Abrahamsen
2017-12-24  2:18                                                                           ` Eric Ludlam
2017-12-28 18:44                                                                             ` Eric Abrahamsen
2017-12-05 22:20                                                   ` Pierre Téchoueyres
2018-01-24 19:17                                                     ` Pierre Téchoueyres
2018-01-25  3:09                                                       ` Eric Abrahamsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h8trzc6e.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=29220@debbugs.gnu.org \
    --cc=npostavs@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).