Per (texinfo) @anchor:

   You may wish to create cross-references to arbitrary positions in a
   document, not just to the beginning of nodes.  The ‘@anchor’ command
   marks such a position in your document, called an “anchor”.  Put an
   ‘@anchor’ command just before the position you wish to refer to.  For
   example:

   ...

      When you delete or rename a node, it is usually a good idea to define
   an ‘@anchor’ with the old name.  That way, any links to the old node,
   whether from other Texinfo manuals or general web pages, keep working.

Indeed, we did just that.  And placed @anchor above the new node into
which old node contents were merged.  But, the enchors ended up
generating redirects to the wrong node!

Consider the following simplified example:

  \input texinfo
  @settitle Bug!
  
  @contents
  
  @node Top
  @top Buggy!
  
  Foo bar baz.
  
  @anchor{Anchor}
  @node Anchored
  Very cool!
  
  @bye

... this generates:

  ~/gnu/texinfo/bugrep$ ls bugrep_html/
  Anchored.html  Anchor.html  index.html

So far, so good.

We'd expect Anchor.html to have a redirect into Anchored.html, but
instead:

  ~/gnu/texinfo/bugrep$ grep Refresh bugrep_html/Anchor.html 
  <meta http-equiv="Refresh" content="0; url=index.html#Anchor">

... i.e. it went into the top node!

This is currently presenting a problem for GCC, where we merged a ton of
nodes to make the manual more navigable, and set up redirects via
anchors, but those redirects now go into an unrelated node.

Note that a node may have arbitrarily many anchors (indeed, we have
between two and six in various cases).

I recall that a similar issue once happened with @*index commands, which
lead to people developing a habit of placing @*index after whatever they
were indexing (e.g. @item ... @*index) - I worry there may be similar
code "in the wild" for @anchor, which "fixes" this issue in their .texi
even though the actual issue is in texi2any, so it may be worth also
adding a warning.

Thanks in advance, have a lovely day!
-- 
Arsen Arsenović

Attachment: signature.asc
Description: PGP signature

Reply via email to