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#28489: Acknowledgement (27.0.50; eieio-persistent slot type validation should be a bit smarter) Date: Wed, 27 Sep 2017 22:02:58 -0700 Message-ID: <87zi9fxvnh.fsf@ericabrahamsen.net> References: <87lglcn8dt.fsf@ericabrahamsen.net> <878th1i50l.fsf@ericabrahamsen.net> <87wp4lf1kq.fsf@users.sourceforge.net> <87ing4cd04.fsf@ericabrahamsen.net> <87h8vnftnx.fsf@users.sourceforge.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1506575053 4941 195.159.176.226 (28 Sep 2017 05:04:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 28 Sep 2017 05:04:13 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.60 (gnu/linux) To: 28489@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Sep 28 07:04:08 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 1dxQzV-0000mJ-Cf for geb-bug-gnu-emacs@m.gmane.org; Thu, 28 Sep 2017 07:04:05 +0200 Original-Received: from localhost ([::1]:57411 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxQzc-00038N-Ku for geb-bug-gnu-emacs@m.gmane.org; Thu, 28 Sep 2017 01:04:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34369) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxQzW-000389-DH for bug-gnu-emacs@gnu.org; Thu, 28 Sep 2017 01:04:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dxQzS-00006o-EQ for bug-gnu-emacs@gnu.org; Thu, 28 Sep 2017 01:04:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55325) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dxQzS-00006e-BV for bug-gnu-emacs@gnu.org; Thu, 28 Sep 2017 01:04:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dxQzS-00008J-3A for bug-gnu-emacs@gnu.org; Thu, 28 Sep 2017 01:04:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <87lglcn8dt.fsf@ericabrahamsen.net> Resent-From: Eric Abrahamsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 28 Sep 2017 05:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28489 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.1506575009474 (code B ref -1); Thu, 28 Sep 2017 05:04:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 28 Sep 2017 05:03:29 +0000 Original-Received: from localhost ([127.0.0.1]:35773 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dxQyv-00007Z-AS for submit@debbugs.gnu.org; Thu, 28 Sep 2017 01:03:29 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:43072) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dxQyu-00007N-0J for submit@debbugs.gnu.org; Thu, 28 Sep 2017 01:03:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dxQyn-0008KM-Ph for submit@debbugs.gnu.org; Thu, 28 Sep 2017 01:03:22 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:43480) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dxQyn-0008KD-Mk for submit@debbugs.gnu.org; Thu, 28 Sep 2017 01:03:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34034) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxQym-00035l-HL for bug-gnu-emacs@gnu.org; Thu, 28 Sep 2017 01:03:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dxQyi-0008Ie-Jr for bug-gnu-emacs@gnu.org; Thu, 28 Sep 2017 01:03:20 -0400 Original-Received: from [195.159.176.226] (port=47125 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dxQyi-0008I2-Du for bug-gnu-emacs@gnu.org; Thu, 28 Sep 2017 01:03:16 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dxQyX-0005Fg-EC for bug-gnu-emacs@gnu.org; Thu, 28 Sep 2017 07:03:05 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 46 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:Vz9BrIJ1V/nrMUE1LUjMUUPE1Vc= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x 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:137529 Archived-At: Noam Postavsky writes: [...] >> This whole section of code, `eieio-persistent-validate/fix-slot-value' >> and its neighbors, feels very seat-of-the-pants to me. I wish `cl-typep' >> could handle more of this work. But in the meantime this patch (or >> something like it) would at least address the actual bug. > > Hmm, to be honest I can't quite make out what this function is actually > being used for. It's basically a first pass at slot validation that is specific to the way eieio-persistent writes objects to disk. It can't write actual objects, obviously, so it writes object construction forms. Before the "real" validation happens in `eieio--perform-slot-validation', the persistent read process needs to make sure the construction forms will produce objects of the right class, then eval the forms. So if you've got a slot that's supposed to be of type (list-of foo), the persistence pre-validation looks at the value read from file, sees that it's (list (foo ...) (foo ...)), evals those construction forms, and then what the "real" validation ends up with is (cl-typep (list # #) '(list-of 'foo)), which passes. Essentially it is validating twice, both before and after the actual objects are created. I don't have a very firm grasp of all the code involved, but in principle I would prefer just to eval all object construction forms regardless, and then let it blow up at "real" validation time -- it was going to blow up anyway. Another option would be to make use of `eieio-skip-typecheck', which, if non-nil, could be interpreted as saying to skip all slot-related type checking, including in persistent object read. But again, my patch or something like it would be enough to get everything working as advertised. >> I don't think the tabs were my fault! What's Emacs policy on this? > > I believe the policy is that new code should use spaces (although > sometimes people ignore this, it's not a big deal), but don't touch > lines just for the sake of changing the whitespace. Good to know, thanks. In lines of code I've added, indentation will be done with spaces, but I suppose that's okay?