On Mon, Sep 28, 2026 at 05:30:35PM +0100, Gavin Smith wrote:
> I did find a possible bug with parentheses:
> 
>   \input texinfo
>   
>   @node Top
>   @top
>   
>   in top.
>   
>   @node One:
>   @chapter One:
>   
>   AA.
>   
>   @chapter (Two)
>   
>   AA.
>   
>   @bye
> 
> Here, "texi2any -c TREE_TRANSFORMATIONS=insert_nodes_for_sectioning_commands"
> fails to issue a warning for the "(Two)" node, and the node name is output
> in the menu in "Top" without any protection, as:
> 
> * (Two)::
> 
> This link then fails to work in "info".
> 
> With an explicit line "@node (Two)" preceding the @chapter line, I get a
> hard error:
> 
> shadow-node-name.texi:13: syntax for an external node used for `(Two)'
> 
> However, you can still get output by wrapping the opening ( with @asis{...}:
> 
> @node @asis{(}Two)
> 
> Again, here texi2any produces a non-functional menu entry to "(Two)", without
> issuing a warning.
> 
> This suggests the lack of a warning is not specific to
> insert_nodes_for_sectioning_commands.  The warning that does exist is probably
> a syntax error of @node, not from a check of the resulting node name itself.
> 
> The correct output for a node name of "(Two)" would be for the node name to
> be wrapped in DEL bytes in most contexts.
> 
> Similar use of @asis{...} to produce "forbidden" node names does lead to a
> warning, as in "@node Two@asis{,}" (or "@chapter Two@asis{,}" with no @node),
> so presumably the case of a node name beginning with what looks like an
> external manual is just an omission from the node name validity checking.

As can be seen by calling like:
./texi2any.pl paren.texi -c DUMP_STRUCTURE=-

the (Two) is protected on the generated @node line:
 *@node C1 paren.texi:l13 {@asis{(}Two)}
 |EXTRA
 |added:{1}
 |identifier:{_0028Two_0029}
 |is_target:{1}
 |node_number:{3}
  *arguments_line C1
   *line_arg C4
    {spaces_before_argument: }
    *@asis C1
     *brace_container C1
      {(}
    {Two)}
    {spaces_after_argument:\n}

The probable reason why it is not DEL-quoted in Info is because
this is a valid external manual, therefore it is hard to detect that
it should be quoted in menu or as a node direction.  A possible rule
would be that if a node with the same name exists, the node should be
quoted.  If a manual with the same name exists, it will prevent
references in menus and node directions to that manual, but it is not so
bad, I think.

-- 
Pat

Reply via email to