uiua-lang/uiua

Cannot open read-only files

Closed this issue · 2 comments

Since commit 3ea819d it is no longer possible to open and read from files that are not writable, because both &fo and &fras always seem to attempt to open the file in read-write mode.

When trying to read a read-only file (e.g. mode 444), I get a permission denied error:

↪ &fras "test"
Error: Permission denied (os error 13) test
  at 1:1
1 | &fras "test"
    ─────

And when trying to read a file that in theory is writable (e.g. mode 644), but is located on a read-only filesystem, I get this error:

↪ &fras "test"
Error: Read-only file system (os error 30) test
  at 1:1
1 | &fras "test"
    ─────

Another problem I encountered with the aforementioned commit is that it is no longer possible to read from stdin using &fras. For example, echo test | uiua run test.ua (where test.ua uses &fras "/dev/stdin" to process stdin) worked fine before this commit, but now the program always gets stuck.

This is addressed in 6580008.
I tested it on a Windows readonly file, but I haven't tested it on Linux.
Please let me know if it is fixed.

Yes, thanks a lot, &fras on read-only files is fixed now. The second problem I described still persists, but I think I can just use &ru @\0 0 instead which works fine, so I will close this issue.