unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#14125: 24.3; "No such node or anchor: Top" for Info files created by makeinfo 5.1
@ 2013-04-02 16:47 Ulrich Mueller
  2013-04-02 23:47 ` Juri Linkov
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ulrich Mueller @ 2013-04-02 16:47 UTC (permalink / raw)
  To: 14125

[-- Attachment #1: message body text --]
[-- Type: text/plain, Size: 1087 bytes --]

Info-goto-node cannot find the "Top" node for some Info files
generated with makeinfo 5.1.

I've attached a minimal example of a Texinfo file where it fails.
To reproduce, save attached file as "test.texi".

   $ makeinfo --version
   makeinfo (GNU texinfo) 5.1
   [...]
   $ makeinfo --split-size=2000 test.texi
   $ ls -l test.info*
   -rw-r--r-- 1 ulm users  221 Apr  2 18:43 test.info
   -rw-r--r-- 1 ulm users 3017 Apr  2 18:43 test.info-1
   -rw-r--r-- 1 ulm users 1509 Apr  2 18:43 test.info-2
   $ emacs -Q
   C-h i
   g (/path/to/test.info) RET

The last command fails with an error: "No such node or anchor: Top"

The bug is not triggered if I use makeinfo 4.13 to create the Info
file from the same Texinfo source.

Not entirely sure if the problem is in Emacs or in makeinfo. I report
it here because standalone info (version 4.13 or 5.1) has no problem
with the files.

In GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, X toolkit)
 of 2013-03-26 on a1i15
Windowing system distributor `The X.Org Foundation', version 11.0.11400000
System Description:	Gentoo Base System release 2.2


