Discussions of the Parallel Programming book
 help / color / mirror / Atom feed
From: Akira Yokosawa <akiyks@gmail.com>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: perfbook@vger.kernel.org, Akira Yokosawa <akiyks@gmail.com>
Subject: [PATCH -perfbook 4/8] precheck-tentative.sh: Detect premature versions of "lineno" and "microtype"
Date: Wed, 6 May 2026 20:43:03 +0900	[thread overview]
Message-ID: <afadddc8-714f-483d-8359-1b3640ee37e4@gmail.com> (raw)
In-Reply-To: <e8b6b390-7034-4d01-a565-8d5d48309a05@gmail.com>

LaTeX2e "<2025-06-01> Patch Level 1" and later changed the way
output hooks are applied to column/page breaks.
As a result, loading pre-v5.7 lineno.sty breaks chapter/section
titles printed in the header area of twocolumn builds.
lineno.sty v5.7 has restored compatibility with recent LaTeX2e
releases and v5.9 has fixed its regression of potential infinite
loop [1].

hyperref.sty has made a change in a way it loses compatibility
with microtype.sty <v3.2c [2].

Unfortunately, Ubuntu LTS (26.04) and Fedora 44 were released
with such premature versions at their initial releases.

As a tentative measure, add a script named precheck-tentative.sh,
which detects said premature packages and suggests their upgrades.

Link: https://ctan.org/ctan-ann/id/aa3GMRDWA8OxUAGc@prptp [1]
Link: https://github.com/schlcht/microtype/issues/64 [2]
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
 Makefile                        |  1 +
 utilities/precheck-tentative.sh | 66 +++++++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+)
 create mode 100755 utilities/precheck-tentative.sh

diff --git a/Makefile b/Makefile
index a72b4794..b4f34c51 100644
--- a/Makefile
+++ b/Makefile
@@ -297,6 +297,7 @@ endif
 ifeq ($(LATEX_CMD),)
 	$(error LaTeX engine "$(LATEX)" not found.)
 endif
+	LATEX=$(LATEX) sh utilities/precheck-tentative.sh
 	LATEX=$(LATEX) sh utilities/runfirstlatex.sh $(basename $@)
 
 autodate.tex: $(LATEXSOURCES) $(BIBSOURCES) $(LST_SOURCES) \
diff --git a/utilities/precheck-tentative.sh b/utilities/precheck-tentative.sh
new file mode 100755
index 00000000..8b53e02c
--- /dev/null
+++ b/utilities/precheck-tentative.sh
@@ -0,0 +1,66 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Check buggy LaTeX packages observed in distro TeX Live as of April 2026.
+#
+# Copyright (C) Akira Yokosawa, 2026
+
+KPSEWHICH=`command -v kpsewhich`
+
+if [ "$KPSEWHICH" != "" ] ; then
+
+#### Is lineno.sty too young for LaTeX2e ?
+# LaTeX2e <2025-06-01> and later needs lineno.sty v5.7 or later.
+# This is a minor incompatibility observed only in twocolumn builds.
+#
+#   Symptom: chapter & section titles in header area are broken.
+
+lineno_sty=`kpsewhich lineno.sty`
+lineno_ver=`grep -F '\def\fileversion' $lineno_sty | \
+	sed -E -e 's/.*\{(v[0-9\.]+)\}.*$/\1/'`
+LINENO_AT_LEAST=v5.7
+linenosince=`env printf "$LINENO_AT_LEAST\n$lineno_ver" | sort -V | head -n 1`
+
+latex_release=`kpsewhich latexrelease.sty`
+latex_ver=`grep -F -A1 -e '\edef\latexreleaseversion' $latex_release | \
+	grep -F '{' | \
+	sed -E -e 's/[ ]+\{([0-9\-]+)\}/<\1>/' -e 's/\//\-/g'`
+
+LATEX_SINCE="<2025-06-01>"
+latexsince=`env printf "$LATEX_SINCE\n$latex_ver" | sort | head -n 1`
+
+if [ "$latexsince" = "$LATEX_SINCE" ] ; then  # older
+    if [ "$linenosince" != "$LINENO_AT_LEAST" ] ; then
+	echo "lineno.sty $lineno_ver is too young for LaTeX2e $latex_ver."
+	echo "Upgrade lineno.sty to at least v5.7."
+        echo "Treat this as a minor issue and continue building nonetheless."
+    fi
+fi
+
+#### Is microtype.sty too young for recent hyperref (>=v7.01p) ?
+
+microtype_sty=`kpsewhich microtype.sty`
+microtype_ver=`grep -F -A2 -e '\ProvidesPackage' $microtype_sty | \
+	grep -F '[' | \
+	sed -E -e 's/[ ]+\[[0-9\/]+ (v[0-9a-z\.]+)/\1/'`
+
+MICROTYPE_AT_LEAST="v3.2c"
+microtypesince=`env printf "$MICROTYPE_AT_LEAST\n$microtype_ver" | sort -V | head -n 1`
+
+hyperref_sty=`kpsewhich hyperref.sty`
+hyperref_ver=`grep -F -A1 -e '\ProvidesPackage{hyperref}' $hyperref_sty | \
+	grep -F '[' | sed -e 's/%//' | \
+	sed -E -e 's/[ ]+\[[0-9\/\-]+ (v[0-9a-z\.]+)[ ]+/\1/'`
+
+HYPERREF_SINCE="v7.01p"
+hyperrefsince=`env printf "$HYPERREF_SINCE\n$hyperref_ver" | sort -V | head -n 1`
+
+if [ "$hyperrefsince" = "$HYPERREF_SINCE" ] ; then  # older
+    if [ "$microtypesince" != "$MICROTYPE_AT_LEAST" ] ; then
+	echo "microtype.sty $microtype_ver is too young for hyperref.sty $hyperref_ver."
+	echo "Upgrade microtype.sty to at least $MICROTYPE_AT_LEAST."
+        echo "Treat this as a minor issue and continue building nonetheless."
+    fi
+fi
+
+fi  #KPSEWHICH
-- 
2.43.0



  parent reply	other threads:[~2026-05-06 11:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-06 11:37 [PATCH -perfbook 0/8] May 2026 updates (1st set) Akira Yokosawa
2026-05-06 11:38 ` [PATCH -perfbook 1/8] Update rcu-test-ratio for Linux v7.0 Akira Yokosawa
2026-05-06 11:40 ` [PATCH -perfbook 2/8] Apply hotfix for cleveref against recent LaTeX2e Akira Yokosawa
2026-05-06 11:41 ` [PATCH -perfbook 3/8] Cope with iconv without ISO~8859-1 support Akira Yokosawa
2026-05-06 11:43 ` Akira Yokosawa [this message]
2026-05-06 11:44 ` [PATCH -perfbook 5/8] runlatex.sh: Add WARNEXIT variable to make "LaTeX Warning:" in .log be ignored Akira Yokosawa
2026-05-06 11:45 ` [PATCH -perfbook 6/8] precheck-tentative.sh: Fail early with suggestions for Fedora 44 Akira Yokosawa
2026-05-06 11:46 ` [PATCH -perfbook 7/8] precheck.sh: Add check of missing LaTeX packages " Akira Yokosawa
2026-05-06 11:47 ` [PATCH -perfbook 8/8] FAQ-BUILD: Add needed " Akira Yokosawa
2026-05-06 18:42 ` [PATCH -perfbook 0/8] May 2026 updates (1st set) Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=afadddc8-714f-483d-8359-1b3640ee37e4@gmail.com \
    --to=akiyks@gmail.com \
    --cc=paulmck@kernel.org \
    --cc=perfbook@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox