Skip to content

Avoid LaTeX scanner errors without a TeX tool - #4913

Open
Boulea7 wants to merge 1 commit into
SCons:masterfrom
Boulea7:issue-4511-latex-scanner
Open

Boulea7 wants to merge 1 commit into
SCons:masterfrom
Boulea7:issue-4511-latex-scanner

Conversation

@Boulea7

@Boulea7 Boulea7 commented Sep 30, 2026 •

Copy link
Copy Markdown

A Command on a LaTeX source fails with an undefined LATEXSUFFIXES error when the environment uses tools=[] and AllowSubstExceptions(). Skip the default LaTeX scanner when that variable is absent. Configured suffixes, custom scanners, and errors in configured substitution values retain their existing behavior.

Related #4511. This addresses the reported LaTeX error while preserving the current scanner registration model.

The regression covers .tex, .ltx, and .latex copies, unchanged builds, source updates, and strict command substitution errors. Unit tests cover absent, empty, configured, and custom suffixes and invalid variable references.

Validation on Python 3.11 / Linux:

python runtest.py \
  SCons/Scanner/LaTeXTests.py SCons/Scanner/ScannerTests.py \
  SCons/Tool/ToolTests.py SCons/SubstTests.py \
  test/Subst/AllowSubstExceptions.py test/Scanner \
  test/TEX/LATEXCOMSTR.py test/TEX/PDFLATEXCOMSTR.py \
  test/TEX/TEXCOMSTR.py test/TEX/PDFTEXCOMSTR.py

All 26 selected test files passed, with no failures or skips. The issue's original three-line copy reproduction also succeeds. The full suite and real TeX executables were not run; the four TeX checks above use the repository's simulated commands.

The added LaTeX regression test also fails on the base and passes on this head with Python 3.12/Linux. An earlier Windows AppVeyor run failed in test/Interactive/configure.py; that test passes on Linux at both commits, but the Windows failure's cause remains unconfirmed. Native Windows validation is still outstanding.

Contributor Checklist:

  • New and updated tests cover the changed functionality.
  • CHANGES.txt and RELEASE.txt are updated; README.rst was checked for relevant guidance.
  • The release notes document the correction. No public API documentation change is needed.

This change and its tests were developed with OpenAI Codex.

Skip the default LaTeX scanner when LATEXSUFFIXES has not been configured.
This lets commands consume LaTeX sources with tools=[] and strict
substitution, while preserving configured and custom suffix behavior.

Add portable copy and suffix regression tests and update the release notes.
Related SCons#4511.

Assisted-by: OpenAI Codex
Signed-off-by: boulea7 <zln1905391059@163.com>
@Boulea7
Boulea7 marked this pull request as ready for review October 1, 2026 15:40
Copilot AI balanced review requested due to automatic review settings October 1, 2026 15:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@bdbaddog

bdbaddog commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Who requested this?

@Boulea7

Boulea7 commented Oct 1, 2026

Copy link
Copy Markdown
Author

Who requested this?

Maybe Github's default setting...

@bdbaddog

bdbaddog commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Who requested this?

Maybe Github's default setting...

Nope. Never happened on any SCons PR's before.
Do you have it set up in your account?

@Boulea7

Boulea7 commented Oct 1, 2026 •

Copy link
Copy Markdown
Author

Looks like default setting for new users of Copilot (just paid) , I just closed it , NVM

@mwichmann mwichmann added the LaTex LaTex related issues. label Oct 2, 2026
@bdbaddog

bdbaddog commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

I think this is the wrong fix.
The latex scanners should not be registered if no tool which uses them has been loaded.

@mwichmann thoughts?

@Boulea7

Boulea7 commented Oct 5, 2026

Copy link
Copy Markdown
Author

I'm checking the registration path when no LaTeX tool is loaded, including how a change there would affect other environments.

@Boulea7

Boulea7 commented Oct 5, 2026

Copy link
Copy Markdown
Author

In local tests, removing the global registrations preserves nested input tracking for DVI/PDF builds from TeX. It does change env.Command('copied.tex', 'source.tex', ...) with tex loaded: changing an \input dependency no longer rebuilds the target. Should we preserve that implicit Command() scanning, or require an explicit source_scanner there?

@bdbaddog

bdbaddog commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

In local tests, removing the global registrations preserves nested input tracking for DVI/PDF builds from TeX. It does change env.Command('copied.tex', 'source.tex', ...) with tex loaded: changing an \input dependency no longer rebuilds the target. Should we preserve that implicit Command() scanning, or require an explicit source_scanner there?

With tool tex loaded it's not using the scanner?

@Boulea7

Boulea7 commented Oct 6, 2026

Copy link
Copy Markdown
Author

It does with tools=['tex'] on the base commit: changing an \input dependency rebuilds the Command target. I meant my unpushed experiment that removes the global registrations. Generic Command relies on that global scanner mapping; the TeX builders retain their own explicit scanners. Removing the mapping caused the difference I reported, so I haven't applied that change to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LaTex LaTex related issues.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants