utilities/autodate.sh: Fix potential hung-up on missing tcolorbox
PATCH 1/1 utilities/autodate.sh: Fix potential hung-up on missing tcolorbox
"kpsewhich tcolorbox.sty" can be empty if tcolorbox is not available.
If this is the case, "grep" in grep ProvidePackage | sed ... will wait forever.
Add an empty check in front of "grep" with exit code of 1.
--- utilities/autodate.sh | 7 +++++++ 1 file changed, 7 insertions(+)
utilities/autodate.sh +7 -0
@@ -97,6 +97,13 @@ env printf '\\IfQqzBg{}{\\setboolean{qqzbg}{%s}}\n' $qqzbg # command for newer tcolorbox (4.40 or later) to have backward-compatible skips tcolorbox_sty=`kpsewhich tcolorbox.sty` + +if [ "$tcolorbox_sty" == "" ] +then + echo "Error: package 'tcolorbox' not found. See See #9 in FAQ-BUILD.txt" >&2 + exit 1 +fi + tcbversion=`grep ProvidesPackage $tcolorbox_sty | sed -e 's/.*version \([0-9]\+\.[0-9]\+\).*/\1/g'` tcbold=4.39 env printf '%% tcolorbox version: %s\n' $tcbversion
Signature · 1 line
2.17.1
Quoted 7 lines · Akira Yokosawa
"kpsewhich tcolorbox.sty" can be empty if tcolorbox is not available.
If this is the case, "grep" in
grep ProvidePackage | sed ...will wait forever.Add an empty check in front of "grep" with exit code of 1.
Paul,
Please ignore this patch.
I'll respin soon.
Sorry for the noise.
-- Akira
Quoted 26 lines
Fixes b2f19231bcc5 ("utilities/autodate.sh: Make newer tcolorbox behave as before")Signed-off-by Akira Yokosawa <[email protected]>--- utilities/autodate.sh | 7 +++++++ 1 file changed, 7 insertions(+)utilities/autodate.sh +7
-0@@ -97,6 +97,13 @@ env printf '\\IfQqzBg{}{\\setboolean{qqzbg}{%s}}\n' $qqzbg # command for newer tcolorbox (4.40 or later) to have backward-compatible skips tcolorbox_sty=`kpsewhich tcolorbox.sty` + +if [ "$tcolorbox_sty" == "" ] +then + echo "Error: package 'tcolorbox' not found. See See #9 in FAQ-BUILD.txt" >&2 + exit 1 +fi + tcbversion=`grep ProvidesPackage $tcolorbox_sty | sed -e 's/.*version \([0-9]\+\.[0-9]\+\).*/\1/g'` tcbold=4.39 env printf '%% tcolorbox version: %s\n' $tcbversion
PATCH v2 1/1 utilities/autodate.sh: Fix potential hung-up on missing tcolorbox
In reply to Akira Yokosawa"kpsewhich tcolorbox.sty" can be empty if tcolorbox is not available.
If this is the case, "grep" in grep ProvidePackage | sed ... will wait forever.
Add an empty check in front of "grep" with exit code of 1.
---
Change since v1:
o Fix string comparison operator of shell script ("=")
--utilities/autodate.sh | 7 +++++++
1 file changed, 7 insertions(+)
utilities/autodate.sh +7 -0
@@ -97,6 +97,13 @@ env printf '\\IfQqzBg{}{\\setboolean{qqzbg}{%s}}\n' $qqzbg # command for newer tcolorbox (4.40 or later) to have backward-compatible skips tcolorbox_sty=`kpsewhich tcolorbox.sty` + +if [ "$tcolorbox_sty" = "" ] +then + echo "Error: package 'tcolorbox' not found. See See #9 in FAQ-BUILD.txt" >&2 + exit 1 +fi + tcbversion=`grep ProvidesPackage $tcolorbox_sty | sed -e 's/.*version \([0-9]\+\.[0-9]\+\).*/\1/g'` tcbold=4.39 env printf '%% tcolorbox version: %s\n' $tcbversion
Signature · 1 line
2.17.1
PATCH v3 1/1 utilities/autodate.sh: Fix potential hung-up on missing tcolorbox
In reply to Akira Yokosawa"kpsewhich tcolorbox.sty" can be empty if tcolorbox is not available.
If this is the case, "grep" in grep ProvidePackage | sed ... will wait forever.
Add an empty check in front of "grep" with exit code of 1.
---
Change since v2:
o Refer to #5 in FAQ-BUILD.txt, as tcolorbox is not a font package.
Change since v1:
o Fix string comparison operator of shell script ("=").
--utilities/autodate.sh | 7 +++++++
1 file changed, 7 insertions(+)
utilities/autodate.sh +7 -0
@@ -97,6 +97,13 @@ env printf '\\IfQqzBg{}{\\setboolean{qqzbg}{%s}}\n' $qqzbg # command for newer tcolorbox (4.40 or later) to have backward-compatible skips tcolorbox_sty=`kpsewhich tcolorbox.sty` + +if [ "$tcolorbox_sty" = "" ] +then + echo "Error: package 'tcolorbox' not found. See See #5 in FAQ-BUILD.txt" >&2 + exit 1 +fi + tcbversion=`grep ProvidesPackage $tcolorbox_sty | sed -e 's/.*version \([0-9]\+\.[0-9]\+\).*/\1/g'` tcbold=4.39 env printf '%% tcolorbox version: %s\n' $tcbversion
Signature · 1 line
2.17.1
Quoted 7 lines · Akira Yokosawa
Quoted 6 lines · Akira Yokosawa
"kpsewhich tcolorbox.sty" can be empty if tcolorbox is not available.
If this is the case, "grep" in
grep ProvidePackage | sed ...will wait forever.
Quoted 8 lines
Quoted 1 line
Add an empty check in front of "grep" with exit code of 1.
Paul,
Please ignore this patch.
I'll respin soon.Sorry for the noise.
Ignored, and no problem! Been there, done that! ;-)
Thanx, Paul
Quoted 29 lines
-- Akira
Quoted 26 lines
Fixes b2f19231bcc5 ("utilities/autodate.sh: Make newer tcolorbox behave as before")Signed-off-by Akira Yokosawa <[email protected]>--- utilities/autodate.sh | 7 +++++++ 1 file changed, 7 insertions(+)utilities/autodate.sh +7
-0@@ -97,6 +97,13 @@ env printf '\\IfQqzBg{}{\\setboolean{qqzbg}{%s}}\n' $qqzbg # command for newer tcolorbox (4.40 or later) to have backward-compatible skips tcolorbox_sty=`kpsewhich tcolorbox.sty` + +if [ "$tcolorbox_sty" == "" ] +then + echo "Error: package 'tcolorbox' not found. See See #9 in FAQ-BUILD.txt" >&2 + exit 1 +fi + tcbversion=`grep ProvidesPackage $tcolorbox_sty | sed -e 's/.*version \([0-9]\+\.[0-9]\+\).*/\1/g'` tcbold=4.39 env printf '%% tcolorbox version: %s\n' $tcbversion
PATCH v4 1/1 utilities/autodate.sh: Fix potential hung-up on missing tcolorbox
In reply to Akira Yokosawa"kpsewhich tcolorbox.sty" can be empty if tcolorbox is not available.
If this is the case, "grep" in grep ProvidePackage | sed ... will wait forever.
Add existence check of tcolorbox early in the script and error-exit.
To prevent empty autodate.tex from left behind, modify the behavior of the script so that it doesn't rely on the redirection in Makefile.
---
Changes since v3:
o Fix typo of "See See" in the error message.
o Move existence check of tcolorbox to the beginning.
o Use redirection in the script, not in the Makefile
Change since v2:
o Refer to #5 in FAQ-BUILD.txt, as tcolorbox is not a font package.
Change since v1:
o Fix string comparison operator of shell script ("=").
--
Makefile | 2 +- utilities/autodate.sh | 24 ++++++++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-)
Makefile +1 -1
@@ -234,7 +234,7 @@ endif autodate.tex: perfbook-lt.tex $(LATEXSOURCES) $(BIBSOURCES) \ $(PDFTARGETS_OF_EPS) $(PDFTARGETS_OF_SVG) $(FCVSNIPPETS) $(FCVSNIPPETS_VIA_LTMS) \ $(GITREFSTAGS) utilities/autodate.sh - sh utilities/autodate.sh >autodate.tex + sh utilities/autodate.sh perfbook_flat.tex: autodate.tex ifndef LATEXPAND
utilities/autodate.sh +16 -8
@@ -19,12 +19,21 @@ # along with this program; if not, you can access it online at # http://www.gnu.org/licenses/gpl-2.0.html. # -# Copyright (C) Akira Yokosawa, 2017--2020 +# Copyright (C) Akira Yokosawa, 2017--2021 # # Authors: Akira Yokosawa <[email protected]> export LC_TIME=C qqzbg="false" +fn="autodate.tex" + +# check if we have tcolorbox +tcolorbox_sty=`kpsewhich tcolorbox.sty` +if [ "$tcolorbox_sty" = "" ] +then + echo "Error: package 'tcolorbox' not found. See #5 in FAQ-BUILD.txt." >&2 + exit 1 +fi # check if we are in git repository if ! test -e .git
@@ -90,17 +99,16 @@ then release=`env printf '%s %s' '\\\\' "$release"` fi -env printf '\\date{%s %s, %s %s %s}\n' $month $day $year "$release" $modified -env printf '\\newcommand{\\commityear}{%s}\n' $year -env printf '\\newcommand{\\commitid}{%s}\n' $commitid$modified -env printf '\\IfQqzBg{}{\\setboolean{qqzbg}{%s}}\n' $qqzbg +env printf '\\date{%s %s, %s %s %s}\n' $month $day $year "$release" $modified > $fn +env printf '\\newcommand{\\commityear}{%s}\n' $year >> $fn +env printf '\\newcommand{\\commitid}{%s}\n' $commitid$modified >> $fn +env printf '\\IfQqzBg{}{\\setboolean{qqzbg}{%s}}\n' $qqzbg >> $fn # command for newer tcolorbox (4.40 or later) to have backward-compatible skips -tcolorbox_sty=`kpsewhich tcolorbox.sty` tcbversion=`grep ProvidesPackage $tcolorbox_sty | sed -e 's/.*version \([0-9]\+\.[0-9]\+\).*/\1/g'` tcbold=4.39 -env printf '%% tcolorbox version: %s\n' $tcbversion +env printf '%% tcolorbox version: %s\n' $tcbversion >> $fn if [ $(echo $tcbversion $tcbold | awk '{if ($1 > $2) print 1;}') ] ; then - env printf '\\tcbsetforeverylayer{autoparskip}\n'; + env printf '\\tcbsetforeverylayer{autoparskip}\n' >> $fn fi
Signature · 1 line
2.17.1
Quoted 10 lines · Paul E. McKenney
Quoted 9 lines · Akira Yokosawa
Quoted 7 lines · Akira Yokosawa
"kpsewhich tcolorbox.sty" can be empty if tcolorbox is not available.
If this is the case, "grep" in
grep ProvidePackage | sed ...will wait forever.Add an empty check in front of "grep" with exit code of 1.
Quoted 8 lines
Quoted 6 lines
Paul,
Please ignore this patch.
I'll respin soon.Sorry for the noise.
Ignored, and no problem! Been there, done that! ;-)
Patch v4 I just sent out should be good enough.
I'm afraid you don't have a handy environment to test the error path, but I did uninstall texlive-tcolorbox on a Fedora container and confirmed the error check works as expected.
Thanks, Akira
Quoted 32 lines
Thanx, Paul
Quoted 29 lines
-- Akira
Quoted 26 lines
Fixes b2f19231bcc5 ("utilities/autodate.sh: Make newer tcolorbox behave as before")Signed-off-by Akira Yokosawa <[email protected]>--- utilities/autodate.sh | 7 +++++++ 1 file changed, 7 insertions(+)utilities/autodate.sh +7
-0@@ -97,6 +97,13 @@ env printf '\\IfQqzBg{}{\\setboolean{qqzbg}{%s}}\n' $qqzbg # command for newer tcolorbox (4.40 or later) to have backward-compatible skips tcolorbox_sty=`kpsewhich tcolorbox.sty` + +if [ "$tcolorbox_sty" == "" ] +then + echo "Error: package 'tcolorbox' not found. See See #9 in FAQ-BUILD.txt" >&2 + exit 1 +fi + tcbversion=`grep ProvidesPackage $tcolorbox_sty | sed -e 's/.*version \([0-9]\+\.[0-9]\+\).*/\1/g'` tcbold=4.39 env printf '%% tcolorbox version: %s\n' $tcbversion
Paul E. McKenney
AppliedQuoted 6 lines · Akira Yokosawa
"kpsewhich tcolorbox.sty" can be empty if tcolorbox is not available.
If this is the case, "grep" in
grep ProvidePackage | sed ...will wait forever.
Quoted 7 lines
Add existence check of tcolorbox early in the script and error-exit.
To prevent empty autodate.tex from left behind, modify the behavior of the script so that it doesn't rely on the redirection in
Makefile.Fixes b2f19231bcc5 ("utilities/autodate.sh: Make newer tcolorbox behave as before")Signed-off-by Akira Yokosawa <[email protected]>
Queued and pushed, thank you!
Thanx, Paul
Quoted 88 lines
---
Changes since v3:o Fix typo of "See See" in the error message.
o Move existence check of tcolorbox to the beginning.
o Use redirection in the script, not in theMakefileChange since v2:
o Refer to #5 in FAQ-BUILD.txt, as tcolorbox is not a font package.
Change since v1:
o Fix string comparison operator of shell script ("=").
--
Makefile | 2 +- utilities/autodate.sh | 24 ++++++++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-)Makefile +1
-1@@ -234,7 +234,7 @@ endif autodate.tex: perfbook-lt.tex $(LATEXSOURCES) $(BIBSOURCES) \ $(PDFTARGETS_OF_EPS) $(PDFTARGETS_OF_SVG) $(FCVSNIPPETS) $(FCVSNIPPETS_VIA_LTMS) \ $(GITREFSTAGS) utilities/autodate.sh - sh utilities/autodate.sh >autodate.tex + sh utilities/autodate.sh perfbook_flat.tex: autodate.tex ifndef LATEXPANDutilities/autodate.sh +16
-8@@ -19,12 +19,21 @@ # along with this program; if not, you can access it online at # http://www.gnu.org/licenses/gpl-2.0.html. # -# Copyright (C) Akira Yokosawa, 2017--2020 +# Copyright (C) Akira Yokosawa, 2017--2021 # # Authors: Akira Yokosawa <[email protected]> export LC_TIME=C qqzbg="false" +fn="autodate.tex" + +# check if we have tcolorbox +tcolorbox_sty=`kpsewhich tcolorbox.sty` +if [ "$tcolorbox_sty" = "" ] +then + echo "Error: package 'tcolorbox' not found. See #5 in FAQ-BUILD.txt." >&2 + exit 1 +fi # check if we are in git repository if ! test -e .git@@ -90,17 +99,16 @@ then release=`env printf '%s %s' '\\\\' "$release"` fi -env printf '\\date{%s %s, %s %s %s}\n' $month $day $year "$release" $modified -env printf '\\newcommand{\\commityear}{%s}\n' $year -env printf '\\newcommand{\\commitid}{%s}\n' $commitid$modified -env printf '\\IfQqzBg{}{\\setboolean{qqzbg}{%s}}\n' $qqzbg +env printf '\\date{%s %s, %s %s %s}\n' $month $day $year "$release" $modified > $fn +env printf '\\newcommand{\\commityear}{%s}\n' $year >> $fn +env printf '\\newcommand{\\commitid}{%s}\n' $commitid$modified >> $fn +env printf '\\IfQqzBg{}{\\setboolean{qqzbg}{%s}}\n' $qqzbg >> $fn # command for newer tcolorbox (4.40 or later) to have backward-compatible skips -tcolorbox_sty=`kpsewhich tcolorbox.sty` tcbversion=`grep ProvidesPackage $tcolorbox_sty | sed -e 's/.*version \([0-9]\+\.[0-9]\+\).*/\1/g'` tcbold=4.39 -env printf '%% tcolorbox version: %s\n' $tcbversion +env printf '%% tcolorbox version: %s\n' $tcbversion >> $fn if [ $(echo $tcbversion $tcbold | awk '{if ($1 > $2) print 1;}') ] ; then - env printf '\\tcbsetforeverylayer{autoparskip}\n'; + env printf '\\tcbsetforeverylayer{autoparskip}\n' >> $fn fiSignature · 1 line
2.17.1