Hi, I've noticed an odd thing with texlua on Windows, here's the code and output illistrating it. The test script arg0test.lua is a simple one-liner: print(unpack(arg, 0)) Call with no arguments (note the conversion of \ to /): $ texlua H:\DEV\scratch\arg0test.lua H:/DEV/scratch/arg0test.lua Call with arguments (no conversion this time): $ texlua H:\DEV\scratch\arg0test.lua arg1 H:\DEV\scratch\arg0test.lua arg1 Call with full UNC path (the same behaviour for call with arguments): $ texlua \\.\H:\DEV\scratch\arg0test.lua No script file given There is something weird going on with this conversion of \ to /, but this not so important. What I don't understand is why it fails for UNC path (there is no problem to do for example dofile([[\\.\H:\DEV\scratch\arg0test.lua]]) from within the script). Cheers, Tomek
On 15-4-2010 3:57, T T wrote:
$ texlua \\.\H:\DEV\scratch\arg0test.lua No script file given
puting something in front of a drive specification is wrong anyway i think, just try dir ".\c:" ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On 15 April 2010 15:09, Hans Hagen
On 15-4-2010 3:57, T T wrote:
$ texlua \\.\H:\DEV\scratch\arg0test.lua No script file given
puting something in front of a drive specification is wrong anyway i think, just try
dir ".\c:"
It should be dir "\\.\c:\" and it works just fine. See also: http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx#namespaces The UNC syntax is used to access network drives on Windows like so: \\ComputerName\SharedFolder\Resource Stock Lua does not have any problem with UNC paths, so this looks like a bug in luatex but I couldn't locate it in the sources so far. Cheers, Tomek
T T wrote:
$ texlua \\.\H:\DEV\scratch\arg0test.lua No script file given
There is a stat() test in luainit.w (the is_readable macro) which probably fails for UNC files. I can try a patch, but it would be better if a true windows user would do so (I can guess but not test). Best wishes, Taco
On 15 April 2010 15:31, Taco Hoekwater
T T wrote:
$ texlua \\.\H:\DEV\scratch\arg0test.lua No script file given
There is a stat() test in luainit.w (the is_readable macro) which probably fails for UNC files. I can try a patch, but it would be better if a true windows user would do so (I can guess but not test).
I can try to patch it but stat() does not seem to be the problem. I've made a quick test and stat() seems to work OK on UNC paths (gcc & tcc). I suspect there may be some file parsing doing on but I don't see where. I should mention that I tested with TL's texlua (beta-0.40.6-2009110118) but I get the same with beta-0.52.0-2010031700 (rev 3515). Cheers, Tomek
T T wrote:
On 15 April 2010 15:31, Taco Hoekwater
wrote: T T wrote:
$ texlua \\.\H:\DEV\scratch\arg0test.lua No script file given There is a stat() test in luainit.w (the is_readable macro) which probably fails for UNC files. I can try a patch, but it would be better if a true windows user would do so (I can guess but not test).
I can try to patch it but stat() does not seem to be the problem. I've made a quick test and stat() seems to work OK on UNC paths (gcc & tcc). I suspect there may be some file parsing doing on but I don't see where.
I should mention that I tested with TL's texlua (beta-0.40.6-2009110118) but I get the same with beta-0.52.0-2010031700 (rev 3515).
Or any other older version, I'm sure. All commandline related stuff is in luainit.w, I think. And now I suddenly see what is going wrong: your backslash is intercepted by the code that looks for "luatex \\relax ...". Best wishes, Taco
On 15 April 2010 16:34, Taco Hoekwater
Or any other older version, I'm sure. All commandline related stuff is in luainit.w, I think.
I probably need to svn up, because I can only find luainit.c, no luainit.w.
And now I suddenly see what is going wrong: your backslash is intercepted by the code that looks for "luatex \\relax ...".
OK, you will probably know how to fix this better than I do (still can't find that in the code). Another question (two actually). In ex_selfdir function in luainit.c you derive derive the directory of the executable from argv[0] using SearchPath(). Is this intended (argv[0] might not correspond to the actual executable) or are you actually after the real path of the executable (in which case GetModuleFileName() should be used)? The second question is what is this path used used for? It is exposed on the Lua side through os.selfdir, but this is not documented, so I wonder if one can rely on it or if it is some internal thing. Cheers, Tomek
T T wrote:
On 15 April 2010 16:34, Taco Hoekwater
wrote: Or any other older version, I'm sure. All commandline related stuff is in luainit.w, I think.
I probably need to svn up, because I can only find luainit.c, no luainit.w.
And now I suddenly see what is going wrong: your backslash is intercepted by the code that looks for "luatex \\relax ...".
OK, you will probably know how to fix this better than I do (still can't find that in the code).
Should be fixed by #3621 (in branches/0.60.x/, so far) please try it out.
Another question (two actually). In ex_selfdir function in luainit.c you derive derive the directory of the executable from argv[0] using SearchPath(). Is this intended (argv[0] might not correspond to the actual executable) or are you actually after the real path of the executable (in which case GetModuleFileName() should be used)?
This is most probably on purpose. I inherited the current code from kpathsea, and I think it makes sense to do what kpathsea does in case someone wants to replace kpathsea by lua code (like Hans does).
The second question is what is this path used used for? It is exposed on the Lua side through os.selfdir, but this is not documented, so I wonder if one can rely on it or if it is some internal thing.
os.selfdir should have been documented already, it has slipped through the cracks somehow. I'll fix the manual. Best wishes, Taco
On 15 April 2010 17:18, Taco Hoekwater
T T wrote:
On 15 April 2010 16:34, Taco Hoekwater
wrote: Or any other older version, I'm sure. All commandline related stuff is in luainit.w, I think.
I probably need to svn up, because I can only find luainit.c, no luainit.w.
And now I suddenly see what is going wrong: your backslash is intercepted by the code that looks for "luatex \\relax ...".
OK, you will probably know how to fix this better than I do (still can't find that in the code).
Should be fixed by #3621 (in branches/0.60.x/, so far) please try it out.
Thanks, I'll try to try and report back (I need to checkout the branch first).
Another question (two actually). In ex_selfdir function in luainit.c you derive derive the directory of the executable from argv[0] using SearchPath(). Is this intended (argv[0] might not correspond to the actual executable) or are you actually after the real path of the executable (in which case GetModuleFileName() should be used)?
This is most probably on purpose. I inherited the current code from kpathsea, and I think it makes sense to do what kpathsea does in case someone wants to replace kpathsea by lua code (like Hans does).
From the kpse source it looks like a workaround for some win95 issues. Better leave it like that
The second question is what is this path used used for? It is exposed on the Lua side through os.selfdir, but this is not documented, so I wonder if one can rely on it or if it is some internal thing.
os.selfdir should have been documented already, it has slipped through the cracks somehow. I'll fix the manual.
Thanks, Tomek
On 15 April 2010 17:46, T T
On 15 April 2010 17:18, Taco Hoekwater
wrote: T T wrote:
On 15 April 2010 16:34, Taco Hoekwater
wrote: Or any other older version, I'm sure. All commandline related stuff is in luainit.w, I think.
I probably need to svn up, because I can only find luainit.c, no luainit.w.
And now I suddenly see what is going wrong: your backslash is intercepted by the code that looks for "luatex \\relax ...".
OK, you will probably know how to fix this better than I do (still can't find that in the code).
Should be fixed by #3621 (in branches/0.60.x/, so far) please try it out.
It is fixed. Thanks, Tomek
participants (3)
-
Hans Hagen
-
T T
-
Taco Hoekwater