Continuation of thread from:
http://tug.org/pipermail/tex-live/2010-April/025466.html
On 22 April 2010 00:03, Manuel Pégourié-Gonnard
T T a écrit :
Yes, I'm quite familiar by now how those things work in texlua and perl. Still, I'm really baffled how those problems can propagate farther down to child processes. I started cmd.exe from perl that was spawned from texlua and AR9 just wouldn't run from that cmd.exe no matter what (nor from any other process started from there).
Yeah, that's really amazing. Maybe something with the environment that would propagate differently using spawn/exec vs execute?
Manuel, you've been on the right track all along. I finally (almost)
got to the bottom of it.
The problem is the same as reported in the past for texdoc:
http://www.ntg.nl/pipermail/dev-luatex/2008-September/001771.html
It comes from kpathsea, which changes \ to / in USERPRIFILE var and
this leads to the dreaded AR crash with "internal error occurred".
I've been unable so far to locate at which point this substitution
happens, but at least there is an easy fix for that, which I will
commit shortly:
os.setenv("USERPROFILE", os.getenv("USERPROFILE"):gsub('/', '\\'))
But it gets even more interesting. This change doesn't seem to happen
really in the environment but only in the environ variable exported
from the kpathsea lib. This explains why os.execute() works (as
reported in the texdoc thread referenced above) and os.spawn()
doesn't. With os.execute() the child process inherits the environment
automatically from its parent, while os.spawn() is implemented using
_spawnvpe() with the environ variable passed for the environment.
What's more, this USERPROFILE manipulation happens only with w32tex
builds. For my private mingw static build this doesn't happen. Also,
the same substitution of \ to / happens sometimes for the command line
arguments, which should be fixed too.
Now, I'm not sure if using the environ variable in os.spawn() is
actually intended. It is certainly not consistent to use it there and
not use it in os.execute(). I would suggest to remove this entirely
with this one line change in luatex:
Index: loslibext.c
===================================================================
--- loslibext.c (revision 3635)
+++ loslibext.c (working copy)
@@ -113,7 +113,7 @@
#ifdef _WIN32
# include
Hi Tomek, T T a écrit :
On 22 April 2010 00:03, Manuel Pégourié-Gonnard
wrote: Yeah, that's really amazing. Maybe something with the environment that would propagate differently using spawn/exec vs execute?
Manuel, you've been on the right track all along. I finally (almost) got to the bottom of it.
The problem is the same as reported in the past for texdoc:
http://www.ntg.nl/pipermail/dev-luatex/2008-September/001771.html
It comes from kpathsea, which changes \ to / in USERPRIFILE var and this leads to the dreaded AR crash with "internal error occurred".
Very nice catch!
I've been unable so far to locate at which point this substitution happens, but at least there is an easy fix for that, which I will commit shortly:
os.setenv("USERPROFILE", os.getenv("USERPROFILE"):gsub('/', '\\'))
Sounds good, while waiting for a proper fix in the engine.
But it gets even more interesting. This change doesn't seem to happen really in the environment but only in the environ variable exported from the kpathsea lib. This explains why os.execute() works (as reported in the texdoc thread referenced above) and os.spawn() doesn't. With os.execute() the child process inherits the environment automatically from its parent, while os.spawn() is implemented using _spawnvpe() with the environ variable passed for the environment.
Nice catch again! I'm very glad to finally understand this so mysterious problem. Thank you for getting to the bottom of it, Tomek! Manuel.
On 22 April 2010 T T wrote:
Manuel, you've been on the right track all along. I finally (almost) got to the bottom of it.
The problem is the same as reported in the past for texdoc:
http://www.ntg.nl/pipermail/dev-luatex/2008-September/001771.html
It comes from kpathsea, which changes \ to / in USERPRIFILE var and this leads to the dreaded AR crash with "internal error occurred". I've been unable so far to locate at which point this substitution happens, but at least there is an easy fix for that, which I will commit shortly:
Thanks, this is great.
What's more, this USERPROFILE manipulation happens only with w32tex builds. For my private mingw static build this doesn't happen.
This is curious because Akira couldn't reproduce the problem. Thanks again, Reinhard -- ---------------------------------------------------------------------------- Reinhard Kotucha Phone: +49-511-3373112 Marschnerstr. 25 D-30167 Hannover mailto:reinhard.kotucha@web.de ---------------------------------------------------------------------------- Microsoft isn't the answer. Microsoft is the question, and the answer is NO. ----------------------------------------------------------------------------
participants (3)
-
Manuel Pégourié-Gonnard
-
Reinhard Kotucha
-
T T