On Tue, May 14, 2024 at 08:05:58AM +0800, Qian Yun wrote: > I didn't realize that "isSystemDirectory" checks for prefix. > Well, it also needs to check for string length, otherwise it > will mistakenly accept shorter paths.
Yes > The following patch passes CI test now. > > Please commit it if it looks good to you as well. Looks good. > - Qian > > diff --git a/src/interp/lisplib.boot b/src/interp/lisplib.boot > index 9c37eacc..b11d9603 100644 > --- a/src/interp/lisplib.boot > +++ b/src/interp/lisplib.boot > @@ -71,7 +71,7 @@ loadLibIfNotLoaded libName == > loadLib cname == > startTimingProcess 'load > fullLibName := get_database(cname, 'OBJECT) or return nil > - systemdir? := isSystemDirectory(pathnameDirectory fullLibName) > + systemdir? := isSystemDirectory(fullLibName) > update? := not systemdir? > loadLibNoUpdate1(cname, fullLibName) > kind := get_database(cname, 'CONSTRUCTORKIND) > diff --git a/src/interp/pathname.boot b/src/interp/pathname.boot > index 7bd1f1b3..c350733f 100644 > --- a/src/interp/pathname.boot > +++ b/src/interp/pathname.boot > @@ -61,4 +61,6 @@ isExistingFile f == > > --% Scratchpad II File Name Functions > > -isSystemDirectory dir == EVERY(function CHAR_=,$spadroot,dir) > +isSystemDirectory path == > + -- check if $spadroot is the prefix of 'path' > + # path >= # $spadroot and EVERY(function CHAR_=, $spadroot, path) > > > On 5/14/24 01:40, Waldek Hebisch wrote: > > On Mon, May 13, 2024 at 08:52:12PM +0800, Qian Yun wrote: > > > The following patch works. > > > > > > Do we need to compare PATHNAME_-DEVICE as well > > > (returns "C" in this case) in 'isSystemDirectory'? > > > > I would prefer different approach. I mean, the patch may be correct > > solution to problem "Do two Windows paths point to the same file?" > > (for such problem you probably want to include PATHNAME_-DEVICE). > > What I do not like is fact that this would propagate Windows > > weirdness deper into FriCAS code. > > > > Pathname here comes from 'get_database' and in 'get_database' be > > have > > > > if key = 'OBJECT then > > if CONSP(data) then > > data := first(data) > > if NULL(PATHNAME_-DIRECTORY(data)) then > > data := STRCONC($spadroot, '"/algebra/", data, > > '".", $lisp_bin_filetype) > > data > > > > So, returned patname has '$spadroot' as a prefix and AFAICS all we need > > is to avoid mangling the pathname. Maybe just remove 'pathnameDirectory' > > call (that is use first part of the patch without the second part). > > -- > 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+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/fricas-devel/8d78f114-eab8-4688-837d-b2306b9b50de%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 fricas-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/ZkKuLW4kyy7PTrqa%40fricas.org.