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#63535: Master branch: Error in forw_comment (syntax.c) handling of escaped LFs Date: Tue, 16 May 2023 20:50:50 +0300 Message-ID: <83bkikyxl1.fsf@gnu.org> References: <83ttwcz3gg.fsf@gnu.org> <83edngz1cp.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23486"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 63535@debbugs.gnu.org To: Alan Mackenzie , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 16 19:51:21 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 1pyypV-0005re-3T for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 16 May 2023 19:51:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pyypE-0002gx-EI; Tue, 16 May 2023 13:51: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 1pyypC-0002gg-NZ for bug-gnu-emacs@gnu.org; Tue, 16 May 2023 13:51: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 1pyypC-0003ln-FQ for bug-gnu-emacs@gnu.org; Tue, 16 May 2023 13:51:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pyypC-0000Xp-BJ for bug-gnu-emacs@gnu.org; Tue, 16 May 2023 13:51: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, 16 May 2023 17:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63535 X-GNU-PR-Package: emacs Original-Received: via spool by 63535-submit@debbugs.gnu.org id=B63535.16842594522020 (code B ref 63535); Tue, 16 May 2023 17:51:02 +0000 Original-Received: (at 63535) by debbugs.gnu.org; 16 May 2023 17:50:52 +0000 Original-Received: from localhost ([127.0.0.1]:47667 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pyyp1-0000WV-Qv for submit@debbugs.gnu.org; Tue, 16 May 2023 13:50:52 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:32816) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pyyoz-0000WB-Py for 63535@debbugs.gnu.org; Tue, 16 May 2023 13:50:50 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyyot-0003e1-9g; Tue, 16 May 2023 13:50:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=USF57KLPdsEtOfNSrbxEUffT/qPWtYyIMBgerjYNvnk=; b=Gp6MUzd7fWxZ l74pwV6b6jDDRMDVeleGF61knlMwClj6EEspjp5cXumvWLAy41pvUtP/FoLgV94FNZtf7f3w0DjGh 759Maj8dshRECaoeUvtONXB5HaZFqMFffzTreiwUD5/VeNLJXn1F/3WHlQDc2ru/A5e3eCD1gAfo7 vPlvN6NvaxGBkw4DRX6YzalPTzYoa8SUpBIuLaPgyK4h+g0GlNT0vkKStCOIN3g+AikEY+zylolbO RKCFdaFTjicubz5Mj5rMeb81AWKgvg+mYilv+U9SArLynf8kNm4JJzzTf/pqwxFtMGNH6Qge5wtE9 2jX7LUYc79D22+IdIz32zg==; Original-Received: from [87.69.77.57] (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 1pyyos-00024E-EU; Tue, 16 May 2023 13:50:42 -0400 In-Reply-To: (message from Alan Mackenzie on Tue, 16 May 2023 16:58:55 +0000) 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:261803 Archived-At: > Date: Tue, 16 May 2023 16:58:55 +0000 > Cc: 63535@debbugs.gnu.org > From: Alan Mackenzie > > On Tue, May 16, 2023 at 19:29:26 +0300, Eli Zaretskii wrote: > > > Date: Tue, 16 May 2023 16:15:24 +0000 > > > Cc: 63535@debbugs.gnu.org > > > From: Alan Mackenzie > > > > > > && !(comment_end_can_be_escaped && char_quoted (from, from_byte)) > > > > > > .. Checking char_quoted is wrong. Instead the function should check the > > > > > current parse state. > > > > > Why not both? IOW, please explain why char_quoted is not TRT here. > > > > Because parse-partial-sexp is not scanning the backslash. The scan > > > starts one character after the backslash, and the syntactic effect of > > > that backslash is not in the OLDSTATE argument to parse-partial-sexp. > > > Sorry, I still don't follow: char_quoted doesn't call > > parse-partial-sexp, AFAICT. > > parse-partial-sexp calls forw_comment which (wrongly) calls char_quoted. > > > So why does it matter what parse-partial-sexp does when we are > > discussing why char_quoted is not TRT? > > parse-partial-sexp is the context in which the bug becomes evident. If, > in the C++ line comment with escaped NL, you start parse-partial-sexp at > the NL, it behaves as though the scan started at the backslash. This is > the bug. > > The cause of the bug is the use of char_quoted at line 42 of > forw_comment. Thanks, let's see what Stefan has to say about this.