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.47.0-1) unstable; urgency=medium
 .
   * New upstream release.
   * Bug fix: "CVE-2024-34490", thanks to Moritz Mühlenhoff (Closes:
     #1071630).
Author: Camm Maguire <camm@debian.org>
Bug-Debian: https://bugs.debian.org/1071630

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

Origin: (upstream|backport|vendor|other), (<patch-url>|commit:<commit-id>)
Bug: <upstream-bugtracker-url>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: (no|not-needed|<patch-forwarded-url>)
Applied-Upstream: <version>, (<commit-url>|commit:<commid-id>)
Reviewed-By: <name and email of someone who approved/reviewed the patch>
Last-Update: 2024-05-23

--- maxima-5.47.0.orig/src/cl-info.lisp
+++ maxima-5.47.0/src/cl-info.lisp
@@ -61,11 +61,13 @@
   "splice a '/' between the path components given as arguments"
   (format nil "~{~A~^/~}" list))
 
+(defvar maxima::*maxima-index-dir* nil)
+
 (defun load-primary-index ()
   ;; Is 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"))
        (path-to-html-index
 	 (maxima::combine-path maxima::*maxima-infodir* subdir-bit "maxima-index-html.lisp")))
     ;; Set the default of the html URL base to be a file URL pointing
@@ -251,7 +253,13 @@
 
 ; --------------- 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 (when (equal (pathname (concatenate 'string maxima::*maxima-index-dir* "/"))
+						    dir-name)
+					 (maxima::combine-path maxima::*maxima-infodir* ""))
+				       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)
