Recent change to use sb-posix:chdir

7 views
Skip to first unread message

Grégory Vanuxem

unread,
Apr 26, 2026, 1:47:33 PM (5 days ago) Apr 26
to fricas...@googlegroups.com
Hello,

Is it what is expected? I find this relatively annoying since sometimes FriCAS falls sometimes in the ldb after:

(the directory hh does not exist):

(1) -> )cd hh

   >> System error:
   Error in SB-POSIX:CHDIR: No such file or directory (2)

Greg

PS: on Debian based Linux in WSL2

Qian Yun

unread,
Apr 26, 2026, 5:44:42 PM (5 days ago) Apr 26
to fricas...@googlegroups.com
Yes, it is caused by recent change.

The error handling behavior was not consistent across Lisps before,
I can add it for all Lisps.

- Qian
> --
> 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 fricas-devel...@googlegroups.com <mailto:fricas-
> devel+un...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/fricas-
> devel/CAHnU2dYX4n36sui0tjJkN2-
> zetWs8bJrsiUqtsPw1U3bvjViNw%40mail.gmail.com <https://groups.google.com/
> d/msgid/fricas-devel/CAHnU2dYX4n36sui0tjJkN2-
> zetWs8bJrsiUqtsPw1U3bvjViNw%40mail.gmail.com?
> utm_medium=email&utm_source=footer>.

Waldek Hebisch

unread,
Apr 26, 2026, 7:31:00 PM (5 days ago) Apr 26
to fricas...@googlegroups.com
On Mon, Apr 27, 2026 at 05:44:38AM +0800, Qian Yun wrote:
> Yes, it is caused by recent change.
>
> The error handling behavior was not consistent across Lisps before,
> I can add it for all Lisps.

We have error handler, if control goes to error handler, then IMO
this is OK. Unhandled errors causing crash/falling to ldb are
very bad. Previous code only did sb-posix:chdir if probe-file
succeded, this guards against non-existent directory, but
calls sb-posix:chdir for files which also signals error.

In both cases, I see that error is caught by the handler. I do
not know what may cause crash.
> To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/fricas-devel/6a1b38d3-e411-489b-a6df-968724b498ca%40gmail.com.

--
Waldek Hebisch

Qian Yun

unread,
Apr 26, 2026, 8:24:49 PM (5 days ago) Apr 26
to fricas...@googlegroups.com
It didn't crash later on my side.

I was thinking about wrapping "chdir" inside "ignore-errors".
(And return 0 if success. This change needs testing.)

Previously, "probe-file" can detect non-exist directory,
but it can't detect no permission directory.

- Qian

Grégory Vanuxem

unread,
Apr 27, 2026, 1:37:52 AM (4 days ago) Apr 27
to fricas...@googlegroups.com
Le lun. 27 avr. 2026 à 02:24, Qian Yun <oldk...@gmail.com> a écrit :
It didn't crash later on my side.

After some tests, that comes from me, some bad interactions known to me between SBCL and Mathematica used through a Julia package (MathLink). Starting HyperDoc during a FriCAS session for example when working with MMA domains. I was working on one of them. I use without problem Hunchentoot or Yason CL packages but I didn't know this bad interaction with sb-posix. The sequence of commands was something like:

(1) -> x:=jWSExpr x

   (1)  x
                                               Type: WSExpression
(2) -> legendreQ(3,x)

   (2)

                        2     1               log(1 + x)
          2   x (3 - 5 x ) (-(-) log(1 - x) + ----------)
   2   5 x                    2                   2
   - - ---- - -------------------------------------------
   3    2                          2
                                               Type: WSExpression
(3) -> )cd hh

   >> System error:
   Error in SB-POSIX:CHDIR: Aucun fichier ou dossier de ce nom (2)

(3) -> )sys ls
build           confignotes.tex  examples             Makefile
build-setup.sh  config.status    FAQ                  Makefile.in
ChangeLog       configure        generate_INSTALL.sh  Makenotes.tex
CHANGELOG.old   configure.ac     INSTALL              README.md
config          _config.yml      INSTALL.CYGWIN       README.rst
config_cl.out   contrib          lastBuildDate        src
config.lisp     debian           license              stamp-rootdirs
config.log      doc              LICENSE.txt          target
fatal error encountered in SBCL pid 142100 tid 142100:
blockables unblocked

Welcome to LDB, a low-level debugger for the Lisp runtime environment.
ldb> q
Really quit? [y]

If I do not use MMA related domains/packages jlFriCAS built on SBCL does not fall in the LDB.
 

I was thinking about wrapping "chdir" inside "ignore-errors".
(And return 0 if success.  This change needs testing.)

If you do so I would be happy to test it related to this bad interaction.

Greg

Qian Yun

unread,
Apr 27, 2026, 10:18:18 AM (4 days ago) Apr 27
to fricas...@googlegroups.com
Hi Greg, here is my patch, can you test it on your side?

This is a cleanup of |get_current_directory| and CHDIR:

1. Use Lisp native functions when possible.

2. Move implementation together, after FFI functions and
at the beginning filesystem functions.

3. For CHDIR, return t if success, otherwise silence the
error and return nil.

4. I've not done it, but I'd like to take this opportunity
to change the API of |get_current_directory| a bit:
it is better to return a path string that ends in "/". Opinions?

5. Tested for various Lisps in CI, no breakage found.

- Qian
lisp-native-get_current_directory.patch

Waldek Hebisch

unread,
Apr 27, 2026, 12:02:32 PM (4 days ago) Apr 27
to fricas...@googlegroups.com
On Mon, Apr 27, 2026 at 10:18:13PM +0800, Qian Yun wrote:
>
> 4. I've not done it, but I'd like to take this opportunity
> to change the API of |get_current_directory| a bit:
> it is better to return a path string that ends in "/". Opinions?

When I looked at this my conclusion was that it is better
to have directory names without trailing '/'.

--
Waldek Hebisch

Grégory Vanuxem

unread,
Apr 27, 2026, 1:40:25 PM (4 days ago) Apr 27
to fricas...@googlegroups.com
Hi Qian, *, 

I tested it, I really prefer the changed message, but for my own that does not change the "bad interaction". It's up to me to solve this but that is not simple. That is informative though (sb-posix).

Concerning the trailing "/" I have the same opinion than Waldek but essentially for aesthetic reasons. If the different supported  CL need this slash it doesn't mind to me.

Greg

--
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 fricas-devel...@googlegroups.com.

Qian Yun

unread,
Apr 27, 2026, 7:16:47 PM (4 days ago) Apr 27
to fricas...@googlegroups.com
Fine by me. The patch is OK to go in?

- Qian

Waldek Hebisch

unread,
Apr 27, 2026, 7:46:25 PM (4 days ago) Apr 27
to fricas...@googlegroups.com
Yes, OK.

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages