Skip to contentSkip to conversation

Work around regression of recent fvextra

PATCH In review Akira Yokosawa 2 participants 4 messages Oct 19, 2025 Kbuild

lore
Share & tools
lore
#0 lore raw

cover Work around regression of recent fvextra

Hi Paul,

Commit cd98035a31bc ("runlatex.sh: Detect fvextra versions with known minor regression") did not fix anything.

Having seen that the regression is spread to a couple of long-term support distros (debian:trixie and opensuse/leap:16), I think a better approach is to patch the (LaTeX) package on-the-fly.

Patch 1/2 reverts the first attempt emitting the suggestion only. My preference is for you to drop the commit, if it is not too late.

Patch 2/2 implements the on-the-fly patching of buggy fvextra.

Thanks, Akira
--
Akira Yokosawa (2):
Revert "runlatex.sh: Detect fvextra versions with known minor
regression"
Detect buggy fvextra and apply patch on the fly

 Makefile              |  1 +
 fixfvextra.ltx        | 11 +++++++++++
 perfbook-lt.tex       |  7 +++++++
 utilities/autodate.sh | 17 +++++++++++++++++
 utilities/runlatex.sh | 16 ----------------
 5 files changed, 36 insertions(+), 16 deletions(-)
 create mode 100644 fixfvextra.ltx

base-commit: cd98035a31bcefff91d221aa25df2b7b98da243d

Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/2 Revert "runlatex.sh: Detect fvextra versions with known minor regression"

This reverts commit cd98035a31bcefff91d221aa25df2b7b98da243d.

Rather than asking manual install of fvextra < v1.11.0 or > v1.13.2, next patch applies the (tentative) fix on-the-fly when buggy fvextra is detected.

Let's revert the first attempt.

---
 utilities/runlatex.sh | 16 ----------------
 1 file changed, 16 deletions(-)
utilities/runlatex.sh +0 -16
index d5b1844d..17d833ad 100644
@@ -169,22 +169,6 @@ then
 	echo "### Consider upgrading to Ubuntu 20.04 LTS or later.     ###"
 	echo "############################################################"
 fi
-# fvextra version check (Ubuntu 25.04 and 25.10 have buggy one
-FVEXTRA_VER=`grep -E -e 'fvextra .* v[0-9\.]+' $basename.log | \
-		sed -e 's/.* \(v.*\) fv.*/\1/'`
-#echo $FVEXTRA_VER
-FVEXTRA_BUGGY_SINCE=v1.11.0
-FVEXTRA_BUGGY_UNTIL=v1.13.2
-
-fvextra_since=`env printf "$FVEXTRA_BUGGY_SINCE\n$FVEXTRA_VER" | sort -V | head -n 1`
-fvextra_until=`env printf "$FVEXTRA_BUGGY_UNTIL\n$FVEXTRA_VER" | sort -V | tail -n 1`
-
-if [ $fvextra_since = $FVEXTRA_BUGGY_SINCE -a $fvextra_until = $FVEXTRA_BUGGY_UNTIL ] ; then
-	echo "Buggy fvextra $FVEXTRA_VER detected."
-	echo "It causes undesirable page/column breaks in short code snippets."
-	echo "Consider installing fvextra < $FVEXTRA_BUGGY_SINCE or > $FVEXTRA_BUGGY_UNTIL."
-fi
-
 # to avoid redundant run of bibtex and pdflatex
 touch $basename.bbl
 touch $basename.pdf
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/2 Detect buggy fvextra and apply patch on the fly

In reply to Akira Yokosawa

fvextra versions from v1.11.0 to v1.13.2 (latest) have a minor regression which ignores fancyvrb's "samepage=true" key. It is used in perfbook to prevent short snippets from broken across columns/pages. This is a minor regression but affects reproducible build of perfbook.

Unfortunately, distro texlive packages based on upstream TeX Live since early March 2025 are all affected by this regression, including debian trixie and opensuse/leap 16.0 (Long Term Support); and ubuntu plucky and questing (Rolling release); as well as archlinux and opensuse/tumbleweed (Rapid release) as of this writing.

This issue was reported upstream and a tentative one-liner fix was provied by Yukai Chou at [1].

Add code in autodate.sh to detect buggy fvextra and have a boolean "buggyfvextra" set "true" in autodate.tex.

In the preamble, conditionally load fixfvextra.ltx which contains the tentative patch to be applied on-the-fly.

---
 Makefile              |  1 +
 fixfvextra.ltx        | 11 +++++++++++
 perfbook-lt.tex       |  7 +++++++
 utilities/autodate.sh | 17 +++++++++++++++++
 4 files changed, 36 insertions(+)
 create mode 100644 fixfvextra.ltx
