commit b3949674 breaks build with CLISP

10 views
Skip to first unread message

Qian Yun

unread,
Oct 15, 2024, 1:27:15 AM10/15/24
to fricas-devel
This commit b3949674 (Reimplement database handling in Boot code)
breaks build from source (not release tarball) with CLISP.

>> System error:

OPEN: No file name given: #P"/tmp/fricas/src/algebra/A1AGG.NRLIB/index.KAF/"

- Qian

Waldek Hebisch

unread,
Oct 15, 2024, 5:34:25 PM10/15/24
to fricas...@googlegroups.com
This commit did have some bugs, but they should be fixed in the
trunk. I tried building current trunk with clisp and it worked
fine. I used Debian 12 and clisp coming with Debian.

--
Waldek Hebisch

Qian Yun

unread,
Oct 15, 2024, 9:56:47 PM10/15/24
to fricas...@googlegroups.com
OK, so you are using clisp-20210628 while I am using clisp-20180218.

Looks like this introduced a regression since 20171024:
https://gitlab.com/gnu-clisp/clisp/-/commit/f64ebe7675907b2da58c80960ed7cb9b0ad954d9

namely, if a "/path/to/file" is a file, then
'(truename "/path/to/file/")' returns "/path/to/file/".
(although this "directory" path does not exist.)

In this fricas commit, in function "check_for_ext",
your new code uses "fricas_probe_file" (which uses 'truename')
while old code uses "probe-file", thus your code exposes this
clisp regression.

The clisp regression should be fixed in 20200612:
https://gitlab.com/gnu-clisp/clisp/-/commit/71b0ef597fb6540fe3538a4f337510e9bf09d82a

So I propose the following workaround: test 'fname' before 'dname':

- Qian

diff --git a/src/lisp/fricas-lisp.lisp b/src/lisp/fricas-lisp.lisp
index 1c863854..d86f6970 100644
--- a/src/lisp/fricas-lisp.lisp
+++ b/src/lisp/fricas-lisp.lisp
@@ -789,10 +789,10 @@ with this hack and will try to convince the GCL
crowd to fix this.
-1))
#+:clisp (let* ((fname (|trim_directory_name| (namestring filename)))
(dname (|pad_directory_name| fname)))
- (if (ignore-errors (truename dname))
- 1
- (if (ignore-errors (truename fname))
- 0
+ (if (ignore-errors (truename fname))
+ 0
+ (if (ignore-errors (truename dname))
+ 1
-1)))
#+:abcl
(if (ext:file-directory-p filename)
@@ -839,8 +839,8 @@ with this hack and will try to convince the GCL
crowd to fix this.
#+(or :abcl :ecl :lispworks :openmcl :poplog) (probe-file file)
#+:clisp(let* ((fname (|trim_directory_name| (namestring file)))
(dname (|pad_directory_name| fname)))
- (or (ignore-errors (truename dname))
- (ignore-errors (truename fname))))
+ (or (ignore-errors (truename fname))
+ (ignore-errors (truename dname))))
)

#-:cmu

Qian Yun

unread,
Oct 15, 2024, 11:16:14 PM10/15/24
to fricas...@googlegroups.com
Previous patch is not quite correct.

Since we can not rely on "truename" to distinguish file and directory,
we have to use "ext:probe-directory".

I wonder why we didn't use it in the first place.

- Qian


diff --git a/src/lisp/fricas-lisp.lisp b/src/lisp/fricas-lisp.lisp
index 1c863854..6f5882f7 100644
--- a/src/lisp/fricas-lisp.lisp
+++ b/src/lisp/fricas-lisp.lisp
@@ -789,9 +789,9 @@ with this hack and will try to convince the GCL
crowd to fix this.
-1))
#+:clisp (let* ((fname (|trim_directory_name| (namestring filename)))
(dname (|pad_directory_name| fname)))
- (if (ignore-errors (truename dname))
+ (if (ignore-errors (ext:probe-directory dname))
1
- (if (ignore-errors (truename fname))
+ (if (ignore-errors (probe-file fname))
0
-1)))
#+:abcl
@@ -825,7 +825,8 @@ with this hack and will try to convince the GCL
crowd to fix this.


(defun |fricas_probe_file| (file)
-#+:GCL (let* ((fk (file_kind (namestring file)))
+#+(or :GCL :clisp)
+ (let* ((fk (|file_kind| (namestring file)))
(fname (|trim_directory_name| (namestring file)))
(dname (|pad_directory_name| fname)))
(cond
@@ -837,10 +838,6 @@ with this hack and will try to convince the GCL
crowd to fix this.
#+:cmu (if (unix:unix-file-kind file) (truename file))
#+:sbcl (if (sbcl-file-kind file) (truename file))
#+(or :abcl :ecl :lispworks :openmcl :poplog) (probe-file file)
-#+:clisp(let* ((fname (|trim_directory_name| (namestring file)))
- (dname (|pad_directory_name| fname)))
- (or (ignore-errors (truename dname))
- (ignore-errors (truename fname))))
)

#-:cmu

Waldek Hebisch

unread,
Oct 21, 2024, 7:22:32 AM10/21/24
to fricas...@googlegroups.com
On Wed, Oct 16, 2024 at 11:16:09AM +0800, Qian Yun wrote:
> Previous patch is not quite correct.
>
> Since we can not rely on "truename" to distinguish file and directory,
> we have to use "ext:probe-directory".
>
> I wonder why we didn't use it in the first place.

Original problem was that 'probe-file' signaled errors. 'truename'
+ 'ignore-errors' worked and was using only standard functions.
I am not sure if 'ext:probe-directory' existed at that time,
but various advice was to use what we used. If 'ext:probe-directory'
exists in older 'clisp' (say around 2.40, later verisions are
harder to build), then we should use it. Othwerwise to would be
nasty bargain: breaking older correct versions to support
later broken version.
> --
> 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.
> To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/8e552bad-cd34-47b0-8c40-c0b89c669440%40gmail.com.

--
Waldek Hebisch

Qian Yun

unread,
Oct 21, 2024, 7:51:01 AM10/21/24
to fricas...@googlegroups.com


On 10/21/24 7:22 PM, Waldek Hebisch wrote:
> On Wed, Oct 16, 2024 at 11:16:09AM +0800, Qian Yun wrote:
>> Previous patch is not quite correct.
>>
>> Since we can not rely on "truename" to distinguish file and directory,
>> we have to use "ext:probe-directory".
>>
>> I wonder why we didn't use it in the first place.
>
> Original problem was that 'probe-file' signaled errors. 'truename'
> + 'ignore-errors' worked and was using only standard functions.
> I am not sure if 'ext:probe-directory' existed at that time,
> but various advice was to use what we used. If 'ext:probe-directory'
> exists in older 'clisp' (say around 2.40, later verisions are
> harder to build), then we should use it. Othwerwise to would be
> nasty bargain: breaking older correct versions to support
> later broken version.
>

This function existed at least since year 2001, version 2.26.

I'll commit my patch shortly after.

- Qian

Reply all
Reply to author
Forward
0 new messages