From: Eli Zaretskii <eliz@gnu.org>
To: Naoya Yamashita <conao3@gmail.com>
Cc: pipcet@gmail.com, emacs-devel@gnu.org
Subject: Re: [PATCH] * src/eval.c: Stop checking for nvars, and use only CONSP
Date: Tue, 02 Mar 2021 16:00:28 +0200 [thread overview]
Message-ID: <831rcx7j0j.fsf@gnu.org> (raw)
In-Reply-To: <20210302.161418.2185996023660309707.conao3@gmail.com> (message from Naoya Yamashita on Tue, 02 Mar 2021 16:14:18 +0900 (JST))
> Date: Tue, 02 Mar 2021 16:14:18 +0900 (JST)
> Cc: pipcet@gmail.com, emacs-devel@gnu.org
> From: Naoya Yamashita <conao3@gmail.com>
>
> 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.
prev parent reply other threads:[~2021-03-02 14:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-02 2:10 [PATCH] * src/eval.c: Stop checking for nvars, and use only CONSP Naoya Yamashita
2021-03-02 2:48 ` Stefan Monnier
2021-03-02 3:09 ` Naoya Yamashita
2021-03-02 14:31 ` Stefan Monnier
2021-03-02 15:19 ` Pip Cet
2021-03-02 15:48 ` Stefan Monnier
2021-03-02 17:04 ` Pip Cet
2021-03-02 17:44 ` Stefan Monnier
2021-03-02 19:50 ` Pip Cet
2021-03-02 23:48 ` Stefan Monnier
2021-03-02 5:34 ` Pip Cet
2021-03-02 5:41 ` Eli Zaretskii
2021-03-02 7:14 ` Naoya Yamashita
2021-03-02 7:30 ` Pip Cet
2021-03-02 14:00 ` Eli Zaretskii [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=831rcx7j0j.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=conao3@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=pipcet@gmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.