Makefile +1 -0
index 29d7c99f..1e63c0b5 100644
@@ -13,6 +13,7 @@ LATEXSOURCES = \
 	pfbook.cls \
 	ushyphex.tex pfhyphex.tex \
 	ack.tex \
+	*.ltx \
 	*/*.tex \
 	*/*/*.tex
 
fixfvextra.ltx new file +11 -0
new file mode 100644
index 00000000..b79411c5
@@ -0,0 +1,11 @@
+\makeatletter
+\AtBeginDocument
+{
+  \def\FV@bgcoloroverlap{%
+    \ifx\FV@backgroundcolorboxoverlap\relax
+    \else
+      \nopagebreak  % <<< added
+      \vspace{-\FV@backgroundcolorboxoverlap}%
+  \fi}
+} %
+\makeatother
perfbook-lt.tex +7 -0
index e1dcd03f..6dc698d1 100644
@@ -108,6 +108,9 @@
 \setboolean{noqqz}{false}
 \newcommand{\IfNoQqz}[2]{\ifthenelse{\boolean{noqqz}}{#1}{#2}}
 
+\newboolean{buggyfvextra}
+\setboolean{buggyfvextra}{false}
+
 \input{autodate} % need to input here to reflect tag state
 \usepackage{qqz}
 \usepackage{origpub}
@@ -583,6 +586,10 @@
 % Glossaries dictionary and custom settings
 \input{glsdict}
 
+\ifthenelse{\boolean{buggyfvextra}}{
+  \input{fixfvextra.ltx}
+}{}
+
 \begin{document}
 
 %%HTMLSKIP
utilities/autodate.sh +17 -0
index 1efdbdee..839db7f3 100644
@@ -133,3 +133,20 @@ if [ $(echo $tcbversion $tcbold | awk '{if ($1 > $2) print 1;}') ] ;
 then
 	env printf '\\tcbsetforeverylayer{autoparskip}\n' >> $fn
 fi
+
+# check if fvextra is buggy ("samepage=true")
+FVEXTRA_BUGGY_SINCE=v1.11.0
+FVEXTRA_BUGGY_UNTIL=v1.13.2
+
+fvextra_sty=`kpsewhich fvextra.sty`
+if [ "x$fvextra_sty" != "x" ] ; then
+	fvextra_ver=`grep -E -e 'v[0-9\.]+ fvextra' $fvextra_sty | \
+		        sed -e 's/.* \(v.*\) fv.*/\1/'`
+	fvextra_since=`env printf "$FVEXTRA_BUGGY_SINCE\n$fvextra_ver" | sort -V | head -n 1`
+	fvextra_until=`env printf "$FVEXTRA_BUGGY_UNTIL\n$fvextra_ver" | sort -V | tail -n 1`
+fi
+
+if [ $fvextra_since = $FVEXTRA_BUGGY_SINCE -a $fvextra_until = $FVEXTRA_BUGGY_UNTIL ] ; then
+	env printf '%% fvextra buggy: %s\n' $fvextra_ver >> $fn
+	env printf '\\setboolean{buggyfvextra}{true}\n' >> $fn
+fi
Signature · 1 line
2.43.0
#3 lore raw
In reply to Akira Yokosawa
Quoted 5 lines · Akira Yokosawa

Hi Paul,

Commit cd98035a31bc ("runlatex.sh: Detect fvextra versions with known minor regression") did not fix anything.

Quoted 8 lines

Having seen that the regression is spread to a couple of long-term support distros (debian:trixie and opensuse/leap:16), I think a better approach is to patch the (LaTeX) package on-the-fly.

Patch 1/2 reverts the first attempt emitting the suggestion only. My preference is for you to drop the commit, if it is not too late.

Patch 2/2 implements the on-the-fly patching of buggy fvextra.

Again, thank you, and again queued and pushed.

I kept the original commit and took your revert because I had already pushed the original commit and because it is quite possible that your original commit might be useful to someone else in a different situation.

Thanx, Paul

Quoted 20 lines

Thanks, Akira
--
Akira Yokosawa (2):
Revert "runlatex.sh: Detect fvextra versions with known minor
regression"
Detect buggy fvextra and apply patch on the fly

 Makefile              |  1 +
 fixfvextra.ltx        | 11 +++++++++++
 perfbook-lt.tex       |  7 +++++++
 utilities/autodate.sh | 17 +++++++++++++++++
 utilities/runlatex.sh | 16 ----------------
 5 files changed, 36 insertions(+), 16 deletions(-)
 create mode 100644 fixfvextra.ltx

base-commit: cd98035a31bcefff91d221aa25df2b7b98da243d

Signature · 1 line
2.43.0