[tex-live] Solution to the file locking problem during update - take 2
T T
t34www at googlemail.com
Thu Jan 15 12:37:09 CET 2009
Some time ago I suggested a solution to locking problem on Windows but
it has not attracted any comments perhaps because it was faulty. I
tried it with several interpreters (cmd, perl, lua) and all of them
pass open file handles onto a spawned child process and thus prevent
the child process from updating locked files. I've found (and tested)
two workarounds for this but I don't like any of them, so I won't give
any details here (unless somebody is interested).
On Mon Dec 1, Norbert Preining wrote:
> On Mo, 01 Dez 2008, Lars Madsen wrote:
> > Could one wrap tlmgr? such that it is another program that starts tlmgr,
> > and then when tlmgr is finished it looks for an update file, and runs it
> > if it is present.
>
> Programmers wanted ...
My second attempt follows the above logic. I modified the wrapper
script tlmgr.bat so that it watches for updater.bat script. If it
exists then it will be executed after tlmgr.pl is done. This seems to
work in my limited testing but not without problems.
The first one is that updater.bat calls tlmgr.bat. This is easy to fix
- I just rename it before executing to prevent relaunching. Another
one is that in gui mode tlmgr relaunches itself with non-returning
exec command - this would have to be changed to system command.
Finally there is an issue with dry-run option - in this case
updater.bat has to be removed before tlmgr.pl terminates (or it
shouldn't be created at all). Can anybody think about any other
potential issues?
So the next step would be to modify tlmgr.pl but before I will go with
this any further I would like to know the following:
1) Are developers OK with those changes?
2) How would you prefer to handle dry-run option? My take on it would
be to construct updater.bat in memory and then print it to stdout if
dry-run otherwise write to file (but this means more changes to
tlmgr.pl - subroutines (open,add,close)_w32_updater would have to be
modified, as well as some surrounding code).
3) How can I test it on a fresh install that is up to date?
4) Where should I send the modified files?
Cheers,
Tomek
PS. Here's the modified version of tlmgr.bat
:: TLMGR.BAT
:: wrapper script for tlmgr.pl
@echo off
setlocal
for %%P in ("%~dp0..\..") do set TEXDIR=%%~fP
rem is WGETRC needed? there is some strange notice about it in
tl-w32-wrapper.texlua
set PERL5LIB=%TEXDIR%\tlpkg\tlperl\lib
path %TEXDIR%\tlpkg\installer;%PATH%
rem start tlmgr
"%TEXDIR%\tlpkg\tlperl\bin\perl.exe"
"%TEXDIR%\texmf\scripts\texlive\tlmgr.pl" %*
rem check for updater.bat script
set UPDATERDIR=%TEXDIR%\tlpkg\installer
if not exist "%UPDATERDIR%\updater.bat" exit /b
del "%UPDATERDIR%\run-update.bat">nul
ren "%UPDATERDIR%\updater.bat" run-update.bat
if errorlevel 1 exit /b %errorlevel%
endlocal & call "%UPDATERDIR%\run-update.bat" & exit /b
More information about the tex-live
mailing list