[-- Attachment #2: test.texi --]
[-- Type: text/plain, Size: 4419 bytes --]

\input texinfo   @c -*-texinfo-*-
@c %**start of header
@setfilename test.info
@settitle Test
@c %**end of header

@ifnottex
lorem ipsum, quia dolor sit, amet, consectetur, adipisci velit, sed
quia non numquam eius modi tempora incidunt, ut labore et dolore
magnam aliquam quaerat voluptatem. ut enim ad minima veniam, quis
nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut
aliquid ex ea commodi consequatur? quis autem vel eum iure
reprehenderit, qui in ea voluptate velit esse, quam nihil molestiae
consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla
pariatur? At vero eos et accusamus et iusto odio dignissimos ducimus,
qui blanditiis praesentium voluptatum deleniti atque corrupti, quos
dolores et quas molestias excepturi sint, obcaecati cupiditate non
provident, similique sunt in culpa, qui officia deserunt mollitia
animi, id est laborum et dolorum fuga. et harum quidem rerum facilis
est et expedita distinctio. nam libero tempore, cum soluta nobis est
eligendi optio, cumque nihil impedit, quo minus id, quod maxime
placeat, facere possimus, omnis voluptas assumenda est, omnis dolor
repellendus. temporibus autem quibusdam et aut officiis debitis aut
rerum necessitatibus saepe eveniet, ut et voluptates repudiandae sint
et molestiae non recusandae. itaque earum rerum hic tenetur a sapiente
delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut
perferendis doloribus asperiores repellat.
@end ifnottex

@titlepage
@title Test
@page
@vskip 0pt plus 1filll
@end titlepage

@ifnottex
@node Top
@top Test

@end ifnottex

@menu
* First Chapter::    The first chapter.
* Second Chapter::   The second chapter.
@end menu

@node First Chapter
@chapter First Chapter
lorem ipsum, quia dolor sit, amet, consectetur, adipisci velit, sed
quia non numquam eius modi tempora incidunt, ut labore et dolore
magnam aliquam quaerat voluptatem. ut enim ad minima veniam, quis
nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut
aliquid ex ea commodi consequatur? quis autem vel eum iure
reprehenderit, qui in ea voluptate velit esse, quam nihil molestiae
consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla
pariatur? At vero eos et accusamus et iusto odio dignissimos ducimus,
qui blanditiis praesentium voluptatum deleniti atque corrupti, quos
dolores et quas molestias excepturi sint, obcaecati cupiditate non
provident, similique sunt in culpa, qui officia deserunt mollitia
animi, id est laborum et dolorum fuga. et harum quidem rerum facilis
est et expedita distinctio. nam libero tempore, cum soluta nobis est
eligendi optio, cumque nihil impedit, quo minus id, quod maxime
placeat, facere possimus, omnis voluptas assumenda est, omnis dolor
repellendus. temporibus autem quibusdam et aut officiis debitis aut
rerum necessitatibus saepe eveniet, ut et voluptates repudiandae sint
et molestiae non recusandae. itaque earum rerum hic tenetur a sapiente
delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut
perferendis doloribus asperiores repellat.

@node Second Chapter
@chapter Second Chapter
lorem ipsum, quia dolor sit, amet, consectetur, adipisci velit, sed
quia non numquam eius modi tempora incidunt, ut labore et dolore
magnam aliquam quaerat voluptatem. ut enim ad minima veniam, quis
nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut
aliquid ex ea commodi consequatur? quis autem vel eum iure
reprehenderit, qui in ea voluptate velit esse, quam nihil molestiae
consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla
pariatur? At vero eos et accusamus et iusto odio dignissimos ducimus,
qui blanditiis praesentium voluptatum deleniti atque corrupti, quos
dolores et quas molestias excepturi sint, obcaecati cupiditate non
provident, similique sunt in culpa, qui officia deserunt mollitia
animi, id est laborum et dolorum fuga. et harum quidem rerum facilis
est et expedita distinctio. nam libero tempore, cum soluta nobis est
eligendi optio, cumque nihil impedit, quo minus id, quod maxime
placeat, facere possimus, omnis voluptas assumenda est, omnis dolor
repellendus. temporibus autem quibusdam et aut officiis debitis aut
rerum necessitatibus saepe eveniet, ut et voluptates repudiandae sint
et molestiae non recusandae. itaque earum rerum hic tenetur a sapiente
delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut
perferendis doloribus asperiores repellat.

@bye

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#14125: 24.3; "No such node or anchor: Top" for Info files created by makeinfo 5.1
  2013-04-02 16:47 bug#14125: 24.3; "No such node or anchor: Top" for Info files created by makeinfo 5.1 Ulrich Mueller
@ 2013-04-02 23:47 ` Juri Linkov
  2013-04-30  6:50 ` Juri Linkov
       [not found] ` <87zjwgd1qx.fsf@mail.jurta.org>
  2 siblings, 0 replies; 6+ messages in thread
From: Juri Linkov @ 2013-04-02 23:47 UTC (permalink / raw)
  To: Ulrich Mueller; +Cc: 14125

> Info-goto-node cannot find the "Top" node for some Info files
> generated with makeinfo 5.1.

Thanks for the bug report.

> Not entirely sure if the problem is in Emacs or in makeinfo. I report
> it here because standalone info (version 4.13 or 5.1) has no problem
> with the files.

There is a difference between the output of makeinfo 4.13 and 5.1
that the Info reader doesn't handle.  I'm not sure whether it's a bug
in makeinfo 5.1 (maybe not) but in the tag table it outputs
the position of the beginning of the Info header of the indirect
Info file instead of the position of the beginning of the first node.

The following comment in `Info-find-node-2' in info.el:

	      ;; Now search from our advised position (or from beg of
	      ;; buffer) to find the actual node.  First, check
	      ;; whether the node is right where we are, in case the
	      ;; buffer begins with a node.

says that first it searches from the advised position (that is different
now in the Info files produced by makeinfo 5.1, so the reader overshoots).
If this fails it says that then it searches from the beginning of the
buffer (this would allow to find the Top node) but actually code doesn't do
what the comment says.  Currently I'm trying the solution that searches
from the beginning of the buffer.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#14125: 24.3; "No such node or anchor: Top" for Info files created by makeinfo 5.1
  2013-04-02 16:47 bug#14125: 24.3; "No such node or anchor: Top" for Info files created by makeinfo 5.1 Ulrich Mueller
  2013-04-02 23:47 ` Juri Linkov
@ 2013-04-30  6:50 ` Juri Linkov
       [not found] ` <87zjwgd1qx.fsf@mail.jurta.org>
  2 siblings, 0 replies; 6+ messages in thread
From: Juri Linkov @ 2013-04-30  6:50 UTC (permalink / raw)
  To: 14125; +Cc: bug-texinfo

[Cc'ing to bug-texinfo for reference, thread started at
 http://lists.gnu.org/archive/html/bug-gnu-emacs/2013-04/msg00039.html ]

> Info-goto-node cannot find the "Top" node for some Info files
> generated with makeinfo 5.1.

Makeinfo 5.0 changes in arithmetic of node positions in the tag table
makes Info files with the summary segment longer than a thousand characters
unreadable by the Emacs Info reader.

Makeinfo 4.13 produced the character positions of indirect subfiles
relative to the beginning of the first node, but Makeinfo 5.0 produces the
positions relative to the beginning of the subfile.  The Emacs Info reader
fails when the distance between the beginning of the subfile and
the beginning of its first node is longer than a thousand characters.

Both addressing schemes are valid and both make sense.  But to able to support
Info files produced by Makeinfo 5.0/1 the Emacs Info reader needs to be fixed.

The expression (+ (- nodepos lastfilepos) (point)) in `Info-read-subfile'
assumes that `lastfilepos' in `Info-read-subfile' is the beginning of the
first node, so for Info files produced by Makeinfo 4.13 it returns the
length of the summary segment, but for Makeinfo 5.0 it returns
two lengths of the summary segment.

The following patch changes it to return (point-min) for 4.13 and
the length of the summary segment for 5.0.  Since this code was merely
an optimization to skip the summary segment, this change shouldn't break
reading of Info files produced by Makeinfo 4.13 and older versions where
`Info-find-node-2' will start searching for the node in the summary segment.
However, this part of `Info-read-subfile'

    (if (looking-at "\^_")
	(forward-char 1)
      (search-forward "\n\^_"))

should be left unchanged for `Info-search' to not search in the summary segment.

The minimal patch to support all Makeinfo versions:

=== modified file 'lisp/info.el'
--- lisp/info.el	2013-04-22 06:41:30 +0000
+++ lisp/info.el	2013-04-30 06:49:35 +0000
@@ -1545,7 +1545,7 @@ (defun Info-read-subfile (nodepos)
 	(forward-char 1)
       (search-forward "\n\^_"))
     (if (numberp nodepos)
-	(+ (- nodepos lastfilepos) (point)))))
+	(+ (- nodepos lastfilepos) (point-min)))))
 
 (defun Info-unescape-quotes (value)
   "Unescape double quotes and backslashes in VALUE."






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#14125: 24.3; "No such node or anchor: Top" for Info files created by makeinfo 5.1
       [not found] ` <87zjwgd1qx.fsf@mail.jurta.org>
@ 2013-05-05  4:40   ` Stefan Monnier
  2013-05-05  8:49     ` Juri Linkov
       [not found]   ` <20130824071927.GA8566@free.fr>
  1 sibling, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2013-05-05  4:40 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 14125, bug-texinfo

> === modified file 'lisp/info.el'
> --- lisp/info.el	2013-04-22 06:41:30 +0000
> +++ lisp/info.el	2013-04-30 06:49:35 +0000
> @@ -1545,7 +1545,7 @@ (defun Info-read-subfile (nodepos)
>  	(forward-char 1)
>        (search-forward "\n\^_"))
>      (if (numberp nodepos)
> -	(+ (- nodepos lastfilepos) (point)))))
> +	(+ (- nodepos lastfilepos) (point-min)))))
 
>  (defun Info-unescape-quotes (value)
>    "Unescape double quotes and backslashes in VALUE."

I don't know enough about Info to judge whether that's right.
So if nobody objects, please install,


        Stefan





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#14125: 24.3; "No such node or anchor: Top" for Info files created by makeinfo 5.1
  2013-05-05  4:40   ` Stefan Monnier
@ 2013-05-05  8:49     ` Juri Linkov
  0 siblings, 0 replies; 6+ messages in thread
From: Juri Linkov @ 2013-05-05  8:49 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 14125-done, bug-texinfo

Version: 24.4

> So if nobody objects, please install,

I installed it to the trunk.  In case of releasing the next version
from emacs-24 branch it would make sense to backport it to that branch
before the next release (even though this is not a regression)
to support Info files with summaries longer than 1000 characters
created by makeinfo 5.1, sooner than later.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#14125: 24.3; "No such node or anchor: Top" for Info files created by makeinfo 5.1
       [not found]   ` <20130824071927.GA8566@free.fr>
@ 2013-08-24 23:54     ` Juri Linkov
  0 siblings, 0 replies; 6+ messages in thread
From: Juri Linkov @ 2013-08-24 23:54 UTC (permalink / raw)
  To: Patrice Dumas; +Cc: 14125, bug-texinfo

> I think that this was a bug, bytes of text appearing before the
> first node were not correctly counted, but the behaviour you describe
> should be the correct one (we even documented it in the info
> specification part of the Texinfo manual).
>
> It was compounded by a backward incompatible change of not having the
> same preamble for an info subfiles, as explained to me by Sergey.
>
> Not having the same preamble, especially for the first node with the tag
> table and the other could well become the norm after some decades, so,
> in general, if you can make the Info reader as robust as possible (if
> not already), that would be fine.
>
> The standalone info reader has an option --strict-node-location and you
> can see that it had trouble with your test when using that option,
> which should show that there is an issue in the Info file.

I believe we made the Emacs Info reader robust enough to handle
both old and new formats of preamble.  Regarding the option
--strict-node-location in the standalone Info reader,
we could create a similar option in the Emacs Info reader
with a name like `Info-strict-node-location', but I doubt
that many users might want to use it since it's intended
for debugging, and Emacs has a built-in debugger for that.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-08-24 23:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-02 16:47 bug#14125: 24.3; "No such node or anchor: Top" for Info files created by makeinfo 5.1 Ulrich Mueller
2013-04-02 23:47 ` Juri Linkov
2013-04-30  6:50 ` Juri Linkov
     [not found] ` <87zjwgd1qx.fsf@mail.jurta.org>
2013-05-05  4:40   ` Stefan Monnier
2013-05-05  8:49     ` Juri Linkov
     [not found]   ` <20130824071927.GA8566@free.fr>
2013-08-24 23:54     ` Juri Linkov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).