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.bugs Subject: bug#49944: parse-partial-sexp fails to signal an error when (> START LIMIT). Date: Tue, 10 Aug 2021 18:36:33 +0300 Message-ID: <83k0ktfh1a.fsf@gnu.org> References: <87r1f36by6.fsf@gnus.org> <87pmum4wnm.fsf@gnus.org> <87a6lpz9vq.fsf@gnus.org> <83mtppflcu.fsf@gnu.org> <87o8a5xscc.fsf@gnus.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3488"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acm@muc.de, monnier@iro.umontreal.ca, 49944@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 10 17:37:37 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 1mDTou-0000cI-P8 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 10 Aug 2021 17:37:36 +0200 Original-Received: from localhost ([::1]:57628 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mDTot-0006MO-Lg for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 10 Aug 2021 11:37:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44520) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mDToN-0006Lj-27 for bug-gnu-emacs@gnu.org; Tue, 10 Aug 2021 11:37:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48940) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mDToM-0006MT-SA for bug-gnu-emacs@gnu.org; Tue, 10 Aug 2021 11:37:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mDToM-0008QV-Hi for bug-gnu-emacs@gnu.org; Tue, 10 Aug 2021 11:37:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 10 Aug 2021 15:37: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.162860979132336 (code B ref 49944); Tue, 10 Aug 2021 15:37:02 +0000 Original-Received: (at 49944) by debbugs.gnu.org; 10 Aug 2021 15:36:31 +0000 Original-Received: from localhost ([127.0.0.1]:60483 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDTnq-0008PS-Ob for submit@debbugs.gnu.org; Tue, 10 Aug 2021 11:36:31 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:35676) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDTnp-0008PD-Dp for 49944@debbugs.gnu.org; Tue, 10 Aug 2021 11:36:29 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:54098) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mDTni-0005wE-RR; Tue, 10 Aug 2021 11:36:22 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4436 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mDTni-0004ug-F5; Tue, 10 Aug 2021 11:36:22 -0400 In-Reply-To: <87o8a5xscc.fsf@gnus.org> (message from Lars Ingebrigtsen on Tue, 10 Aug 2021 16:54:59 +0200) 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:211515 Archived-At: > From: Lars Ingebrigtsen > Cc: Eli Zaretskii , acm@muc.de, 49944@debbugs.gnu.org > Date: Tue, 10 Aug 2021 16:54:59 +0200 > > > So, I don't care if we signal an error when START > END or if we "do > > nothing" (as is customary in some language's `for` loops), but we should > > always consider that OLDSTATE is the state that belongs with START and > > hence we can't start parsing at END towards START because we don't know > > what parsing state to use at END. > > Ah; thanks for the explanation. > > But I guess you'll get incorrect results if you pass in any OLDSTATE > that doesn't belong to START, not just when START and END are swapped? > It's just that if START/END obviously wrong (i.e., END is smaller than > START), then the function here "helpfully" swaps them and things get > even more confusing than they would normally be if you pass in a wrong > OLDSTATE (or wrong START). > > So perhaps signalling an error here is the correct thing after all? (Or > just not doing any swapping.) The reordering is the side effect of calling validate_region, so we'd need to expend extra effort NOT to reorder START and END. How about just documenting that OLDSTATE should be the state at START, and that's it?