Discussions of the Parallel Programming book
 help / color / mirror / Atom feed
From: Kunwu Chan <kunwu.chan@linux.dev>
To: perfbook@vger.kernel.org
Cc: Kunwu Chan <kunwu.chan@linux.dev>, Kunwu Chan <kunwu.chan@gmail.com>
Subject: [PATCH] precheck-tentative.sh: Make array.sty probing fail-fast and deterministic
Date: Thu,  7 May 2026 17:50:11 +0800	[thread overview]
Message-ID: <20260507095011.1551131-1-kunwu.chan@linux.dev> (raw)

On systems where kpsewhich cannot resolve array.sty, the script fed an
empty path into the version-parsing pipeline and then compared an empty
array_req_ver against latex_ver in the non-pdflatex-dev path. The
result depended on environment and produced no actionable error.

This is reproducible by overriding kpsewhich to return nothing for
array.sty while keeping other lookups intact.

Add a guard before parsing array.sty, set array_req_ver only when the
file exists, fail fast with a clear diagnostic when it does not, and
correct the warning text typo ("arary.sty" -> "array.sty").

Fixes: 4cad3dd1174a ("precheck-tentative.sh: Fail early with suggestions for Fedora 44")

Signed-off-by: Kunwu Chan <kunwu.chan@gmail.com>
---
 utilities/precheck-tentative.sh | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/utilities/precheck-tentative.sh b/utilities/precheck-tentative.sh
index 96d2fe2f..1e106877 100755
--- a/utilities/precheck-tentative.sh
+++ b/utilities/precheck-tentative.sh
@@ -77,15 +77,24 @@ if [ "$latex_release_dev" != "" ] ; then
 fi
 
 array_sty=`kpsewhich array.sty`
-array_req_ver=`grep -F -e '\NeedsTeXFormat{LaTeX2e}' $array_sty | \
-	tail -n 1 | \
-	sed -e 's/\\\\NeedsTeXFormat{LaTeX2e}//' | \
-	sed -E -e 's/\[/</' -e 's/\]/>/' -e 's/\//\-/g'`
+if [ "$array_sty" != "" ] ; then
+	array_req_ver=`grep -F -e '\NeedsTeXFormat{LaTeX2e}' $array_sty | \
+		tail -n 1 | \
+		sed -e 's/\\\\NeedsTeXFormat{LaTeX2e}//' | \
+		sed -E -e 's/\[/</' -e 's/\]/>/' -e 's/\//\-/g'`
+else
+	array_req_ver=""
+fi
 
 if [ "$LATEX" != "pdflatex-dev" ] ; then
+    if [ "$array_req_ver" = "" ] ; then
+	echo "array.sty is not found!"
+	echo "Check your TeX Live installation."
+	exit 1
+    fi
     if [ "$array_req_ver" \> "$latex_ver" -a "$WARNEXIT" = "1" ] ; then
 	echo "#### array.sty requires a later release of LaTeX2e.     ####"
-	echo "#### arary.sty requires LaTeX2e $array_req_ver,           ####"
+	echo "#### array.sty requires LaTeX2e $array_req_ver,           ####"
 	echo "#### while your LaTeX2e is $latex_ver.                ####"
 	echo "#### Check your TeX Live installation.  (Known issue under Fedora 44.)"
 	echo "#### 1st option is to downgrade array.sty to v2.6n."
-- 
2.25.1


             reply	other threads:[~2026-05-07  9:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-07  9:50 Kunwu Chan [this message]
2026-05-07 10:37 ` [PATCH] precheck-tentative.sh: Make array.sty probing fail-fast and deterministic Akira Yokosawa
2026-05-07 17:52   ` 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=20260507095011.1551131-1-kunwu.chan@linux.dev \
    --to=kunwu.chan@linux.dev \
    --cc=kunwu.chan@gmail.com \
    --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