[tex-live] Kpathsea in TL2007

George N. White III gnwiii at gmail.com
Mon Feb 19 23:44:20 CET 2007


On 2/19/07, Reinhard Kotucha <reinhard.kotucha at web.de> wrote:

> >>>>> "George" == George N White <gnwiii at gmail.com> writes:
>
>   > On some *x systems you can get a complete list using a process
>   > trace tool -- is there a similar capability for Windows?
>
> There is even a portable tool:  KPATHSEA_DEBUG=4

You can get a Windows user to replace "pdflatex ..." with "strace
pdflatex ..." but there usually isn't env.exe to set environment
variables as in "env KPATHSEA_DEBUG=4 pdflatex ...".  On *X you can
rename pdftex to pdftex.bin and replace pdftex with a wrapper script
that sets environment variables.

Many of the problems I've encountered have been with the user's files,
so I was able to debug things by copying to a *X machine, but there
are
also cases where the problems with old versions of files on the user's
machine (e.g., copied over from a friend's emtex).

>   > ---- but some don't make it easy for to capture the output without
>   > using emacs (they seem to write to the raw tty so redirection
>   > fails).
>
> But if emacs can capture stderr it should be possible for other
> programs too.  The question is how this can be achieved.  This is an
> interesting question because "gs -sDEVICE=bbox" writes output to
> stderr.  It's a well known bug and Ghostscript developers have this on
> their TODO list for many years.  I suppose that we will have LaTeX3
> and Omega2 before it will be fixed.  On the other hand it's annoying
> that Microsoft steals concepts from other operating systems and does
> not implement them properly.

Cmd.exe captures stderr, but throws most of it away and doens't have
search.

> Emacs can also be run in batch-mode, so you can use Emacs-Lisp like
> any other programming language to process files.  It's probably not
> easy to read arbitrary stuff (like "pdftex myfile.tex") from the
> command-line because the command line had been interpreted by emacs
> before the elisp script is executed.  TeX has the same problem.
>
> In most cases the -recorder option is sufficient.  The first file
> which appears in the output is the format file.  KPATHSEA_DEBUG starts
> a bit earlier: it also displays ARGV[0], texmf.cnf, and ls-R files.
>
> KPATHSEA_DEBUG is not a replacement for a tool like strace.  However,
> I rarely used strace for anything else but tracing fopen() calls.  And
> the big advantage of KPATHSEA_DEBUG is that it works with all programs
> which are using kpathsea, also on Windows.
>
> BTW, KPATHSEA_DEBUG is described in the kpathsea texinfo manual.
>
> There _is_ something like strace for Windows.  Thomas Esser mentioned
> it some time ago but unfortunately I forgot its name.

http://www.bindview.com/Resources/RAZOR/Files/strace-0.3.zip

But,
<http://www.bindview.com/Services/RAZOR/Utilities/Windows/strace_readme.cfm>
says:

"Strace works on NT4 SP4, SP5, and SP6; Windows 2000 GA, SP1, SP2, and
SP3, and has preliminary support for Windows XP. On Windows XP, it is
necessary to set the registry key

HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory
Management\EnforceWriteProtection

to REG_DWORD 0. and reboot before using strace.

This disables the kernel from checking for errant memory overwrites,
and is not a good thing, in general. It is currently necessary for
strace because the system call table is write protected, and strace
needs to modify it. Hopefully, a better solution will be found."

-- 
George N. White III <aa056 at chebucto.ns.ca>
Head of St. Margarets Bay, Nova Scotia


More information about the tex-live mailing list