From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] * src/eval.c: Stop checking for nvars, and use only CONSP Date: Tue, 02 Mar 2021 16:00:28 +0200 Message-ID: <831rcx7j0j.fsf@gnu.org> References: <20210302.111043.609653289571449353.conao3@gmail.com> <83ft1e6rjb.fsf@gnu.org> <20210302.161418.2185996023660309707.conao3@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28586"; mail-complaints-to="usenet@ciao.gmane.io" Cc: pipcet@gmail.com, emacs-devel@gnu.org To: Naoya Yamashita Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Mar 02 15:01:59 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lH5b5-0007Ig-0a for ged-emacs-devel@m.gmane-mx.org; Tue, 02 Mar 2021 15:01:59 +0100 Original-Received: from localhost ([::1]:52692 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lH5b2-0008JJ-PP for ged-emacs-devel@m.gmane-mx.org; Tue, 02 Mar 2021 09:01:58 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lH5Ze-0007s0-24 for emacs-devel@gnu.org; Tue, 02 Mar 2021 09:00:30 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:40667) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lH5Zd-00061i-Az; Tue, 02 Mar 2021 09:00:29 -0500 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:3934 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lH5Zc-0005zI-Gf; Tue, 02 Mar 2021 09:00:29 -0500 In-Reply-To: <20210302.161418.2185996023660309707.conao3@gmail.com> (message from Naoya Yamashita on Tue, 02 Mar 2021 16:14:18 +0900 (JST)) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:265828 Archived-At: > Date: Tue, 02 Mar 2021 16:14:18 +0900 (JST) > Cc: pipcet@gmail.com, emacs-devel@gnu.org > From: Naoya Yamashita > > I compared the two and found that the problem of crashing on > (if . "abc") crash problem was fixed in the former. > > However > > (let ((vars (list 'v)))) > (setcdr vars vars) > (eval (list let vars)))) > > and > > (let ((clauses (list '((progn (setcdr clauses "ouch")) nil))))) > (eval (cons 'cond clauses)))) > > did not crash. The circular list example became an infinite loop > in an older version of b3a3ed5 (even older changes to eval.c). > My change removed the list length checker, which is vulnerable to > list changes. Furthermore, Emacs with my patch passes these test > cases. > > My patched Emacs does not segfault the Pip example either. > > (let ((cons-cell '((a 2) (b 3)))) > (eval `(let ((x (setcdr ',cons-cell nil)) > . ,cons-cell) > (message "foo")))) > ;;=> foo > > Please let me know if there are any test cases I'm missing. I think the problem is a general one, and it's impossible to prove it doesn't exist by providing a small number of examples. This code was explicitly added to make the code safer in the face of self-modifying expressions. So I think removing it is not TRT. > > P.S. When I see code in Emacs that looks wrong/redundant/unclear, I > > find it useful to look at the VC history of that code. This is how I > > discovered where this particular "redundancy" came from, just 3.5 > > years ago. > > Thanks, I find `M-x vc-history-region` and this is very useful! > I should use before write a patch. Thanks.