On Sat, Jul 11, 2026 at 12:48:51PM +0000, ThomB wrote:
> Hello there.
>
> There is a bug in the standalone info viewer (v7.3) where index entries can be
> parsed incorrectly if the target node is del-quoted. You can see this by
> issuing, for example:
>
> info texi2any_internals --index-search xml_accent
>
> You should see a message that the node wasn't found.
Yes, and the program is then prone to crash with a segmentation fault,
as there is no node being displayed (which Info isn't set up to support).
It appears from the comment in the part of the code you found to be responsible
that node names containing colons was not envisioned:
/* If in an index node, go forward to the last colon on the line
(not preceded by a newline, NUL or DEL). This is in order to
support index entries containing colons. This should work fine
as long as the node name does not contain a colon as well. */
I'll be happy to include your test (it's under the threshold for requiring
a copyright assignment to the FSF).
Your fix looks right, but please allow me some time to think about it.
> It seems to be because DEL is not considered when reading the index entry
> label
> in `scan_reference_label()` in info/scan.c, causing the scan to continue past
> it. In the example above the label becomes:
>
> "xml_accent: ^?Texinfo::Convert:"
>
> and so the target node then becomes:
>
> "Converter Conversion to XML^?"
>
> instead of the label correctly being read as "xml_accent" and the rest as the
> node name.
>
> I solved this locally by including '\177' in the delimiter string in the call
> to
> `strcspn()` at info/scan.c:1154.
>
> I am not familiar with the rest of the codebase so I'm not sure if this would
> be
> the right way to fix it. Nevertheless I'll attempt to attach two diffs you can
> use if you'd like; one has the described fix, the other adds a test that
> checks
> that an index entry with a del-quoted target node is split correctly.
>
> Thomas.
>
>
>
>
>
>
> diff --git a/info/Makefile.am b/info/Makefile.am
> index 468f19b33a..94c97f4242 100644
> --- a/info/Makefile.am
> +++ b/info/Makefile.am
> @@ -206,6 +206,7 @@ info_tests = \
> t/spec-menu.sh \
> t/empty.sh \
> t/index-paren.sh \
> + t/quoted-index-target.sh \
> t/help.sh
>
> TESTS = $(info_tests)
> diff --git a/info/t/infodir/quoting.info b/info/t/infodir/quoting.info
> index 39347b636f..f463edf3d1 100644
> --- a/info/t/infodir/quoting.info
> +++ b/info/t/infodir/quoting.info
> @@ -11,9 +11,21 @@ File: quoting.info, Node: Top, Next: Colon::in, name,
> File: quoting.info, Node: Colon::in, name
>
> *Note (intera)Node 1::
> +
>
> +File: quoting.info, Node: Index
> +
> + [index ]
> +
> +* Menu:
> +
> +* Colon::in, name: Colon::in, name
> +
> +
> +
> Tag Table:
> Node: Top0
> Node: Colon::in, name256
> +Node: Index327
>
> End Tag Table
> diff --git a/info/t/quoted-index-target.sh b/info/t/quoted-index-target.sh
> new file mode 100755
> index 0000000000..a364cce357
> --- /dev/null
> +++ b/info/t/quoted-index-target.sh
> @@ -0,0 +1,31 @@
> +#!/bin/sh
> +# Copyright (C) 2014-2026 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, 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 <https://www.gnu.org/licenses/>.
> +
> +srcdir=${srcdir:-.}
> +. $srcdir/t/Init-test.inc
> +
> +# Perform an index search for a quoted target
> +$ginfo --file quoting --index-search "Colon::in, name" --all >$ginfo_output
> +
> +# Test that the found index entry has the correct node name. An index entry
> +# split in the wrong place should not match this RE, rather be shaped
> something
> +# like "* Colon::in, name: ^?Colon:: in. (line 0)"
> +grep '\* Colon::in, name:[[:blank:]]\{1,\}Colon::in, name' $ginfo_output
> +
> +retval=$?
> +
> +cleanup
> +
> diff --git a/info/scan.c b/info/scan.c
> index 1b01ab5220..24ef0df310 100644
> --- a/info/scan.c
> +++ b/info/scan.c
> @@ -1151,7 +1151,7 @@ scan_reference_label (REFERENCE *entry, int in_index)
>
> while (1)
> {
> - n = strcspn (p, ":\n");
> + n = strcspn (p, "\177:\n");
> if (p[n] == ':')
> {
> m += n + 1;