regression? in cda8948b

11 views
Skip to first unread message

Qian Yun

unread,
Apr 23, 2026, 7:53:42 AMApr 23
to fricas-devel
+ writable? f ==
+ n := f::String
+ if n = "" then
+ n := "."
+ r1 : Integer := writeablep(n)$Lisp
+ r1 > 0 => true
+ n := file_directory(n)$Lisp
+ r1 := writeablep(n)$Lisp
+ r1 > 0
-(defun |myWritable?| (s)
- (if (not (stringp s)) (|error| "``myWritable?'' requires a string arg."))
- (if (string= s "") (setq s "."))
- (if (not (|fnameExists?| s)) (setq s (|file_directory| s)))
- (if (string= s "") (setq s "."))
- (if (> (|writeablep| s) 0) 't nil) )

First, in "writable?", during the translation,
'if n = "" then n := "."' is lost after the 'file_directory' call.

This causes 'writable?("non-exist-file")$FNAME' to return false
instead of true.


+MAKEPROP('coerce, "/TRANSFORM", ["&", "&", "*"])
+MAKEPROP('comp, "/TRANSFORM", ["&", "*", "*", "&"])
+MAKEPROP('compIf, "/TRANSFORM", '["&", "*", "*", "&"])
+MAKEPROP('compFormWithModemap, "/TRANSFORM", ["&", "*", "*", "&", "*"])

Second, the quote in 'compIf' line is unintentional?

- Qian

Qian Yun

unread,
Apr 29, 2026, 7:32:45 PMApr 29
to fricas-devel
Ping?

Waldek Hebisch

unread,
Apr 30, 2026, 9:05:49 AMApr 30
to fricas...@googlegroups.com
On Thu, Apr 23, 2026 at 07:53:36PM +0800, Qian Yun wrote:
> + writable? f ==
> + n := f::String
> + if n = "" then
> + n := "."
> + r1 : Integer := writeablep(n)$Lisp
> + r1 > 0 => true
> + n := file_directory(n)$Lisp
> + r1 := writeablep(n)$Lisp
> + r1 > 0
> -(defun |myWritable?| (s)
> - (if (not (stringp s)) (|error| "``myWritable?'' requires a string arg."))
> - (if (string= s "") (setq s "."))
> - (if (not (|fnameExists?| s)) (setq s (|file_directory| s)))
> - (if (string= s "") (setq s "."))
> - (if (> (|writeablep| s) 0) 't nil) )
>
> First, in "writable?", during the translation,
> 'if n = "" then n := "."' is lost after the 'file_directory' call.
>
> This causes 'writable?("non-exist-file")$FNAME' to return false
> instead of true.

Yes, we probably should add "." here too. Or change 'writeabolep'
to do this.

>
> +MAKEPROP('coerce, "/TRANSFORM", ["&", "&", "*"])
> +MAKEPROP('comp, "/TRANSFORM", ["&", "*", "*", "&"])
> +MAKEPROP('compIf, "/TRANSFORM", '["&", "*", "*", "&"])
> +MAKEPROP('compFormWithModemap, "/TRANSFORM", ["&", "*", "*", "&", "*"])
>
> Second, the quote in 'compIf' line is unintentional?

No, there should be no quote.

--
Waldek Hebisch

Qian Yun

unread,
May 15, 2026, 11:43:21 PM (7 hours ago) May 15
to fricas...@googlegroups.com
On 4/30/26 9:05 PM, Waldek Hebisch wrote:
> On Thu, Apr 23, 2026 at 07:53:36PM +0800, Qian Yun wrote:
>> + writable? f ==
>> + n := f::String
>> + if n = "" then
>> + n := "."
>> + r1 : Integer := writeablep(n)$Lisp
>> + r1 > 0 => true
>> + n := file_directory(n)$Lisp
>> + r1 := writeablep(n)$Lisp
>> + r1 > 0
>> -(defun |myWritable?| (s)
>> - (if (not (stringp s)) (|error| "``myWritable?'' requires a string arg."))
>> - (if (string= s "") (setq s "."))
>> - (if (not (|fnameExists?| s)) (setq s (|file_directory| s)))
>> - (if (string= s "") (setq s "."))
>> - (if (> (|writeablep| s) 0) 't nil) )
>>
>> First, in "writable?", during the translation,
>> 'if n = "" then n := "."' is lost after the 'file_directory' call.
>>
>> This causes 'writable?("non-exist-file")$FNAME' to return false
>> instead of true.
>
> Yes, we probably should add "." here too. Or change 'writeabolep'
> to do this.
>

There is another issue: old code uses "fnameExists?", but new code
use "writeablep". So if a file exists but not writable (aka readonly),
new code will test directory instead, and may return true.

See attachment for a patch.

- Qian
fix-fname-writable.patch
Reply all
Reply to author
Forward
0 new messages