Subject: Re: bug#61395: 28.2; bug-reference warning seems incorrect

From: Tom Tromey <[email-masked]>
Date: Fri, 10 Feb 2023 11:25:09 -0700

Tassilo> If you can reproduce the issue, try changing
Tassilo> `bug-reference--overlay-bounds' so that the check

Tassilo>   (member bug-reference-bug-regexp
Tassilo>           bug-reference--nonconforming-regexps)

Ok, I can reproduce it now.

I removed this bit from bug-reference--overlay-bounds:

        (setq bug-reference--nonconforming-regexps
              (cons bug-reference-bug-regexp
                    bug-reference--nonconforming-regexps))

Then I set bug-reference--nonconforming-regexps to nil.
This combination means I can see the warning any time.

The gdb .dir-locals.el has this setting:

 (bug-reference-url-format . "http://sourceware.org/bugzilla/show_bug.cgi?id=%s")

I can send the whole file if you want, but I think this is the only
relevant part.

I've appended a file from gdb.  This is a .exp (dejagnu script) file,
which should use tcl-mode.

I have this code to enable bug reference mode:

(defun tromey-maybe-enable-bug-url-mode ()
  (and (boundp 'bug-reference-url-format)
       (stringp bug-reference-url-format)
       (if (or (derived-mode-p 'prog-mode)
	       (eq major-mode 'tcl-mode)	;emacs 23 bug
	       (eq major-mode 'makefile-mode)) ;emacs 23 bug
	   (bug-reference-prog-mode t)
	 (bug-reference-mode t))))

(add-hook 'find-file-hook #'tromey-maybe-enable-bug-url-mode)

LOL workarounds for emacs 23.

Anyway, I switched back to the .exp buffer and re-opened the file (C-x
C-v RET).  I saw the warning again.

thanks,
Tom

# Copyright (C) 2019-2023 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

standard_testfile realname-expand.c realname-expand-real.c

# Compiling on a remote host does not support a filename with
# directory.
require {!is_remote host}

set srcdirabs [file join [pwd] $srcdir]
set srcfilelink [standard_output_file realname-expand-link.c]

remote_exec build "ln -sf ${srcdirabs}/${subdir}/${srcfile2} $srcfilelink"

if { [file type $srcfilelink] != "link" } {
    unsupported "target directory cannot have symbolic links"
    return -1
}

if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcfilelink}" "${binfile}" \
		  executable {debug}] != "" } {
    untested "failed to compile"
    return -1
}

clean_restart ${testfile}

if {![runto_main]} {
    return -1
}

gdb_breakpoint func message

gdb_test_no_output "set annotate 1"

# The patch to cause this output was reverted.
# See PR breakpoints/24915.
setup_xfail *-*-* 24915
gdb_test "continue" \
    "Breakpoint .* func .*realname-expand-link.c:$decimal\r\n\032\032.*realname-expand-link.c:.*"