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#73771: 30.0.91; etags generates broken TAGS file for multi-line regex match Date: Sat, 19 Oct 2024 11:20:37 +0300 Message-ID: <86sessld0q.fsf@gnu.org> References: <87zfn9tmf4.fsf@ice9.digital> <86wmiduw93.fsf@gnu.org> <871q0ki8hj.fsf@tucano.isti.cnr.it> <86ldystb0b.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22298"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 73771-done@debbugs.gnu.org, morgan@ice9.digital To: pot@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 19 10:22:12 2024 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 1t24ix-0005Za-Gc for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 19 Oct 2024 10:22:11 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t24iX-00043P-Hj; Sat, 19 Oct 2024 04:21:45 -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 1t24iS-00042v-JM for bug-gnu-emacs@gnu.org; Sat, 19 Oct 2024 04:21:40 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t24iR-0003Kp-1Z for bug-gnu-emacs@gnu.org; Sat, 19 Oct 2024 04:21:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-version:References:In-Reply-To:From:Date:To:Subject; bh=UI3O5dDo6FsU6TclfEQW7K4AiGkz4+eBtIWs2UgkKCI=; b=Up7GEDqE3qi+jvoZqHte1Ce3loegZLiAsw7m3ZW/lhz7bNt5PGXClpO6DGETi8hD/MNBJPRfUzl2iVR7BQT7AMh7t2yRvHsQBOWuKNJ+r2uCebuZCAjCOXZdtQ5ggpH38N53paIZ1WeZYLoCz+d9jZfILBXHSRl7rTjJnsVBYeY/pRIX9vjA1mfoT/bEoOP0Sih1tv6ZH6MHNJllAqdtT+RHcbTkezbMbmqG97oWzg8ms855Dzq+H+TnBv7ispb8L2J78NixKZkkBH5jlQoSRiOXoMrleP87TU+wAz9fNCNOpVm4YFxRHrV2/l0Pe5KMvSz8zH0rq9i+NhHbks5l4w==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t24io-0002IR-Fs for bug-gnu-emacs@gnu.org; Sat, 19 Oct 2024 04:22:02 -0400 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Sat, 19 Oct 2024 08:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 73771 X-GNU-PR-Package: emacs Mail-Followup-To: 73771@debbugs.gnu.org, eliz@gnu.org, morgan@ice9.digital Original-Received: via spool by 73771-done@debbugs.gnu.org id=D73771.17293260708726 (code D ref 73771); Sat, 19 Oct 2024 08:22:02 +0000 Original-Received: (at 73771-done) by debbugs.gnu.org; 19 Oct 2024 08:21:10 +0000 Original-Received: from localhost ([127.0.0.1]:41282 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t24hx-0002Ge-Ot for submit@debbugs.gnu.org; Sat, 19 Oct 2024 04:21:10 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:50246) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t24hw-0002GR-1g for 73771-done@debbugs.gnu.org; Sat, 19 Oct 2024 04:21:08 -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 1t24hT-0003Gw-0V; Sat, 19 Oct 2024 04:20:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=UI3O5dDo6FsU6TclfEQW7K4AiGkz4+eBtIWs2UgkKCI=; b=Stx+b90ng5xKE0Zf7pDQ 2LZoXTQLx4AG0DBSRgGPwJmlqfUuXaJeWcewQ5TXQ/Ne4rOIMqfasf+6wnT5CWfWbAgVIM8Dn2YZG 8DImWiRN5FWZuzDuVZEcF1aKcoZIUEu87cLtg/4TQzg24YNWLMnLi1f8UFOoMS+l1F6hwfSEwJMNG UeYTXcWNHhRDlNxEOadzKXp5t3MvYFwbJOz2gqpcTmrMIY/Vt3KG8W+zVy0lgW3drvlDYGnFwmXCQ W28rNjA4PaFEkAL7COHoGd9z5EvJg/IfzvjDkhPE93nwkOYjkLPj59b3yCGTnwQ+Z0IxQzGzSkB8b WBtSY++VSUu/4w==; In-Reply-To: <86ldystb0b.fsf@gnu.org> (message from Eli Zaretskii on Sun, 13 Oct 2024 15:58:44 +0300) 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:293848 Archived-At: > Cc: 73771@debbugs.gnu.org, morgan@ice9.digital > Date: Sun, 13 Oct 2024 15:58:44 +0300 > From: Eli Zaretskii > > > From: Francesco Potort́ > > Date: Sun, 13 Oct 2024 12:48:40 +0200 > > Cc: 73771@debbugs.gnu.org, > > Morgan Willcock > > > > >This is because etags always records one extra character with the > > >regexp match, which is harmless, unless that extra character is a > > >newline. The patch below fixes it: > > > > > >diff --git a/lib-src/etags.c b/lib-src/etags.c > > >index a822a82..848d8ea 100644 > > >--- a/lib-src/etags.c > > >+++ b/lib-src/etags.c > > >@@ -7420,7 +7420,7 @@ regex_tag_multiline (void) > > > > > > /* Force explicit tag name, if a name is there. */ > > > pfnote (name, true, buffer + linecharno, > > >- charno - linecharno + 1, lineno, linecharno); > > >+ charno - linecharno, lineno, linecharno); > > > > > > if (debug) > > > fprintf (stderr, "%s on %s:%"PRIdMAX": %s\n", > > > > > >Francesco, why does the code add one more character there? > > > > While I can't remember the reason, I am sure it was not done by chance. > > > > Sure, I may have been wrong at that time, or maybe that reason is now obsolete. To check, one should run the etags regression test and check the results. > > I already did. The only differences I see are in that 1 extra > character, which is now no longer written to TAGS in the tests which > use multi-line regexps. > > Note that the change is only in this single call to pfnote, from the > code that is part of generating tags from multi-line regexp matches. > > > Off the top of my head, it may have to do with implicitly named tags that are initial substring of a different tag, but this may be a fake reconstruction of my mind, > > The tags we produce from regexp matches are norally explicitly named, > AFAICT: > > /* Match occurred. Construct a tag. */ > while (charno < rp->regs.end[0]) > if (buffer[charno++] == '\n') > lineno++, linecharno = charno; > name = rp->name; > if (name[0] == '\0') > name = NULL; > else /* make a named tag */ > name = substitute (buffer, rp->name, &rp->regs); > > /* Force explicit tag name, if a name is there. */ > pfnote (name, true, buffer + linecharno, > charno - linecharno, lineno, linecharno); > > But if you say that we should add that offset of 1 when 'name' is > NULL, I'm okay with doing that. I've decided to install the change on the master branch. Let's see what, if anything, it will break. I'm closing the bug with this message.