On one hand, this is the behavior described in comment:
$spadroot was $FRICAS during build time.

;;; Sets up the system to use the {\bf FRICAS} shell variable if we can
;;; and default to the {\bf \$spadroot} variable (which was the value
;;; of the {\bf FRICAS} shell variable at build time) if we can't.
;;; Use the parent directory of FRICASsys binary as fallback.
(defun initroot (&optional (newroot nil))

On the other hand, this mechanism seems not used during build:
It is called in "interpsys-image-init" which involves INTERPSYS,
but all INTERPSYS calls have valid $FRICAS to it.

====

Following patch sets $spadroot to empty string before dump lisp image.
This builds fine and tests are passed.

A complete patch will need to correct previously mentioned comment
and need more thorough review.

- Qian

diff --git a/src/interp/util.lisp b/src/interp/util.lisp
index ffce3d1f..3dab3e77 100644
--- a/src/interp/util.lisp
+++ b/src/interp/util.lisp
@@ -330,6 +330,7 @@
 (defun spad-save (save-file do-restart)
   (setq |$SpadServer| nil)
   (setq $openServerIfTrue t)
+  (setq $spadroot "")
   (FRICAS-LISP::save-core-restart save-file
          (if do-restart #'boot::fricas-restart nil))
 )


On 9/23/23 23:16, Waldek Hebisch wrote:
On Sat, Sep 23, 2023 at 04:27:36PM +0200, Grégory Vanuxem wrote:
UPDATE

if I delete the build directory, home/greg//Tmp/fricas, all is right.

<snip>
└─$ /usr/local/lib/fricas/target/x86_64-linux-gnu/bin/FRICASsys
Checking for foreign routines
FRICAS="/home/greg/Tmp/fricas/target/x86_64-linux-gnu"
spad-lib="/home/greg/Tmp/fricas/target/x86_64-linux-gnu/lib/libspad.so"

Unfortunately, this is expected effect of our current logic.
We probably should reset $spadroot to NIL when dumping an image.
Or maybe we should do this at image startup.

Security folks consider hardcoded paths to build directories
as voulnerability: when FriCAS is installed systemwide person
who can write to hardcoded location can cause other folks
to execute arbitrary program instead of FriCAS.


--
You received this message because you are subscribed to the Google Groups "FriCAS - 
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/82eb62bf-4503-40b2-8137-425c44949791%40gmail.com.

Reply via email to