[tz] [PROPOSED 4/4] Fix problems with spaces in TZDIR
Paul Eggert
eggert at cs.ucla.edu
Sat Nov 25 23:36:39 UTC 2023
* Makefile (tzselect): Quote substitutions more carefully, so that
TZDIR etc. can contain pretty much anything but ' and newline,
and even ' is allowed as long as it's not preceded by \.
* NEWS: Mention this.
* tzselect.ksh: Quote instances of $TZ_COUNTRY_TABLE and
$TZ_ZONE_TABLE that were mistakenly left unquoted.
---
Makefile | 14 +++++++-------
NEWS | 3 +++
tzselect.ksh | 2 +-
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/Makefile b/Makefile
index e68bdb0c..58e78777 100644
--- a/Makefile
+++ b/Makefile
@@ -810,13 +810,13 @@ date: $(DATEOBJS)
tzselect: tzselect.ksh version
VERSION=`cat version` && sed \
- -e 's|#!/bin/bash|#!$(KSHELL)|g' \
- -e 's|AWK=[^}]*|AWK='\''$(AWK)'\''|g' \
- -e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \
- -e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \
- -e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \
- -e 's|\(TZVERSION\)=.*|\1='"$$VERSION"'|' \
- <$@.ksh >$@.out
+ -e "s'#!/bin/bash'#!"'$(KSHELL)'\' \
+ -e s\''\(AWK\)=[^}]*'\''\1=\'\''$(AWK)\'\'\' \
+ -e s\''\(PKGVERSION\)=.*'\''\1=\'\''($(PACKAGE)) \'\'\' \
+ -e s\''\(REPORT_BUGS_TO\)=.*'\''\1=\'\''$(BUGEMAIL)\'\'\' \
+ -e s\''\(TZDIR\)=[^}]*'\''\1=\'\''$(TZDIR)\'\'\' \
+ -e s\''\(TZVERSION\)=.*'\''\1=\'"'$$VERSION\\''" \
+ <$@.ksh >$@.out
chmod +x $@.out
mv $@.out $@
diff --git a/NEWS b/NEWS
index 5b228f47..0d7fde80 100644
--- a/NEWS
+++ b/NEWS
@@ -32,6 +32,9 @@ Unreleased, experimental changes
DST was in effect before the transition too. (Thanks to Alois
Treindl for debugging help.)
+ tzselect no longer mishandles spaces and most other special
+ characters in BUGEMAIL, PACKAGE, TZDIR, and VERSION.
+
zic no longer mishandles data for Palestine after the year 2075.
Previously, it incorrectly omitted post-2075 transitions that are
predicted for just before and just after Ramadan.
diff --git a/tzselect.ksh b/tzselect.ksh
index dac931d4..8f5f9b26 100644
--- a/tzselect.ksh
+++ b/tzselect.ksh
@@ -169,7 +169,7 @@ esac
# Make sure the tables are readable.
TZ_COUNTRY_TABLE=$TZDIR/iso3166.tab
TZ_ZONE_TABLE=$TZDIR/$zonetabtype.tab
-for f in $TZ_COUNTRY_TABLE $TZ_ZONE_TABLE
+for f in "$TZ_COUNTRY_TABLE" "$TZ_ZONE_TABLE"
do
<"$f" || {
say >&2 "$0: time zone files are not set up correctly"
--
2.40.1
More information about the tz
mailing list