From 77b92c498c284122cdfbb93ba3e6395618f8933e Mon Sep 17 00:00:00 2001 From: kprussing Date: Sat, 15 Nov 2025 09:54:43 -0500 Subject: [PATCH 1/7] Add preliminary test showing failure This test (should) generate two identical LaTeX input files: main.tex and main.extra.tex. The should compile to the same content, but SCons strips accidentally strips the '.extra' from the second preventing it from finding the bibliography file. The test needs to be checked on a non-Windows system because Miktek does not support the ~ in the shortened path name to the temp directory. --- test/TEX/bibtex-extra-extension.py | 81 ++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 test/TEX/bibtex-extra-extension.py diff --git a/test/TEX/bibtex-extra-extension.py b/test/TEX/bibtex-extra-extension.py new file mode 100644 index 0000000000..d89ce98578 --- /dev/null +++ b/test/TEX/bibtex-extra-extension.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Verify that running LaTeX with a file named main.extra.tex pulls the +right bibliography file. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +pdflatex = test.where_is('pdflatex') + +if not pdflatex: + test.skip_test("Could not find 'pdflatex'; skipping test(s).\n") + +mains = ["main.tex", "main.extra.tex"] + +test.write(["SConstruct"], f"""\ +import os +env = Environment(ENV={{'PATH': os.environ['PATH']}}, tools=['pdftex', 'tex']) +env.PDF({mains}) +""") + +body_content = r"""\documentclass{article} +\begin{document} +SCons \cite{scons}! +\bibliography{references} +\bibliographystyle{plain} +\end{document} +""" + +for _ in mains: + test.write(_, body_content) + +test.write("references.bib", r""" +@misc{scons, + title = {SCons}, + url = {https://scons.org}, + language = {en-US}, + urldate = {2025-08-15}, + author = {{SCons} {Foundation}}, + year = {2025}, +} +""") + +test.run() + +pdfs = [test.read(_[:-3] + "pdf") for _ in mains] +test.fail_test(pdfs[0] != pdfs[1]) +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: From 283ca61fbc928e19a261de79abb8baa3a5ca8b77 Mon Sep 17 00:00:00 2001 From: kprussing Date: Sat, 15 Nov 2025 09:57:32 -0500 Subject: [PATCH 2/7] Pass the correct files to the Actions The second argument to the action should be the aux file not the bibliography file. Also, we have to add the bib extension to the target because it will be stripped by the command string via TARGET.filebase. --- SCons/Tool/tex.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/SCons/Tool/tex.py b/SCons/Tool/tex.py index 54b21fbe84..2473404679 100644 --- a/SCons/Tool/tex.py +++ b/SCons/Tool/tex.py @@ -340,8 +340,9 @@ def check_content_hash(filenode, suffix) -> bool: if content.find("bibdata") != -1: if Verbose: print("Need to run bibtex on ",auxfilename) - bibfile = env.fs.File(SCons.Util.splitext(target_aux)[0]) - result = BibTeXAction(bibfile, bibfile, env) + auxfile = env.fs.File(target_aux) + bibfile = env.fs.File(SCons.Util.splitext(target_aux)[0] + ".bib") + result = BibTeXAction(bibfile, auxfile, env) if result != 0: check_file_error_message(env['BIBTEX'], 'blg') check_content_hash(suffix_nodes[".bbl"], ".bbl") @@ -364,8 +365,9 @@ def check_content_hash(filenode, suffix) -> bool: if content.find("bibdata") != -1: if Verbose: print("Need to run biber on ",bcffilename) - bibfile = env.fs.File(SCons.Util.splitext(target_bcf)[0]) - result = BiberAction(bibfile, bibfile, env) + auxfile = env.fs.File(target_aux) + bibfile = env.fs.File(SCons.Util.splitext(target_aux)[0] + ".bib") + result = BiberAction(bibfile, auxfile, env) if result != 0: check_file_error_message(env['BIBER'], 'blg') check_content_hash(suffix_nodes[".bbl"], ".bbl") From fc0acf982eed61a3f9c58578af01f2b9e48417ff Mon Sep 17 00:00:00 2001 From: "Keith F. Prussing" Date: Thu, 20 Nov 2025 14:27:27 -0500 Subject: [PATCH 3/7] Compare the normalized text The normalized text in the PDF should be the same. That ensures we have the proper output from the stripping. --- test/TEX/bibtex-extra-extension.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/TEX/bibtex-extra-extension.py b/test/TEX/bibtex-extra-extension.py index d89ce98578..98e75e427e 100644 --- a/test/TEX/bibtex-extra-extension.py +++ b/test/TEX/bibtex-extra-extension.py @@ -70,7 +70,7 @@ test.run() -pdfs = [test.read(_[:-3] + "pdf") for _ in mains] +pdfs = [test.normalize_pdf(test.read(_[:-3] + "pdf")) for _ in mains] test.fail_test(pdfs[0] != pdfs[1]) test.pass_test() From 5918bc13dcae99d0339ccf483c670ce28a849fcf Mon Sep 17 00:00:00 2001 From: "Keith F. Prussing" Date: Thu, 20 Nov 2025 14:30:16 -0500 Subject: [PATCH 4/7] Do not pull in the environment Testing on non-Windows finds pdflatex on the PATH so pulling in the os.envrion is not necessary. --- test/TEX/bibtex-extra-extension.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/TEX/bibtex-extra-extension.py b/test/TEX/bibtex-extra-extension.py index 98e75e427e..22b357facb 100644 --- a/test/TEX/bibtex-extra-extension.py +++ b/test/TEX/bibtex-extra-extension.py @@ -42,7 +42,7 @@ test.write(["SConstruct"], f"""\ import os -env = Environment(ENV={{'PATH': os.environ['PATH']}}, tools=['pdftex', 'tex']) +env = Environment(tools=['pdftex', 'tex']) env.PDF({mains}) """) From 2869dade18cc5db04a330c51d36c70e7255ecd30 Mon Sep 17 00:00:00 2001 From: "Keith F. Prussing" Date: Thu, 20 Nov 2025 15:12:49 -0500 Subject: [PATCH 5/7] Update changes and release notes --- CHANGES.txt | 3 +++ RELEASE.txt | 1 + 2 files changed, 4 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 0d4c4dad8f..cbcd3f5da7 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -16,6 +16,9 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - Whatever John Doe did. + From Keith F Prussing: + - Fix multiple extension stripping for BibTeX and Biber processing + RELEASE 4.10.1 - Sun, 16 Nov 2025 10:51:57 -0700 diff --git a/RELEASE.txt b/RELEASE.txt index 9047a7a9a8..81941fb056 100644 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -33,6 +33,7 @@ FIXES ----- - List fixes of outright bugs +- Fix multiple extension stripping for BibTeX and Biber processing IMPROVEMENTS ------------ From 5448845b5f659face3edc4cb59b6913c3b4c4000 Mon Sep 17 00:00:00 2001 From: "Keith F. Prussing" Date: Thu, 20 Nov 2025 15:31:48 -0500 Subject: [PATCH 6/7] Use the correct biber extension --- SCons/Tool/tex.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SCons/Tool/tex.py b/SCons/Tool/tex.py index 383481e7e5..952c8f6fc2 100644 --- a/SCons/Tool/tex.py +++ b/SCons/Tool/tex.py @@ -366,7 +366,7 @@ def check_content_hash(filenode, suffix) -> bool: if Verbose: print("Need to run biber on ",bcffilename) auxfile = env.fs.File(target_aux) - bibfile = env.fs.File(SCons.Util.splitext(target_aux)[0] + ".bib") + bibfile = env.fs.File(SCons.Util.splitext(target_aux)[0] + ".bbl") result = BiberAction(bibfile, auxfile, env) if result != 0: check_file_error_message(env['BIBER'], 'blg') From 020f82909da1122ddc9f4805e7ebc203f603e347 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Thu, 20 Nov 2025 15:55:52 -0800 Subject: [PATCH 7/7] [ci skip] switch test to use current test template file header --- test/TEX/bibtex-extra-extension.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/TEX/bibtex-extra-extension.py b/test/TEX/bibtex-extra-extension.py index 22b357facb..d2b1231b20 100644 --- a/test/TEX/bibtex-extra-extension.py +++ b/test/TEX/bibtex-extra-extension.py @@ -1,6 +1,8 @@ #!/usr/bin/env python # -# __COPYRIGHT__ +# MIT License +# +# Copyright The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -20,9 +22,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify that running LaTeX with a file named main.extra.tex pulls the