From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#49944: parse-partial-sexp fails to signal an error when (> START LIMIT). Date: Sun, 22 Aug 2021 10:50:23 +0000 Message-ID: References: <87o89r2anv.fsf@gnus.org> <87sfz2o3bo.fsf@tcd.ie> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="323"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 49944@debbugs.gnu.org, Lars Ingebrigtsen , Stefan Monnier To: "Basil L. Contovounesios" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 22 12:51:14 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1mHl4M-000AR5-6h for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 22 Aug 2021 12:51:14 +0200 Original-Received: from localhost ([::1]:51554 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHl4K-000437-5l for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 22 Aug 2021 06:51:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50200) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHl4B-00042D-EQ for bug-gnu-emacs@gnu.org; Sun, 22 Aug 2021 06:51:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54929) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHl4A-0001Od-J9 for bug-gnu-emacs@gnu.org; Sun, 22 Aug 2021 06:51:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mHl4A-0003iJ-Cr for bug-gnu-emacs@gnu.org; Sun, 22 Aug 2021 06:51:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 22 Aug 2021 10:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49944 X-GNU-PR-Package: emacs Original-Received: via spool by 49944-submit@debbugs.gnu.org id=B49944.162962944014247 (code B ref 49944); Sun, 22 Aug 2021 10:51:02 +0000 Original-Received: (at 49944) by debbugs.gnu.org; 22 Aug 2021 10:50:40 +0000 Original-Received: from localhost ([127.0.0.1]:38242 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mHl3k-0003hf-Rb for submit@debbugs.gnu.org; Sun, 22 Aug 2021 06:50:40 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:59039 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1mHl3f-0003hO-AE for 49944@debbugs.gnu.org; Sun, 22 Aug 2021 06:50:35 -0400 Original-Received: (qmail 18068 invoked by uid 3782); 22 Aug 2021 10:50:24 -0000 Original-Received: from acm.muc.de (p2e5d53c2.dip0.t-ipconnect.de [46.93.83.194]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 22 Aug 2021 12:50:24 +0200 Original-Received: (qmail 10275 invoked by uid 1000); 22 Aug 2021 10:50:23 -0000 Content-Disposition: inline In-Reply-To: <87sfz2o3bo.fsf@tcd.ie> X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:212410 Archived-At: Hello, Basil. On Sat, Aug 21, 2021 at 23:11:55 +0100, Basil L. Contovounesios wrote: > Lars Ingebrigtsen [2021-08-21 15:24 +0200] wrote: [ .... ] > > I've now made this change (and the doc string clarification discussed). > > There are no test failures after the change, and I'm not getting any > > errors when running it normally, either. > Found one :). > 0. emacs -Q > 1. M-x toggle-debug-on-error RET > 2. M-x ielm RET RET > Debugger entered--Lisp error: > (error "End position should be larger than start position.") > parse-partial-sexp(# 64) > ielm-return() > funcall-interactively(ielm-return) > call-interactively(ielm-return nil nil) > command-execute(ielm-return) > One option is to replace XFIXNUM with fix_position, which is what the > subsequent validate_region also does. Another option is to > CHECK_FIXNUM_COERCE_MARKER before the comparison. Any preference? I think the use of fix_position is the best here, and your patch is right. Importantly, it corrects the error message, such that it does not give the impression that End position == Start position would signal an error. > >From 34c87c83fa86263da863da6c0a920c746b8af02b Mon Sep 17 00:00:00 2001 > From: "Basil L. Contovounesios" > Date: Sat, 21 Aug 2021 22:55:58 +0100 > Subject: [PATCH] Fix recent parse-partial-sexp argument validation > * src/syntax.c (parse-partial-sexp): Also handle markers as > arguments (bug#49944). Tweak error message to follow conventions in > "(elisp) Signaling Errors". > --- > src/syntax.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > diff --git a/src/syntax.c b/src/syntax.c > index adc0da730e..057a4c3b1f 100644 > --- a/src/syntax.c > +++ b/src/syntax.c > @@ -3595,8 +3595,8 @@ DEFUN ("parse-partial-sexp", Fparse_partial_sexp, Sparse_partial_sexp, 2, 6, 0, > else > target = TYPE_MINIMUM (EMACS_INT); /* We won't reach this depth. */ > - if (XFIXNUM (to) < XFIXNUM (from)) > - error ("End position should be larger than start position."); > + if (fix_position (to) < fix_position (from)) > + error ("End position is smaller than start position"); > validate_region (&from, &to); > internalize_parse_state (oldstate, &state); > -- > 2.32.0 > Thanks, > -- > Basil -- Alan Mackenzie (Nuremberg, Germany).