GNU bug report logs -
#49944
parse-partial-sexp fails to signal an error when (> START LIMIT).
Previous Next
Reported by: Alan Mackenzie <acm <at> muc.de>
Date: Sun, 8 Aug 2021 18:02:01 UTC
Severity: normal
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #58 received at 49944 <at> debbugs.gnu.org (full text, mbox):
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(#<marker at 64 in *ielm*> 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" <contovob <at> tcd.ie>
> 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).
This bug report was last modified 3 years and 272 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.