GNU bug report logs - #20704
info.el bug fix; Interprets Info format wrongly

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Teddy Hogeborn <teddy@HIDDEN>; Keywords: patch; merged with #13431; dated Sun, 31 May 2015 17:53:03 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Added tag(s) patch. Request was from Teddy Hogeborn <teddy@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Forcibly Merged 13431 20704. Request was from Teddy Hogeborn <teddy@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 31 May 2015 17:52:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 31 13:52:52 2015
Received: from localhost ([127.0.0.1]:35064 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Yz7Pm-0002AU-JI
	for submit <at> debbugs.gnu.org; Sun, 31 May 2015 13:52:51 -0400
Received: from eggs.gnu.org ([208.118.235.92]:46525)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <teddy@HIDDEN>) id 1Yz4d6-0006Zp-OO
 for submit <at> debbugs.gnu.org; Sun, 31 May 2015 10:54:25 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <teddy@HIDDEN>) id 1Yz4d0-0004FF-NW
 for submit <at> debbugs.gnu.org; Sun, 31 May 2015 10:54:19 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_20 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:48378)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <teddy@HIDDEN>) id 1Yz4d0-0004FB-Ka
 for submit <at> debbugs.gnu.org; Sun, 31 May 2015 10:54:18 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:60022)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <teddy@HIDDEN>) id 1Yz4cz-0004sL-BQ
 for bug-gnu-emacs@HIDDEN; Sun, 31 May 2015 10:54:18 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <teddy@HIDDEN>) id 1Yz4cw-0004Dc-54
 for bug-gnu-emacs@HIDDEN; Sun, 31 May 2015 10:54:17 -0400
Received: from tower.recompile.se ([88.80.28.95]:55630)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <teddy@HIDDEN>) id 1Yz4cv-0004DN-Uf
 for bug-gnu-emacs@HIDDEN; Sun, 31 May 2015 10:54:14 -0400
Received: from localhost (localhost [127.0.0.1])
 by tower.recompile.se (Postfix) with ESMTP id A654736E530;
 Sun, 31 May 2015 16:54:09 +0200 (CEST)
Received: by tower.recompile.se (Postfix, from userid 1000)
 id 7858336E4C9; Sun, 31 May 2015 16:54:09 +0200 (CEST)
From: Teddy Hogeborn <teddy@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: info.el bug fix; Interprets Info format wrongly
Date: Sun, 31 May 2015 16:54:05 +0200
Message-ID: <87d21gpzle.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Sun, 31 May 2015 13:52:48 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

--=-=-=
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

The Info file format (see (texinfo)Info Format Tag Table.)  is
documented as having the reference position in bytes.  However, the
info.el functions "Info-find-in-tag-table-1", "Info-read-subfile", and
"Info-search" reads the byte value and adds it to (point-min), which is
a character position, not a byte position.  This causes the Emacs Info
reader to jump to the wrong position in Info files with a lot of
non-ascii characters.  Solution: Convert the read value to position
using byte-to-position:

diff --git a/lisp/info.el b/lisp/info.el
index 80428e7..b179510 100644
=2D-- a/lisp/info.el
+++ b/lisp/info.el
@@ -1020,7 +1020,8 @@ which the match was found."
       (beginning-of-line)
       (when (re-search-forward regexp nil t)
 	(list (string-equal "Ref:" (match-string 1))
=2D	      (+ (point-min) (read (current-buffer)))
+	      (+ (point-min) (byte-to-position
+                              (read (current-buffer))))
 	      major-mode)))))
=20
 (defun Info-find-in-tag-table (marker regexp &optional strict-case)
@@ -1523,7 +1524,9 @@ is non-nil)."
 			thisfilepos thisfilename)
 		    (search-forward ": ")
 		    (setq thisfilename  (buffer-substring beg (- (point) 2)))
=2D		    (setq thisfilepos (+ (point-min) (read (current-buffer))))
+		    (setq thisfilepos (+ (point-min)
+                                         (byte-to-position
+                                          (read (current-buffer)))))
 		    ;; read in version 19 stops at the end of number.
 		    ;; Advance to the next line.
 		    (forward-line 1)
@@ -2013,9 +2016,11 @@ If DIRECTION is `backward', search in the reverse di=
rection."
 		        (re-search-backward "\\(^.*\\): [0-9]+$")
 		      (re-search-forward "\\(^.*\\): [0-9]+$"))
 		    (goto-char (+ (match-end 1) 2))
=2D		    (setq list (cons (cons (+ (point-min)
=2D					      (read (current-buffer)))
=2D					   (match-string-no-properties 1))
+		    (setq list (cons (cons
+                                      (+ (point-min)
+                                         (byte-to-position
+                                          (read (current-buffer))))
+                                      (match-string-no-properties 1))
 				     list))
 		    (goto-char (if backward
                                    (1- (match-beginning 0))

Suggested ChangeLog:

=2D---
Convert reference byte positions from Info file to character position.

* lisp/info.el (Info-find-in-tag-table-1, Info-read-subfile)
(Info-search): Convert position read from Info file from bytes to
character position.  Patch by Teddy Hogeborn <teddy@HIDDEN>.
=2D---

/Teddy Hogeborn

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCAAGBQJVayCNAAoJEOubGwHeBXLk9cYQAJ6KYtVDeXZxTT7Nx9ISK0zQ
soMH6XJbjeWVCzounDoVCS/fZdrLbmmrPQO9SLlC34AWpfeE/CjHqHQlCFO22M68
6N/tJjQ5Zy7t6nH2i9p3KRfoohmZpewCMwvmW9EY7BapwDBezG8xzkpr3mhgYfUV
S+0DyLB3pElkxDhemcrjVLsGbtSqvBnjyIFWV//jLNmy2c/edMWP+RaNI3h/6x2I
uvX0d+4cOLIgVLGGdUkO2EYTn9Vtzqb3tOjLTkDkACywtma+bgDMzsap9vcQjI+l
oioi9HPs+awW99hDs19lfiuKx2Qi3kglSKbkJeffTbO9fFg+VdfufKTosA2/GOP3
KSHWIKuWwYlr5nCpcWpBd3/pn6xXL6QKFBMwnK0vZRglJgtFQpXGB/h/CLH6khzj
GANWnm0wV5R6l/w5zxF5MLVH2wqUKZJjm8klK00iPQtrY/m+0WF6iRk5dO9MjOla
Z0iQgLTBH1B81yCCisXEMld44GgQAFb9shQN4/8yYAhnQ53mftkMgZiq6wmoOl/S
AxR362KfWpRrKn/zDdbDH0/lrzUS8XNKFH/pCX7gxoxuB4Isdt9oBypw+2mLjhjt
RuiFWRztPTEoaWsev0nMBhzEDdXrKvTrkfsFWDUqHHBpqTYQF1sobo32MsKq7/NB
UAZlLhjc5xs8jFJzFLzV
=Ccju
-----END PGP SIGNATURE-----
--=-=-=--




Acknowledgement sent to Teddy Hogeborn <teddy@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#20704; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 31 May 2015 18:45:03 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.