Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 maxima (5.38.0-2) unstable; urgency=medium
 .
   * fix i386 test failure
Author: Camm Maguire <camm@debian.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

Index: maxima-5.40.0/src/cl-info.lisp
===================================================================
--- maxima-5.40.0.orig/src/cl-info.lisp
+++ maxima-5.40.0/src/cl-info.lisp
@@ -53,6 +53,8 @@
   "splice a '/' between the path components given as arguments"
   (format nil "~{~A~^/~}" list))
 
+(defvar maxima::*maxima-index-dir* nil)
+
 (defun load-primary-index ()
   (declare (special maxima::*maxima-lang-subdir* maxima::*maxima-infodir*))
   ;; Load the index, but make sure we use a sensible *read-base*.
@@ -61,7 +63,7 @@
   ;; with-standard-io-syntax too much for what we want?
   (let*
       ((subdir-bit (or maxima::*maxima-lang-subdir* "."))
-       (path-to-index (maxima::combine-path maxima::*maxima-infodir* subdir-bit "maxima-index.lisp")))
+       (path-to-index (maxima::combine-path (or maxima::*maxima-index-dir* maxima::*maxima-infodir*) subdir-bit "maxima-index.lisp")))
     (handler-case
 	#-gcl
       (with-standard-io-syntax (load path-to-index))
@@ -225,7 +227,12 @@
 
 ; --------------- build help topic indices ---------------
 
-(defun load-info-hashtables (dir-name deffn-defvr-pairs section-pairs)
+(defun load-info-hashtables (dir-name deffn-defvr-pairs section-pairs
+				      ;; In Debian, lsp index file must be in different directory from info files
+				      &aux (dir-name (or (car (member-if 'probe-file
+									 (list dir-name (maxima::combine-path maxima::*maxima-infodir* ""))
+							      :key (lambda (x) (merge-pathnames (make-pathname :name "maxima" :type "info") x nil))))
+							 dir-name)))
   (if (and (zerop (length section-pairs)) 
            (zerop (length deffn-defvr-pairs)))
     (format t (intl:gettext "warning: ignoring an empty documentation index in ~a~%") dir-name)
