Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use filename recorder for better TeX & LaTeX dependency scanning #1730

Open
bdbaddog opened this issue Jan 2, 2018 · 2 comments
Open

use filename recorder for better TeX & LaTeX dependency scanning #1730

bdbaddog opened this issue Jan 2, 2018 · 2 comments
Labels
LaTex LaTex related issues. Version: 0.97

Comments

@bdbaddog
Copy link
Contributor

bdbaddog commented Jan 2, 2018

This issue was originally created at: 2007-09-12 13:50:52.
This issue was reported by: liblit.
liblit said at 2007-09-12 13:50:52

TeX and LaTeX are so fiendishly complex that scanning for dependencies can be very difficult to get right. Fortunately, TeX and LaTeX can actually record the names of files they processed. This should make it easier to build highly precise TeX and LaTeX dependency scanners.

The key is the often-overlooked "-recorder" flag to tex, pdftex, latex, pdflatex, etc. If the source document being processed is "master.tex", and the "-recorder" flag is given on the command line, then a file "master.fls" will be created listing all files read or written. The file is extremely easy to parse and is the most accurate record you will ever get of what files were involved in rendering a given document.

The "-recorder" functionality does not replace document rendering: it happens at the same time. So this is sort of the TeX analogue of gcc's "-MD" flag. Taking advantage of this probably requires that SCons be able to deal with builders that update dependencies as a side effect of the build itself. I remember reading somewhere that SCons is supposed to be gaining this ability, but I cannot remember where I saw that now. If it is on the SCons wiki somewhere, please edit the appropriate wiki page to link to this report. That way, once the general builder-that-reports-dependencies feature is ready, it will be easy to find this feature request that describes how to use it with TeX and LaTeX.

liblit said at 2007-09-12 13:53:09

How portable is "-recorder"? I don't know. It is available in the tetex builds of TeX and LaTeX that I used under Fedora Linux. I do not have easy access to MiKTeX, TeX Live, etc., so I cannot check whether they also support this. If anyone knows, or can check, please add that information to this report so that we know whether or not this will work on many platforms.

gregnoel said at 2008-06-05 17:53:21

Bug party triage: Rob to work with Steven to develop a general facility that can be used with other compilers that provide this sort of information as a part of the compile (such as 'gcc -MD').

managan said at 2008-09-08 08:43:11

*** Issue 1663 has been marked as a duplicate of this issue. ***

managan said at 2008-09-17 10:14:40

I tracked down some web page copies of man pages that claim the -recorder option existed back in 2001. I suspect it is much older than that but I don't know how much.

It seems reasonable that we can expect it to exist on any system with tex or latex.

gregnoel said at 2008-12-26 13:29:17

Adjust triage of issues.

managan said this issue is duplicated by #1663 at 2008-09-08 08:43:11.

@luhk
Copy link

luhk commented Jul 12, 2019

I don't think that using --recorder will work for dependency scanning. If LaTeX encounters a missing file (i.e., a dependency that has not been generated yet) it will stop at this point without recording the missing file in the .fls file. So, the .fls could only be used to check dependencies after a successful build. Is there a point in this?

The only way I can think of to use LaTeX itself to get the dependencies (which would also address #1663) is to run it, parse the log file and look for ! LaTeX Error: File `dependency.tex' not found., build the dependency, repeat for the next dependency. However, this does not seem to be very feasible.

@mwichmann mwichmann removed this from the 2.x milestone Mar 26, 2021
@mwichmann mwichmann added LaTex LaTex related issues. and removed P2 labels May 27, 2022
@Grinzold
Copy link

Just run with

-recorder

and

-interaction=batchmode

Then latex will not stop and you can find all dependencies in the .fls- and in the .log-file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LaTex LaTex related issues. Version: 0.97
Projects
None yet
Development

No branches or pull requests

4 participants