From: Hans van der Meer <havdmeer@ziggo.nl>
To: NTG ConTeXt <ntg-context@ntg.nl>
Subject: Bug in Luatex file handling?
Date: Tue, 15 Jun 2021 14:38:38 +0200 [thread overview]
Message-ID: <9F0DB6E4-5588-4829-8642-931F14EF472B@ziggo.nl> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1313 bytes --]
This I cannot explain. Opening a file directly from its full name in a string succeeds. But doing the same from a parameter transferred from ConteXt to Lua succeeds if the file is in one directory deeper but fails if the file is two directories deeper.
I suspect there is something not ok in LuaTeX.
The lines with .... and >>>> directly come from print statements inserted in the Lua code.
dr. Hans van der Meer
Open file in directory 1 and 2 levels deep - direct call succeeds
..........io.open("events/hga-0372-345-62.xml","r")=>file (0x7fff97415f88)
..........io.open("events/transcripten/hga-0372-345-62.xml","r")=>file (0x7fff97416020)
Idem but now from parameter filename transferred from ConTeXt into Lua:
Open file one level deeper succeeds (printed filename comes from the call):
>>>>>>>>>>io.open(filename,"r") filename=events/hga-0372-1764-63.xml=>file (0x7fff974160b8)
Open file two levels deeper fails:
>>>>>>>>>>io.open(filename,"r") filename=events/transcripten/hga-0372-1764-63.xml=>nil
Caller:
\def\FileExist#1{\cldcontext{hvdm.existfile([===[#1]===])}}
Lua code:
hvdm.existfile = function (filename)
-- The test code was inserted here --
local file = io.open(filename, "r")
if file then
file:close()
end
return file ~= nil and "true" or "false"
end
[-- Attachment #1.2: Type: text/html, Size: 4113 bytes --]
[-- Attachment #2: Type: text/plain, Size: 493 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
next reply other threads:[~2021-06-15 12:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-15 12:38 Hans van der Meer [this message]
2021-06-15 13:37 ` Hans Hagen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9F0DB6E4-5588-4829-8642-931F14EF472B@ziggo.nl \
--to=havdmeer@ziggo.nl \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).