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 3/8] Cope with iconv without ISO~8859-1 support
Date: Wed, 6 May 2026 20:41:59 +0900	[thread overview]
Message-ID: <e536d5ad-2068-489c-af45-67724c929b94@gmail.com> (raw)
In-Reply-To: <e8b6b390-7034-4d01-a565-8d5d48309a05@gmail.com>

It turns out that assuming ISO-8859-1 available in "iconv" was
wrong, for example, under openSUSE/leap 15.6.
Fallback to plain "cat" in case that is not the case.

Fixes: 00361e8bb1e5 ("Convert *.log files into UTF-8 encoding")
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
 utilities/runfirstlatex.sh | 9 ++++++++-
 utilities/runlatex.sh      | 9 ++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/utilities/runfirstlatex.sh b/utilities/runfirstlatex.sh
index 676502b2..3fed1b69 100644
--- a/utilities/runfirstlatex.sh
+++ b/utilities/runfirstlatex.sh
@@ -69,6 +69,13 @@ basename=`echo $1 | sed -e 's/\.tex$//'`
 
 : ${LATEX:=pdflatex}
 
+if iconv --list | grep -q -i iso-8859-1
+then
+	ICONV="iconv -f ISO-8859-1 -t UTF-8"
+else
+	ICONV="cat"
+fi
+
 echo "$LATEX 1 for $basename.pdf"
 $LATEX $LATEX_OPT $basename > /dev/null 2>&1 < /dev/null
 exitcode=$?
@@ -78,7 +85,7 @@ then
 	if encguess -s iso-8859-1 $basename.log | grep -q ISO-8859-1
 	then
 		mv $basename.log $basename-tmp.log
-		iconv -f ISO-8859-1 -t UTF-8 $basename-tmp.log > $basename.log
+		$ICONV $basename-tmp.log > $basename.log
 		rm $basename-tmp.log
 	fi
 fi
diff --git a/utilities/runlatex.sh b/utilities/runlatex.sh
index 5346bb3b..e9689a99 100644
--- a/utilities/runlatex.sh
+++ b/utilities/runlatex.sh
@@ -31,6 +31,13 @@
 
 : ${LATEX:=pdflatex}
 
+if iconv --list | grep -q -i iso-8859-1
+then
+	ICONV="iconv -f ISO-8859-1 -t UTF-8"
+else
+	ICONV="cat"
+fi
+
 diff_warning () {
 	if diff -q $basename-warning.log $basename-warning-prev.log >/dev/null
 	then
@@ -90,7 +97,7 @@ iterate_latex () {
 		if encguess -s iso-8859-1 $basename.log | grep -q ISO-8859-1
 		then
 			mv $basename.log $basename-tmp.log
-			iconv -f ISO-8859-1 -t UTF-8 $basename-tmp.log > $basename.log
+			$ICONV $basename-tmp.log > $basename.log
 			rm $basename-tmp.log
 		fi
 	fi
-- 
2.43.0



  parent reply	other threads:[~2026-05-06 11:41 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 ` Akira Yokosawa [this message]
2026-05-06 11:43 ` [PATCH -perfbook 4/8] precheck-tentative.sh: Detect premature versions of "lineno" and "microtype" Akira Yokosawa
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=e536d5ad-2068-489c-af45-67724c929b94@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