Hello,

I noticed a small issue in tex/context/base/mkxl/l-file.lmt, in the 
implementation of file.canbewritten().

The function currently contains:

local path = pathpart(name)
if not path or pathpath == "" then
    path = "."
end

I believe pathpath should be path.

As a result, file.canbewritten() returns false for a new filename without a 
directory component, even if the current directory is writable.

Minimal example (run in a writable directory where the test file does not 
exist):

\starttext

\startluacode
    local name = "writability-test.tmp"
    local report = logs.reporter("writability-test")

    report("plain: %s", tostring(file.canbewritten(name)))
    report("dot:   %s", tostring(file.canbewritten("./" .. name)))
\stopluacode

\stoptext

With ConTeXt LMTX 2026.10.23, the results are:

plain: false
dot:   true

Changing pathpath == "" to path == "" should resolve this.

Best regards
Bernd Donner
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : [email protected] / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to