On Sun, Sep 24, 2023 at 08:20:45AM +0800, Qian Yun wrote:
> 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.
This behaviour clearly was intended as a convenience feature for
developers. But times have changed and FriCAS code changed,
so it is now not needed.
ATM it is not clear to me what should we write in the comment.
Most of the comment is redundant, it repeats in impreciase
way what is clearly expressed by code. And extra info
(about $spadroot) is going to be invalid.
To say the truth, it is not clear to me if initroot should
look at $spadroot at all.
Currently we have 4 ways to get base location of FriCAS:
1) FRICAS environment variable
2) argument to build-interpsys
3) location inferred from path to FriCASsys
4) remembered value of $spadroot
ATM I do not know if remembered $spadroot can be used except for
values restored from an image (which is currently used but should
be not used).
> ====
>
> 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.
--
Waldek Hebisch
--
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/ZRA8qpeBXtDRFAZz%40fricas.org.