[Dev-luatex] os.spawn and AR crash mystery resolved
mpg at elzevir.fr
Thu Apr 22 17:30:52 CEST 2010
T T a écrit :
> On 22 April 2010 00:03, Manuel Pégourié-Gonnard <mpg at elzevir.fr> 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:
> 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!
More information about the dev-luatex