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#63535: Master branch: Error in forw_comment (syntax.c) handling of escaped LFs Date: Tue, 16 May 2023 10:57:40 +0000 Message-ID: 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="33100"; mail-complaints-to="usenet@ciao.gmane.io" To: 63535@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 16 12:59:04 2023 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 1pysOV-0008UX-PV for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 16 May 2023 12:59:03 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pysNY-0007ZV-LF; Tue, 16 May 2023 06:58:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pysNW-0007Xa-Oi for bug-gnu-emacs@gnu.org; Tue, 16 May 2023 06:58:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pysNW-0007tU-HH for bug-gnu-emacs@gnu.org; Tue, 16 May 2023 06:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pysNW-0000Om-CE for bug-gnu-emacs@gnu.org; Tue, 16 May 2023 06:58: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: Tue, 16 May 2023 10:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 63535 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16842346771519 (code B ref -1); Tue, 16 May 2023 10:58:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 16 May 2023 10:57:57 +0000 Original-Received: from localhost ([127.0.0.1]:45326 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pysNQ-0000OR-TK for submit@debbugs.gnu.org; Tue, 16 May 2023 06:57:57 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:58316) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pysNO-0000OF-4s for submit@debbugs.gnu.org; Tue, 16 May 2023 06:57:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pysNN-0007Wi-Vd for bug-gnu-emacs@gnu.org; Tue, 16 May 2023 06:57:53 -0400 Original-Received: from mx3.muc.de ([193.149.48.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pysNL-0007rd-Vq for bug-gnu-emacs@gnu.org; Tue, 16 May 2023 06:57:53 -0400 Original-Received: (qmail 85864 invoked by uid 3782); 16 May 2023 12:57:41 +0200 Original-Received: from acm.muc.de (p4fe15025.dip0.t-ipconnect.de [79.225.80.37]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 16 May 2023 12:57:40 +0200 Original-Received: (qmail 9856 invoked by uid 1000); 16 May 2023 10:57:40 -0000 Content-Disposition: inline X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de Received-SPF: pass client-ip=193.149.48.5; envelope-from=acm@muc.de; helo=mx3.muc.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:261780 Archived-At: Hello, Emacs. In the master branch: Consider the following C++ Mode buffer: // comment \ comment line 2 line_3(); .. The backslash at the end of line 1 extends the comment into line 2. Put point at // on L1, and do: M-: (setq s (parse-partial-sexp (point) (+ (point) 9))) .. s gets the parse state of the inside of the comment. Now put point at EOL 1, between the backslash and the LF. Do M-: (parse-partial-sexp (point) (point-max) nil nil s 'syntax-table) .. This ought to leave point at BOL 2, since the syntax before the LF at EOL 1 is that of a C++ comment, otherwise neutral. Instead, it leaves point wrongly at BOL 3. ######################################################################### The reason for this bug is at L+42 of forw_comment (in syntax.c). There we have && !(comment_end_can_be_escaped && char_quoted (from, from_byte)) .. Checking char_quoted is wrong. Instead the function should check the current parse state. -- Alan Mackenzie (Nuremberg, Germany).