From unknown Wed Jun 18 23:13:33 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#49944 <49944@debbugs.gnu.org> To: bug#49944 <49944@debbugs.gnu.org> Subject: Status: parse-partial-sexp fails to signal an error when (> START LIMIT). Reply-To: bug#49944 <49944@debbugs.gnu.org> Date: Thu, 19 Jun 2025 06:13:33 +0000 retitle 49944 parse-partial-sexp fails to signal an error when (> START LIM= IT). reassign 49944 emacs submitter 49944 Alan Mackenzie severity 49944 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 08 14:01:55 2021 Received: (at submit) by debbugs.gnu.org; 8 Aug 2021 18:01:55 +0000 Received: from localhost ([127.0.0.1]:54829 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mCn7T-0001cJ-2U for submit@debbugs.gnu.org; Sun, 08 Aug 2021 14:01:55 -0400 Received: from lists.gnu.org ([209.51.188.17]:49386) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mCn7P-0001c9-TO for submit@debbugs.gnu.org; Sun, 08 Aug 2021 14:01:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53274) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mCn7P-0006IH-6e for bug-gnu-emacs@gnu.org; Sun, 08 Aug 2021 14:01:51 -0400 Received: from colin.muc.de ([193.149.48.1]:24043 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.90_1) (envelope-from ) id 1mCn7N-0002HA-Bc for bug-gnu-emacs@gnu.org; Sun, 08 Aug 2021 14:01:51 -0400 Received: (qmail 36790 invoked by uid 3782); 8 Aug 2021 18:01:33 -0000 Received: from acm.muc.de (p2e5d50f8.dip0.t-ipconnect.de [46.93.80.248]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 08 Aug 2021 20:01:32 +0200 Received: (qmail 6974 invoked by uid 1000); 8 Aug 2021 18:01:32 -0000 Date: Sun, 8 Aug 2021 18:01:32 +0000 To: bug-gnu-emacs@gnu.org Subject: parse-partial-sexp fails to signal an error when (> START LIMIT). Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de Received-SPF: pass client-ip=193.149.48.1; envelope-from=acm@muc.de; helo=mail.muc.de X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_05=-0.5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: submit Cc: Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) Hello, Emacs. Emacs-28, emacs started with site-start.el and .emacs. On calling (parse-partial-sexp 19 18 nil nil s) Emacs surely ought to signal an error, since 18 < 19. It doesn't, though. It leaves point at a random position and returns (0 nil nil nil nil nil 0 nil nil nil nil) This is a bug. -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 08 14:14:57 2021 Received: (at 49944) by debbugs.gnu.org; 8 Aug 2021 18:14:57 +0000 Received: from localhost ([127.0.0.1]:54835 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mCnJq-0001tm-5w for submit@debbugs.gnu.org; Sun, 08 Aug 2021 14:14:57 -0400 Received: from quimby.gnus.org ([95.216.78.240]:58154) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mCnJl-0001tU-1K for 49944@debbugs.gnu.org; Sun, 08 Aug 2021 14:14:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=OPUS/fHwqCOmiT+kIXogbjOJW1GLDabXPnGmE+fi7e4=; b=ZmKKSUvtNtAhOLYhUhIPjOkiFQ NghyGDhKkEu9fu0u/aMAoMDdYaS1TDGVzMGfwLgXTfbFwMC63dQE98zHuzWuoGbnErmlvPys68RhP Ns+5AfljmGDmrDsf3Xn1a9Z6FVXCyfYOyo32nIw1jp8FDF/Vydp/qEIq8iVfnvl4sLzw=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mCnJb-00066X-5N; Sun, 08 Aug 2021 20:14:29 +0200 From: Lars Ingebrigtsen To: Alan Mackenzie Subject: Re: bug#49944: parse-partial-sexp fails to signal an error when (> START LIMIT). References: Date: Sun, 08 Aug 2021 20:14:25 +0200 In-Reply-To: (Alan Mackenzie's message of "Sun, 8 Aug 2021 18:01:32 +0000") Message-ID: <87r1f36by6.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Alan Mackenzie writes: > On calling > > (parse-partial-sexp 19 18 nil nil s) (What's `s' here?) Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49944 Cc: 49944@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Alan Mackenzie writes: > On calling > > (parse-partial-sexp 19 18 nil nil s) (What's `s' here?) > Emacs surely ought to signal an error, since 18 < 19. It's common for Emacs functions that take a region to not care about whether to is larger than from or not. The validate_region (&from, &to); function fixes it up. > It doesn't, > though. It leaves point at a random position and returns > > (0 nil nil nil nil nil 0 nil nil nil nil) For me it leaves point at 19. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 08 14:51:38 2021 Received: (at 49944) by debbugs.gnu.org; 8 Aug 2021 18:51:38 +0000 Received: from localhost ([127.0.0.1]:54849 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mCnta-0002kE-Jc for submit@debbugs.gnu.org; Sun, 08 Aug 2021 14:51:38 -0400 Received: from colin.muc.de ([193.149.48.1]:25321 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1mCntX-0002jx-1Q for 49944@debbugs.gnu.org; Sun, 08 Aug 2021 14:51:37 -0400 Received: (qmail 70228 invoked by uid 3782); 8 Aug 2021 18:51:28 -0000 Received: from acm.muc.de (p2e5d50f8.dip0.t-ipconnect.de [46.93.80.248]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 08 Aug 2021 20:51:27 +0200 Received: (qmail 7407 invoked by uid 1000); 8 Aug 2021 18:51:27 -0000 Date: Sun, 8 Aug 2021 18:51:27 +0000 To: Lars Ingebrigtsen Subject: Re: bug#49944: parse-partial-sexp fails to signal an error when (> START LIMIT). Message-ID: References: <87r1f36by6.fsf@gnus.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87r1f36by6.fsf@gnus.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 49944 Cc: 49944@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Lars. On Sun, Aug 08, 2021 at 20:14:25 +0200, Lars Ingebrigtsen wrote: > Alan Mackenzie writes: > > On calling > > > > (parse-partial-sexp 19 18 nil nil s) > (What's `s' here?) Sorry, should have said. It was a syntax state at position 19, something like: (0 nil 8 34 nil nil 0 nil 13 nil nil) representing a "normal" string starting at position 13. > > Emacs surely ought to signal an error, since 18 < 19. > It's common for Emacs functions that take a region to not care about > whether to is larger than from or not. parse-partial-sexp doesn't work on a region. It works with a starting position and ending position, which are not interchangeable. For example, the status s (above) is the status at 19, not at 18. > The > validate_region (&from, &to); > function fixes it up. It doesn't fix it up, it messes it up. > > It doesn't, > > though. It leaves point at a random position and returns > > > > (0 nil nil nil nil nil 0 nil nil nil nil) > For me it leaves point at 19. I think it may have done that for me, too, though perhaps not every time. Getting back on topic, I think there are no legitimate uses for (> start limit), and every such call is a bug. It would seem such a call discards the input state argument, which would be a bug in itself if the whole thing weren't a bug. It's obvious to me that Emacs should throw an error in these circumstances. You seem to be disagreeing, or at least to be unsure. One data point is it took me over an hour's time to track it down, time that could have been better spent if Emacs had thrown an error. > -- > (domestic pets only, the antidote for overdose, milk.) > bloggy blog: http://lars.ingebrigtsen.no -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 09 08:42:35 2021 Received: (at 49944) by debbugs.gnu.org; 9 Aug 2021 12:42:35 +0000 Received: from localhost ([127.0.0.1]:56298 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mD4by-0004Ud-TM for submit@debbugs.gnu.org; Mon, 09 Aug 2021 08:42:35 -0400 Received: from quimby.gnus.org ([95.216.78.240]:37086) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mD4bw-0004UK-F4 for 49944@debbugs.gnu.org; Mon, 09 Aug 2021 08:42:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=PGVdrmxFsFOmOhMR5TsCuD1Md0/Hze/NX8GecSEYLPQ=; b=HqcwE5SLamHPqfdyILuhxyPS3w oY5z/zFTyKAPB/TTZBtVLhHJsQuia6s56BpbAXbEBeESgJktbGTLMi6ZBB96oRg86CgoskJ3ND2N6 d+Ch/g7S2GxFhB5gcJOpDbCtP7ugyt+iyXNHNZQkBe/HXr91yaUnv4lp1EgzqQnGHGI8=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mD4bm-0005Nh-8J; Mon, 09 Aug 2021 14:42:24 +0200 From: Lars Ingebrigtsen To: Alan Mackenzie Subject: Re: bug#49944: parse-partial-sexp fails to signal an error when (> START LIMIT). References: <87r1f36by6.fsf@gnus.org> Date: Mon, 09 Aug 2021 14:42:21 +0200 In-Reply-To: (Alan Mackenzie's message of "Sun, 8 Aug 2021 18:51:27 +0000") Message-ID: <87pmum4wnm.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Alan Mackenzie writes: > parse-partial-sexp doesn't work on a region. It works with a starting > position and ending position, which are not interchangeable. Well... they are interchangeable now, as they are in many functions in Emacs. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49944 Cc: 49944@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Alan Mackenzie writes: > parse-partial-sexp doesn't work on a region. It works with a starting > position and ending position, which are not interchangeable. Well... they are interchangeable now, as they are in many functions in Emacs. > It's obvious to me that Emacs should throw an error in these > circumstances. You seem to be disagreeing, or at least to be unsure. Making this signal an error wouldn't be backwards-compatible, so I think that's a no go. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 09 12:51:03 2021 Received: (at 49944) by debbugs.gnu.org; 9 Aug 2021 16:51:03 +0000 Received: from localhost ([127.0.0.1]:57659 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mD8UJ-0000rI-BW for submit@debbugs.gnu.org; Mon, 09 Aug 2021 12:51:03 -0400 Received: from colin.muc.de ([193.149.48.1]:59077 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1mD8UE-0000qy-29 for 49944@debbugs.gnu.org; Mon, 09 Aug 2021 12:50:54 -0400 Received: (qmail 64732 invoked by uid 3782); 9 Aug 2021 16:50:42 -0000 Received: from acm.muc.de (p4fe157e5.dip0.t-ipconnect.de [79.225.87.229]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 09 Aug 2021 18:50:42 +0200 Received: (qmail 6699 invoked by uid 1000); 9 Aug 2021 16:50:42 -0000 Date: Mon, 9 Aug 2021 16:50:42 +0000 To: Lars Ingebrigtsen Subject: Re: bug#49944: parse-partial-sexp fails to signal an error when (> START LIMIT). Message-ID: References: <87r1f36by6.fsf@gnus.org> <87pmum4wnm.fsf@gnus.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87pmum4wnm.fsf@gnus.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 49944 Cc: 49944@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Lars. On Mon, Aug 09, 2021 at 14:42:21 +0200, Lars Ingebrigtsen wrote: > Alan Mackenzie writes: > > parse-partial-sexp doesn't work on a region. It works with a > > starting position and ending position, which are not > > interchangeable. > Well... they are interchangeable now, as they are in many functions > in Emacs. I can't see any use whatsoever for reversing START and LIMIT. Can you? I would be extremely surprised if any hacker had _ever_ intentionally used this "facility". We definitely have a bug here. The documentation in the elisp manual says that the scanning is done "starting at START". You're saying it's perfectly OK to start scanning at "LIMIT"? This violates the doc. In other words, you're sort of saying that it's the documentation at fault, not the function. > > It's obvious to me that Emacs should throw an error in these > > circumstances. You seem to be disagreeing, or at least to be > > unsure. > Making this signal an error wouldn't be backwards-compatible, so I > think that's a no go. Fixing _any_ bug leads to "backwards-incompatibility", that is, if one is determined to regard buggy behaviour as something to be preserved. This whole discussion feels a bit surrealistic. Is it not obvious that (parse-partial-sexp 19 18) ought to throw an error? > -- > (domestic pets only, the antidote for overdose, milk.) > bloggy blog: http://lars.ingebrigtsen.no -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 10 09:51:17 2021 Received: (at 49944) by debbugs.gnu.org; 10 Aug 2021 13:51:17 +0000 Received: from localhost ([127.0.0.1]:58799 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDSA0-00075V-4k for submit@debbugs.gnu.org; Tue, 10 Aug 2021 09:51:17 -0400 Received: from quimby.gnus.org ([95.216.78.240]:48074) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDS9l-00074o-9J for 49944@debbugs.gnu.org; Tue, 10 Aug 2021 09:51:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=e/q8c74XBNY57jtbiczVP7vkqAGoJEXV8Eym3yRipz0=; b=pW6J2FGbcXA7iJO0sNcdBXB+CJ DkkbVXiqrsBHOB066bkZcexb3eVbbYghQbTpU44rqRYagcPK4F2NWt/thKaZ70n4EBogD5Iwlvncv BVXiyEXJcRtHDVIQnPdBbNPBVl4NGsavxUt0NNRbGAvRCQ9bbv4HZiwQ2mZM5u6WiDnA=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mDS9a-0002kk-3r; Tue, 10 Aug 2021 15:50:54 +0200 From: Lars Ingebrigtsen To: Alan Mackenzie Subject: Re: bug#49944: parse-partial-sexp fails to signal an error when (> START LIMIT). References: <87r1f36by6.fsf@gnus.org> <87pmum4wnm.fsf@gnus.org> Date: Tue, 10 Aug 2021 15:50:49 +0200 In-Reply-To: (Alan Mackenzie's message of "Mon, 9 Aug 2021 16:50:42 +0000") Message-ID: <87a6lpz9vq.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Alan Mackenzie writes: > We definitely have a bug here. The documentation in the elisp manual > says that the scanning is done "starting at START". You're saying it's > perfectly OK to start scanning at "LIMIT"? This violat [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49944 Cc: 49944@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Alan Mackenzie writes: > We definitely have a bug here. The documentation in the elisp manual > says that the scanning is done "starting at START". You're saying it's > perfectly OK to start scanning at "LIMIT"? This violates the doc. This is what all function like this say. To take patient zero -- narrow-to-region: --- When calling from Lisp, pass two arguments START and END: positions (integers or markers) bounding the text that should remain visible. --- Nothing here about allowing END to come before START, but it does allow that, and so do most (all?) similar commands. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 10 10:03:09 2021 Received: (at 49944) by debbugs.gnu.org; 10 Aug 2021 14:03:10 +0000 Received: from localhost ([127.0.0.1]:60156 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDSLV-0001TC-Lu for submit@debbugs.gnu.org; Tue, 10 Aug 2021 10:03:09 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39496) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDSLU-0001Sy-6W for 49944@debbugs.gnu.org; Tue, 10 Aug 2021 10:03:08 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:50282) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mDSLO-0007pB-GR; Tue, 10 Aug 2021 10:03:02 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2707 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 1mDSLO-0008Fy-4D; Tue, 10 Aug 2021 10:03:02 -0400 Date: Tue, 10 Aug 2021 17:03:13 +0300 Message-Id: <83mtppflcu.fsf@gnu.org> From: Eli Zaretskii To: Lars Ingebrigtsen In-Reply-To: <87a6lpz9vq.fsf@gnus.org> (message from Lars Ingebrigtsen on Tue, 10 Aug 2021 15:50:49 +0200) Subject: Re: bug#49944: parse-partial-sexp fails to signal an error when (> START LIMIT). References: <87r1f36by6.fsf@gnus.org> <87pmum4wnm.fsf@gnus.org> <87a6lpz9vq.fsf@gnus.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49944 Cc: acm@muc.de, monnier@iro.umontreal.ca, 49944@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Lars Ingebrigtsen > Date: Tue, 10 Aug 2021 15:50:49 +0200 > Cc: 49944@debbugs.gnu.org, Stefan Monnier > > Alan Mackenzie writes: > > > We definitely have a bug here. The documentation in the elisp manual > > says that the scanning is done "starting at START". You're saying it's > > perfectly OK to start scanning at "LIMIT"? This violates the doc. > > This is what all function like this say. To take patient zero -- > narrow-to-region: > > --- > When calling from Lisp, pass two arguments START and END: > positions (integers or markers) bounding the text that should > remain visible. > --- > > Nothing here about allowing END to come before START, but it does allow > that, and so do most (all?) similar commands. Indeed, if the results are predictable, I see no reason not to support START and END in any order, as we do in many places. From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 10 10:41:51 2021 Received: (at 49944) by debbugs.gnu.org; 10 Aug 2021 14:41:51 +0000 Received: from localhost ([127.0.0.1]:60260 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDSwt-0002Tb-PS for submit@debbugs.gnu.org; Tue, 10 Aug 2021 10:41:51 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:14174) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDSwl-0002Sm-02 for 49944@debbugs.gnu.org; Tue, 10 Aug 2021 10:41:46 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 282DB809BD; Tue, 10 Aug 2021 10:41:33 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id CC8548090F; Tue, 10 Aug 2021 10:41:31 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1628606491; bh=IspDI06MtjTBNHijohm5HxTs1evnJ/hjs2EP8ThKBgc=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=o5N8dzM023QH0/JCfgSm9eo0bdlBCvPqfz0NiMFiUSE9EQTW3Z0xIKISVm0FT7H9M TuE3duCh+6xG473du2QDmruKwQpjfV7LcjUqJ/E0GIJ3lmTTybUE/IBFZ95B2dhNs3 YQDaT7eLW8ePoRmiw6ZbPNGFXbsHecioHZ0NW+6VrXzDxZBKv+fOAF6AiLatAXV4dS UUQnGz0yQPtwGWouemP+6rCEcQatILNpLKzhcTJ1GH8J4YkO0v6prci9/TE+DbD1R6 nIS8/cmgKiUbvhfmHvT38Y12gNvtsH50Inl4iTdMooOjBHueotKDAvz6UGSci7zcXZ P1uJnimoKdHuA== Received: from alfajor (104-222-120-40.cpe.teksavvy.com [104.222.120.40]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 97239120163; Tue, 10 Aug 2021 10:41:31 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#49944: parse-partial-sexp fails to signal an error when (> START LIMIT). Message-ID: References: <87r1f36by6.fsf@gnus.org> <87pmum4wnm.fsf@gnus.org> <87a6lpz9vq.fsf@gnus.org> <83mtppflcu.fsf@gnu.org> Date: Tue, 10 Aug 2021 10:41:30 -0400 In-Reply-To: <83mtppflcu.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 10 Aug 2021 17:03:13 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.063 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49944 Cc: acm@muc.de, Lars Ingebrigtsen , 49944@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> > We definitely have a bug here. The documentation in the elisp manual >> > says that the scanning is done "starting at START". You're saying it's >> > perfectly OK to start scanning at "LIMIT"? This violates the doc. >> >> This is what all function like this say. To take patient zero -- >> narrow-to-region: >> >> --- >> When calling from Lisp, pass two arguments START and END: >> positions (integers or markers) bounding the text that should >> remain visible. >> --- >> >> Nothing here about allowing END to come before START, but it does allow >> that, and so do most (all?) similar commands. > > Indeed, if the results are predictable, I see no reason not to support > START and END in any order, as we do in many places. I think the case of `parse-partial-sexp` is different because it receives the argument OLDSTATE which provides the parser's state which should apply at START. If START and END are swapped you'll generally get an incorrect result. 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. Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 10 10:55:14 2021 Received: (at 49944) by debbugs.gnu.org; 10 Aug 2021 14:55:14 +0000 Received: from localhost ([127.0.0.1]:60296 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDT9u-0004zs-Gs for submit@debbugs.gnu.org; Tue, 10 Aug 2021 10:55:14 -0400 Received: from quimby.gnus.org ([95.216.78.240]:48618) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDT9s-0004zb-LS for 49944@debbugs.gnu.org; Tue, 10 Aug 2021 10:55:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=eNmMYBJaYxMp9VlQu7FUSAQbQbRENrnAVEPQqH0JCXI=; b=hslxxLcCiBAeQVx/C5xDq4jknF G16+zfDusz0XbeTvWYgaSsNkFEUatCuaqcwXvGmLSOJSv5/NMIfZBBWn7b5I8zaUCJsJlYl+RKL/c P2MW2zAjHU9WrPBqtw/RbQDIhEZ2Y6QSRvrtaEOOXRTx170lbjW98qCZz097OIu+VGcI=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mDT9g-0003Ie-HE; Tue, 10 Aug 2021 16:55:04 +0200 From: Lars Ingebrigtsen To: Stefan Monnier Subject: Re: bug#49944: parse-partial-sexp fails to signal an error when (> START LIMIT). References: <87r1f36by6.fsf@gnus.org> <87pmum4wnm.fsf@gnus.org> <87a6lpz9vq.fsf@gnus.org> <83mtppflcu.fsf@gnu.org> Date: Tue, 10 Aug 2021 16:54:59 +0200 In-Reply-To: (Stefan Monnier's message of "Tue, 10 Aug 2021 10:41:30 -0400") Message-ID: <87o8a5xscc.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Stefan Monnier writes: > I think the case of `parse-partial-sexp` is different because it > receives the argument OLDSTATE which provides the parser's state which > should apply at START. If START and END are swapped you'll [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49944 Cc: acm@muc.de, Eli Zaretskii , 49944@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Stefan Monnier writes: > I think the case of `parse-partial-sexp` is different because it > receives the argument OLDSTATE which provides the parser's state which > should apply at START. If START and END are swapped you'll generally > get an incorrect result. > > 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.) -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 10 11:07:49 2021 Received: (at 49944) by debbugs.gnu.org; 10 Aug 2021 15:07:49 +0000 Received: from localhost ([127.0.0.1]:60335 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDTM4-0007VA-SZ for submit@debbugs.gnu.org; Tue, 10 Aug 2021 11:07:49 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:61853) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDTM2-0007Uk-HK for 49944@debbugs.gnu.org; Tue, 10 Aug 2021 11:07:47 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 070E14412B7; Tue, 10 Aug 2021 11:07:41 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id B280F4407E5; Tue, 10 Aug 2021 11:07:39 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1628608059; bh=9btWZPzi77h3WaoQ79Prl5XyYSURxPO0nFAAs0bZUjM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=JDxVwvY0KfTpwRXFLiBkMD42Wrhf1TWaX2q2ttKfzxFi9B1ia6LaHk1L/WvmlxQta 9MdJd43Nx5tGE57edWqVRo1eFavloUW94MyDHy7NZ1yeVjW/YEupKaIJUF4AS4U9ln 6JcFfc7ap/3+9UFU8esuTk/vrTLTxe8gRYHSAWjSKWDcHt6l0gKjRH/+0H/mW/6JnG ORaEa14oMB79g3ZYUFlcu5Rq+ZiVdAq7vePcjMiJhyZOMoakdFh7APW7UYNEABJT5Q dtrWsS+XpKMNRu1gSGkNejCuywbfD4CrByTG0p0EWgxe8pYoabKBr+XrvK1NLfcSus 6JH5uhE1ysAKw== Received: from alfajor (104-222-120-40.cpe.teksavvy.com [104.222.120.40]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 7729112023C; Tue, 10 Aug 2021 11:07:39 -0400 (EDT) From: Stefan Monnier To: Lars Ingebrigtsen Subject: Re: bug#49944: parse-partial-sexp fails to signal an error when (> START LIMIT). Message-ID: References: <87r1f36by6.fsf@gnus.org> <87pmum4wnm.fsf@gnus.org> <87a6lpz9vq.fsf@gnus.org> <83mtppflcu.fsf@gnu.org> <87o8a5xscc.fsf@gnus.org> Date: Tue, 10 Aug 2021 11:07:38 -0400 In-Reply-To: <87o8a5xscc.fsf@gnus.org> (Lars Ingebrigtsen's message of "Tue, 10 Aug 2021 16:54:59 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.092 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49944 Cc: acm@muc.de, Eli Zaretskii , 49944@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Lars Ingebrigtsen [2021-08-10 16:54:59] wrote: > 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? If the caller needs to know whether swapping will take place in order to pass the right OLDSTATE, then it defeats the purpose of swapping (which is presumably to make life easier for the caller). > So perhaps signalling an error here is the correct thing after all? > (Or just not doing any swapping.) I don't have an opinion on signaling an error or not, but swapping is a bad idea here IMO. Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 10 11:36:31 2021 Received: (at 49944) by debbugs.gnu.org; 10 Aug 2021 15:36:31 +0000 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 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 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 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 Date: Tue, 10 Aug 2021 18:36:33 +0300 Message-Id: <83k0ktfh1a.fsf@gnu.org> From: Eli Zaretskii To: Lars Ingebrigtsen In-Reply-To: <87o8a5xscc.fsf@gnus.org> (message from Lars Ingebrigtsen on Tue, 10 Aug 2021 16:54:59 +0200) Subject: Re: bug#49944: parse-partial-sexp fails to signal an error when (> START LIMIT). References: <87r1f36by6.fsf@gnus.org> <87pmum4wnm.fsf@gnus.org> <87a6lpz9vq.fsf@gnus.org> <83mtppflcu.fsf@gnu.org> <87o8a5xscc.fsf@gnus.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49944 Cc: acm@muc.de, monnier@iro.umontreal.ca, 49944@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > 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? From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 10 11:45:12 2021 Received: (at 49944) by debbugs.gnu.org; 10 Aug 2021 15:45:12 +0000 Received: from localhost ([127.0.0.1]:60505 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDTwF-0000CE-Vh for submit@debbugs.gnu.org; Tue, 10 Aug 2021 11:45:12 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:19117) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDTwE-0000Bs-7Y for 49944@debbugs.gnu.org; Tue, 10 Aug 2021 11:45:10 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 7AD23806A5; Tue, 10 Aug 2021 11:45:04 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id D8971807A2; Tue, 10 Aug 2021 11:45:02 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1628610302; bh=7zxYP7+OLsUyNXUwpt8WwA1nLp01XckkeNobXFXZKOE=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=lRr5ewF9Z+UyFL+ZWnSAHeZWHhMkjwr2nxHWpVoHFzj1KgemX/8sNtle2/KJHxWYW 6rhuFDraCvQFuKifrauUwWq9is7zyBRhjOKm3jdqgxKe8BSZqCgPW6AU8pmOsluC78 acLLo2IwxuVDOzQ0TzDZwGbLh44zDOs57ZThqcVxsx/WBzMm5hkZ38yqUgdLV9vzJa 0u/huyVhwiFYCzAuVYcv3N4njgcgo4SOj9DasWmR6jXFwHQmWx1PdmQG0numnOaY/x KYAzrTM3YdvtbBBAGDEZw1/xySOxwdjF/Iw3TI8K9agaIv+05Z6+//ZHZZ0gg8ckNm H32rVhBexeBIQ== Received: from alfajor (104-222-120-40.cpe.teksavvy.com [104.222.120.40]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 9FCBC12034A; Tue, 10 Aug 2021 11:45:02 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#49944: parse-partial-sexp fails to signal an error when (> START LIMIT). Message-ID: References: <87r1f36by6.fsf@gnus.org> <87pmum4wnm.fsf@gnus.org> <87a6lpz9vq.fsf@gnus.org> <83mtppflcu.fsf@gnu.org> <87o8a5xscc.fsf@gnus.org> <83k0ktfh1a.fsf@gnu.org> Date: Tue, 10 Aug 2021 11:44:55 -0400 In-Reply-To: <83k0ktfh1a.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 10 Aug 2021 18:36:33 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.063 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49944 Cc: acm@muc.de, Lars Ingebrigtsen , 49944@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > 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? The current use of `validate_region` means that OLDSTATE will be used as the state at "either FROM or TO, whichever is smaller". So I don't understand what it is you're proposing: if we document that OLDSTATE should be the state at FROM, then we need to change the code so that it never swaps FROM and TO. And if we don't want to change the code, then we should document that OLDSTATE will be used as the state at TO when TO is smaller than FROM. Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 10 12:38:47 2021 Received: (at 49944) by debbugs.gnu.org; 10 Aug 2021 16:38:47 +0000 Received: from localhost ([127.0.0.1]:60717 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDUm7-0008If-56 for submit@debbugs.gnu.org; Tue, 10 Aug 2021 12:38:47 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53732) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDUm5-0008IT-MN for 49944@debbugs.gnu.org; Tue, 10 Aug 2021 12:38:46 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:56898) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mDUlz-0001if-P1; Tue, 10 Aug 2021 12:38:39 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4319 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 1mDUlz-0006Ev-CB; Tue, 10 Aug 2021 12:38:39 -0400 Date: Tue, 10 Aug 2021 19:38:51 +0300 Message-Id: <83czqlfe5g.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Tue, 10 Aug 2021 11:44:55 -0400) Subject: Re: bug#49944: parse-partial-sexp fails to signal an error when (> START LIMIT). References: <87r1f36by6.fsf@gnus.org> <87pmum4wnm.fsf@gnus.org> <87a6lpz9vq.fsf@gnus.org> <83mtppflcu.fsf@gnu.org> <87o8a5xscc.fsf@gnus.org> <83k0ktfh1a.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49944 Cc: acm@muc.de, larsi@gnus.org, 49944@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: Lars Ingebrigtsen , acm@muc.de, 49944@debbugs.gnu.org > Date: Tue, 10 Aug 2021 11:44:55 -0400 > > > 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? > > The current use of `validate_region` means that OLDSTATE will be used as > the state at "either FROM or TO, whichever is smaller". > > So I don't understand what it is you're proposing: if we document > that OLDSTATE should be the state at FROM, then we need to change the > code so that it never swaps FROM and TO. And if we don't want to change > the code, then we should document that OLDSTATE will be used as the > state at TO when TO is smaller than FROM. The latter. By documenting the expectations of the function, we leave it to the callers to make sure their code works as intended. From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 11 07:05:02 2021 Received: (at 49944) by debbugs.gnu.org; 11 Aug 2021 11:05:02 +0000 Received: from localhost ([127.0.0.1]:33547 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDm2f-0000Mm-PQ for submit@debbugs.gnu.org; Wed, 11 Aug 2021 07:05:02 -0400 Received: from quimby.gnus.org ([95.216.78.240]:56904) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDm2a-0000ML-J7 for 49944@debbugs.gnu.org; Wed, 11 Aug 2021 07:05:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=OcxxQWpnP8PAUYOa/S2WC9hUeUWDK8g/RLUDd3Nmsjg=; b=P7TEdpLOuG1tZIGdmC/CoN68md pcGGEwTH5RXszvejFWGXqHtiFyGrG+KDKQlcLfD56Vl5SMkX+fQIHAvjI84cXhJ9yQKv0rBET2HxC Do8CtU5lA5TErsLQI614Cg5LYlPPXh0gOuRMzYXO6tDK4camS4vXcom6S3/oysZ5Xld4=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mDm2O-0006y1-Af; Wed, 11 Aug 2021 13:04:48 +0200 From: Lars Ingebrigtsen To: Eli Zaretskii Subject: Re: bug#49944: parse-partial-sexp fails to signal an error when (> START LIMIT). References: <87r1f36by6.fsf@gnus.org> <87pmum4wnm.fsf@gnus.org> <87a6lpz9vq.fsf@gnus.org> <83mtppflcu.fsf@gnu.org> <87o8a5xscc.fsf@gnus.org> <83k0ktfh1a.fsf@gnu.org> <83czqlfe5g.fsf@gnu.org> Date: Wed, 11 Aug 2021 13:04:43 +0200 In-Reply-To: <83czqlfe5g.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 10 Aug 2021 19:38:51 +0300") Message-ID: <874kbwutro.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Eli Zaretskii writes: >> So I don't understand what it is you're proposing: if we document >> that OLDSTATE should be the state at FROM, then we need to change the >> code so that it never swaps FROM and TO. And if we don' [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49944 Cc: acm@muc.de, Stefan Monnier , 49944@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eli Zaretskii writes: >> So I don't understand what it is you're proposing: if we document >> that OLDSTATE should be the state at FROM, then we need to change the >> code so that it never swaps FROM and TO. And if we don't want to change >> the code, then we should document that OLDSTATE will be used as the >> state at TO when TO is smaller than FROM. > > The latter. By documenting the expectations of the function, we leave > it to the callers to make sure their code works as intended. I think that sounds like a very complicated interface -- it would be better if we didn't swap. However, there may well be code out there today that calls the function with OLDSTATE matching the point passed in by END, which is then swapped with START (because it's smaller), and things work by accident. Probably unlikely, but to detect this we'd have to signal an error, like Alan suggested originally. So... perhaps we should just do that? I.e., signal an error if END is smaller than START? (And we could fix up the swapping for clarity, but it wouldn't be necessary.) -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 21 09:24:34 2021 Received: (at 49944) by debbugs.gnu.org; 21 Aug 2021 13:24:34 +0000 Received: from localhost ([127.0.0.1]:36072 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mHQzC-0005js-KO for submit@debbugs.gnu.org; Sat, 21 Aug 2021 09:24:34 -0400 Received: from quimby.gnus.org ([95.216.78.240]:42550) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mHQzA-0005ja-EB for 49944@debbugs.gnu.org; Sat, 21 Aug 2021 09:24:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=T7dHcVZwPS9ecyEpEYiDlRz3BFTe5117rO1Uq/Z8O2U=; b=kFr7lVM2RaIQQ8bWXLXVvYzA76 glAvNKd7DM+KJ9bx6xKmUTp+pwr4Ed9OZJo4Co/UgD/HCGuS4fDnUkYWdwxUhJUmg0HxYRPLRDtpx MxGQCHGBJY6cC/2m3J0gxTaqywRvk9TClu/8wXIZNxWb0/vs73ROmn+zZBQYX/iTj/wk=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mHQyy-0001Xs-Oe; Sat, 21 Aug 2021 15:24:25 +0200 From: Lars Ingebrigtsen To: Alan Mackenzie Subject: Re: bug#49944: parse-partial-sexp fails to signal an error when (> START LIMIT). References: Date: Sat, 21 Aug 2021 15:24:20 +0200 In-Reply-To: (Alan Mackenzie's message of "Sun, 8 Aug 2021 18:01:32 +0000") Message-ID: <87o89r2anv.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Alan Mackenzie writes: > Emacs-28, emacs started with site-start.el and .emacs. > > On calling > > (parse-partial-sexp 19 18 nil nil s) > > Emacs surely ought to signal an error, since 18 < 19. It doesn't, > though. It leav [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49944 Cc: 49944@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Alan Mackenzie writes: > Emacs-28, emacs started with site-start.el and .emacs. > > On calling > > (parse-partial-sexp 19 18 nil nil s) > > Emacs surely ought to signal an error, since 18 < 19. It doesn't, > though. It leaves point at a random position and returns > > (0 nil nil nil nil nil 0 nil nil nil nil) > > This is a bug. 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. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 21 09:24:42 2021 Received: (at control) by debbugs.gnu.org; 21 Aug 2021 13:24:42 +0000 Received: from localhost ([127.0.0.1]:36075 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mHQzJ-0005kB-Tc for submit@debbugs.gnu.org; Sat, 21 Aug 2021 09:24:42 -0400 Received: from quimby.gnus.org ([95.216.78.240]:42564) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mHQzD-0005jh-RW for control@debbugs.gnu.org; Sat, 21 Aug 2021 09:24:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=j6qq0Hd8DGixyPbt+iqAn6MyfYohGjFOnlZqGkSgE0Y=; b=dIrSr+RR/mUPGpCCBsLMUZqfN4 f1UY+VY0Vtkn/Wsh2IznKxv52buJs/I0KUf8obQ9Ya/yUYXyqdwMiGN5LOVKGdJ2oqyIYYx1eZ67A hl5pO+fPAho+J8+vgHJistsgNW+RfzDvqDFwjyogqJd0eESktsDseGa83PZj4nwW4Y8c=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mHQz5-0001Y1-Rp for control@debbugs.gnu.org; Sat, 21 Aug 2021 15:24:29 +0200 Date: Sat, 21 Aug 2021 15:24:27 +0200 Message-Id: <87mtpb2ano.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #49944 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: close 49944 28.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) close 49944 28.1 quit From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 21 10:05:09 2021 Received: (at 49944) by debbugs.gnu.org; 21 Aug 2021 14:05:10 +0000 Received: from localhost ([127.0.0.1]:37606 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mHRcT-0002xu-Mx for submit@debbugs.gnu.org; Sat, 21 Aug 2021 10:05:09 -0400 Received: from colin.muc.de ([193.149.48.1]:18583 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1mHRcR-0002xS-S6 for 49944@debbugs.gnu.org; Sat, 21 Aug 2021 10:05:09 -0400 Received: (qmail 28720 invoked by uid 3782); 21 Aug 2021 14:05:01 -0000 Received: from acm.muc.de (p4fe15b48.dip0.t-ipconnect.de [79.225.91.72]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 21 Aug 2021 16:05:01 +0200 Received: (qmail 10176 invoked by uid 1000); 21 Aug 2021 14:05:00 -0000 Date: Sat, 21 Aug 2021 14:05:00 +0000 To: Lars Ingebrigtsen Subject: Re: bug#49944: parse-partial-sexp fails to signal an error when (> START LIMIT). Message-ID: References: <87o89r2anv.fsf@gnus.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87o89r2anv.fsf@gnus.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 49944 Cc: 49944@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Lars. On Sat, Aug 21, 2021 at 15:24:20 +0200, Lars Ingebrigtsen wrote: > Alan Mackenzie writes: > > Emacs-28, emacs started with site-start.el and .emacs. > > On calling > > (parse-partial-sexp 19 18 nil nil s) > > Emacs surely ought to signal an error, since 18 < 19. It doesn't, > > though. It leaves point at a random position and returns > > (0 nil nil nil nil nil 0 nil nil nil nil) > > This is a bug. > 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. Thanks! > -- > (domestic pets only, the antidote for overdose, milk.) > bloggy blog: http://lars.ingebrigtsen.no -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 21 18:12:07 2021 Received: (at 49944) by debbugs.gnu.org; 21 Aug 2021 22:12:07 +0000 Received: from localhost ([127.0.0.1]:37980 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mHZDj-0000pl-AY for submit@debbugs.gnu.org; Sat, 21 Aug 2021 18:12:07 -0400 Received: from mail-wm1-f42.google.com ([209.85.128.42]:37516) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mHZDg-0000pD-59 for 49944@debbugs.gnu.org; Sat, 21 Aug 2021 18:12:05 -0400 Received: by mail-wm1-f42.google.com with SMTP id c8-20020a7bc008000000b002e6e462e95fso11403860wmb.2 for <49944@debbugs.gnu.org>; Sat, 21 Aug 2021 15:12:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd.ie; s=google21; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=GKrEZoeipGMelr9WOqjW50/bOjbK4hIQBM2xlxRa1/I=; b=b+W+vt3X6EqyWhFKNqvB15Ypf586Tq3+23KBD+BYHsFMgW3CgXMW0vPD6cYTiiUzWI Bj6U5tsWLiOHLlmBPOGgzn1h78KeRxuKSEn6PQxoFaltO2nwavkaztTpyorXzEIWxPyy jUYaiEmnbL495eUivoppHJfW9aQopOqZMswX9/79007uLIbM1+04OndEeCpe3MbeYSuh B0VuDlD9VzaE979eb1+RUeiS0oify4oX08QYyVMPzGPr2AxDMswcN0U8D+RyUXNmxFhx D1COMJOWwQ5C3QnXFKDLj49BXHH43M+sduJLEr6P1fkePeTL6PdYlEazR/wmm3UfUnTb pYqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=GKrEZoeipGMelr9WOqjW50/bOjbK4hIQBM2xlxRa1/I=; b=l4Jwdmh47yEo5zHZwT6oMAor1yt/wEEZrjUiuhMYRQLlbYWLRZaQNgN2daFTJYmnKl hEBidFTJ6LNw2MD/twiO8UHn0yELflJ+5Xp3u/loSEVYFXHzrgjJFbz3X3r4zRJXd+BA BNLJUq0WmIQjXj7yjwI1heprIwivhGUgrm0kZ/GGqR16VXChLekC8JYmJ/hGRoLvX+CD 1USF6PzdQHltlAaetd/kHTuQbBQc+QzQ/9T5abnsgtYVdG3fvR3LREhnsgRnnygdslR7 L4lwNpjLADMPGxptOSwmUwX71fJUVtr2RCzCI6lIe3rd4EVWN2+iOFTfVKv1VeyhHWk4 oySA== X-Gm-Message-State: AOAM532OPfG04A57SmnGjW8bfguQ4DicUhxK3OmsZaquoj7ePprarhuY BQEUXPij/j3V2EjcA/Py5DL1BA== X-Google-Smtp-Source: ABdhPJyHsoho7Pp+Oxb50pXE7tR6yCqA/melulfCN9xmKj0GBgTjShbJ+5uX6mWhytrUAJPQ/v+16g== X-Received: by 2002:a05:600c:4f96:: with SMTP id n22mr3446784wmq.17.1629583918362; Sat, 21 Aug 2021 15:11:58 -0700 (PDT) Received: from localhost ([2a02:8084:20e2:c380:f410:82e8:3a21:eedf]) by smtp.gmail.com with ESMTPSA id q3sm8542538wmf.37.2021.08.21.15.11.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 15:11:57 -0700 (PDT) From: "Basil L. Contovounesios" To: Lars Ingebrigtsen Subject: Re: bug#49944: parse-partial-sexp fails to signal an error when (> START LIMIT). References: <87o89r2anv.fsf@gnus.org> Date: Sat, 21 Aug 2021 23:11:55 +0100 In-Reply-To: <87o89r2anv.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sat, 21 Aug 2021 15:24:20 +0200") Message-ID: <87sfz2o3bo.fsf@tcd.ie> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 49944 Cc: Alan Mackenzie , Stefan Monnier , 49944@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Lars Ingebrigtsen [2021-08-21 15:24 +0200] wrote: > Alan Mackenzie writes: > >> Emacs-28, emacs started with site-start.el and .emacs. >> >> On calling >> >> (parse-partial-sexp 19 18 nil nil s) >> >> Emacs surely ought to signal an error, since 18 < 19. It doesn't, >> though. It leaves point at a random position and returns >> >> (0 nil nil nil nil nil 0 nil nil nil nil) >> >> This is a bug. > > 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? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Fix-recent-parse-partial-sexp-argument-validation.patch >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 --=-=-= Content-Type: text/plain Thanks, -- Basil --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 22 06:50:40 2021 Received: (at 49944) by debbugs.gnu.org; 22 Aug 2021 10:50:40 +0000 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 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 Received: (qmail 18068 invoked by uid 3782); 22 Aug 2021 10:50:24 -0000 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 Received: (qmail 10275 invoked by uid 1000); 22 Aug 2021 10:50:23 -0000 Date: Sun, 22 Aug 2021 10:50:23 +0000 To: "Basil L. Contovounesios" Subject: Re: bug#49944: parse-partial-sexp fails to signal an error when (> START LIMIT). Message-ID: References: <87o89r2anv.fsf@gnus.org> <87sfz2o3bo.fsf@tcd.ie> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87sfz2o3bo.fsf@tcd.ie> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 49944 Cc: 49944@debbugs.gnu.org, Lars Ingebrigtsen , Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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). From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 22 11:02:34 2021 Received: (at 49944) by debbugs.gnu.org; 22 Aug 2021 15:02:34 +0000 Received: from localhost ([127.0.0.1]:39711 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mHozV-00082P-Sk for submit@debbugs.gnu.org; Sun, 22 Aug 2021 11:02:34 -0400 Received: from quimby.gnus.org ([95.216.78.240]:34704) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mHozP-0007ts-Pb for 49944@debbugs.gnu.org; Sun, 22 Aug 2021 11:02:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=r1rfeKVn/YUprMRGUhLqJU13ZzgKVHb/RNVfNZYk4dw=; b=IZbenmQH6ILpu4jiaRmkDDrddC sqYYKqwg20yDQONz/HiVEnwKZv7mrOnBnjypNy1F5IGQ7bzW0rQGsrtuSnwMiwS2vTuaEoLP9vc8D 9BgibkDU9MERy6ieshaKyzI27BkeRXcGQAt70mWdImuwXF5j6SqCq7TdZnIlfDtnCU8A=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mHozE-00083t-94; Sun, 22 Aug 2021 17:02:16 +0200 From: Lars Ingebrigtsen To: "Basil L. Contovounesios" Subject: Re: bug#49944: parse-partial-sexp fails to signal an error when (> START LIMIT). References: <87o89r2anv.fsf@gnus.org> <87sfz2o3bo.fsf@tcd.ie> Date: Sun, 22 Aug 2021 17:02:11 +0200 In-Reply-To: <87sfz2o3bo.fsf@tcd.ie> (Basil L. Contovounesios's message of "Sat, 21 Aug 2021 23:11:55 +0100") Message-ID: <87pmu5y13g.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: "Basil L. Contovounesios" writes: > - 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 [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49944 Cc: Alan Mackenzie , Stefan Monnier , 49944@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) "Basil L. Contovounesios" writes: > - 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"); Looks good to me. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 22 18:55:06 2021 Received: (at 49944) by debbugs.gnu.org; 22 Aug 2021 22:55:06 +0000 Received: from localhost ([127.0.0.1]:40001 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mHwMo-0000ha-FI for submit@debbugs.gnu.org; Sun, 22 Aug 2021 18:55:06 -0400 Received: from mail-wm1-f48.google.com ([209.85.128.48]:54942) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mHwMi-0000gx-NK for 49944@debbugs.gnu.org; Sun, 22 Aug 2021 18:55:01 -0400 Received: by mail-wm1-f48.google.com with SMTP id g138so9366508wmg.4 for <49944@debbugs.gnu.org>; Sun, 22 Aug 2021 15:54:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd.ie; s=google21; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=SwdFV8fhb2Wq1IlH+PGEyxZdG82vL8Tlhe8VCBQEn80=; b=bx6v0EH4VmrAZ3Dio5RbRfnfZ7U9EucbUpovHkCmv/RO90dDHzp+R9Sf7p5iHEvBUp 8gfskXrsueCs+3jH53VdtdAerEoXdkXjAM9Lakvh9kbEoXyTfbIOTMOisDOqbR2OPG8B tAI5tDDQRb3tyNyMdJf3f6HomGYH1qSW96+PwMVMwmLeitu5ovBrDTApj6C/kkDO+5+s M6E4CwwKOCLHPxvLRUsa74PrljdmzDbyFU+1OToTKaDUJMjaHQupyczY2/OhKvf8UN+R nPV6BYEIAGGROg+fD4CHK9Ob/I3VMlQLPMKRRnSmLLZmLXMGwNU+7/Dgj3YAuDTeXfR8 AYWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=SwdFV8fhb2Wq1IlH+PGEyxZdG82vL8Tlhe8VCBQEn80=; b=hdcQ+PlU8OXbK+iCd2Yo8Dd7eWcNw0+iFikeBhzOWadUUgYgZQo3DKk4d20B79Uzm3 T2a++XvDegQAjFShTuFs7ilsx0zRcoFxLPvhwgSYcGvjTmR4trWd2tTlXnyul/8RGImt WFvLHTRGyISpPE12XVckcx2Oe/p6MGuUE03UyxLGU5/3hMtsXg3sAy0Rmst5dHC1l5YB j4kxJCTLmK4gzGx7cjmXFrO2kOg05/1OYe1fqSxPYJMf6+prmRtuO/wMszf0nOAQ4IMW Y05DGuOsY85N+j3g7ODHzr4d3bZ5TlHAt5FooPP1UKne3gCkYdMzPCI1wnlKQ0LRtMzq q0pg== X-Gm-Message-State: AOAM5302QGUxSh02lzfXk6WlrklkUQD2IXvECah71GPJmLBXUXFggFP+ U9XK9caQf+D7Omd7/4gfOepsdw== X-Google-Smtp-Source: ABdhPJxXOOtBThFTtWmmHnkMy4B0TTzO6Q0rMbtjH2E8Cmrx2xuj7dtuZ2svLkLyV/LecyQ60b2B1A== X-Received: by 2002:a05:600c:2f17:: with SMTP id r23mr13770858wmn.118.1629672890846; Sun, 22 Aug 2021 15:54:50 -0700 (PDT) Received: from localhost ([2a02:8084:20e2:c380:f410:82e8:3a21:eedf]) by smtp.gmail.com with ESMTPSA id r8sm13209509wrj.11.2021.08.22.15.54.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Aug 2021 15:54:50 -0700 (PDT) From: "Basil L. Contovounesios" To: Lars Ingebrigtsen Subject: Re: bug#49944: parse-partial-sexp fails to signal an error when (> START LIMIT). References: <87o89r2anv.fsf@gnus.org> <87sfz2o3bo.fsf@tcd.ie> <87pmu5y13g.fsf@gnus.org> Date: Sun, 22 Aug 2021 23:54:49 +0100 In-Reply-To: <87pmu5y13g.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sun, 22 Aug 2021 17:02:11 +0200") Message-ID: <878s0t3xae.fsf@tcd.ie> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 49944 Cc: Alan Mackenzie , Stefan Monnier , 49944@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Lars Ingebrigtsen [2021-08-22 17:02 +0200] wrote: > Looks good to me. Thanks Alan and Lars, pushed. Fix recent parse-partial-sexp argument validation ff2124d297 2021-08-22 23:52:23 +0100 https://git.sv.gnu.org/cgit/emacs.git/commit/?id=ff2124d2979ee9ba5b8e22147fa8ccaa00e2cc4f -- Basil From unknown Wed Jun 18 23:13:33 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 20 Sep 2021 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator