[PATCH 1/4] Simplify tzselect by omitting old Bash workaround
* tzselect.ksh (doselect): Omit Bash 1.14.7 workaround that I wrote in September 1996, as Bash 1.14.7 hasn’t been supported for years and surely should not be used anyway for security reasons. Bash 2.0 came out in December 1996. --- tzselect.ksh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tzselect.ksh b/tzselect.ksh index 18fce27..832cf75 100644 --- a/tzselect.ksh +++ b/tzselect.ksh @@ -101,14 +101,6 @@ then esac done || exit } - - # Work around a bug in bash 1.14.7 and earlier, where $PS3 is sent to stdout. - case $BASH_VERSION in - [01].*) - case `echo 1 | (select x in x; do break; done) 2>/dev/null` in - ?*) PS3= - esac - esac ' else doselect() { -- 2.32.0
* tzselect.ksh: Port to Solaris 10 /bin/sh by avoiding ‘! nawk ...’. --- tzselect.ksh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tzselect.ksh b/tzselect.ksh index 832cf75..7b6b789 100644 --- a/tzselect.ksh +++ b/tzselect.ksh @@ -18,11 +18,13 @@ REPORT_BUGS_TO=tz@iana.org # # Bash <https://www.gnu.org/software/bash/> # Korn Shell <http://www.kornshell.com/> -# MirBSD Korn Shell <https://www.mirbsd.org/mksh.htm> +# MirBSD Korn Shell <http://www.mirbsd.org/mksh.htm> # -# For portability to Solaris 9 /bin/sh this script avoids some POSIX -# features and common extensions, such as $(...) (which works sometimes -# but not others), $((...)), and $10. +# For portability to Solaris 10 /bin/sh (supported by Oracle through +# January 2024) this script avoids some POSIX features and common +# extensions, such as $(...) (which works sometimes but not others), +# $((...)), ! CMD, ${#ID}, ${ID##PAT}, ${ID%%PAT}, and $10. + # # This script also uses several features of modern awk programs. # If your host lacks awk, or has an old awk that does not conform to Posix, @@ -177,7 +179,7 @@ done # If the current locale does not support UTF-8, convert data to current # locale's format if possible, as the shell aligns columns better that way. # Check the UTF-8 of U+12345 CUNEIFORM SIGN URU TIMES KI. -! $AWK 'BEGIN { u12345 = "\360\222\215\205"; exit length(u12345) != 1 }' && +$AWK 'BEGIN { u12345 = "\360\222\215\205"; exit length(u12345) != 1 }' || { { tmp=`(mktemp -d) 2>/dev/null` || { tmp=${TMPDIR-/tmp}/tzselect.$$ && (umask 77 && mkdir -- "$tmp") @@ -188,6 +190,7 @@ done TZ_COUNTRY_TABLE=$tmp/iso3166.tab && iconv -f UTF-8 -t //TRANSLIT <"$TZ_ZONE_TABLE" >$tmp/$zonetabtype.tab && TZ_ZONE_TABLE=$tmp/$zonetabtype.tab +} newline=' ' -- 2.32.0
* zic.c (mkdirs): Treat ENOSYS like EEXIST when mkdir fails, to support Solaris 10 automounted mount points. --- zic.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zic.c b/zic.c index b70a606..1ab636b 100644 --- a/zic.c +++ b/zic.c @@ -3563,9 +3563,11 @@ mkdirs(char const *argname, bool ancestors) if (mkdir(name, MKDIR_UMASK) != 0) { /* Do not report an error if err == EEXIST, because some other process might have made the directory - in the meantime. */ + in the meantime. Likewise for ENOSYS, because + Solaris 10 mkdir fails with ENOSYS if the + directory is an automounted mount point. */ int err = errno; - if (err != EEXIST) { + if (err != EEXIST && err != ENOSYS) { error(_("%s: Can't create directory %s: %s"), progname, name, strerror(err)); exit(EXIT_FAILURE); -- 2.32.0
* Makefile (tzselect): Allow AWK to have spaces, so that "make AWK='busybox awk'" works. --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index fd312d9..d30227a 100644 --- a/Makefile +++ b/Makefile @@ -399,9 +399,9 @@ ZFLAGS= ZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS) # The name of a Posix-compliant 'awk' on your system. -# Older 'mawk' versions, such as the 'mawk' in Ubuntu 16.04, might dump core; -# on Ubuntu you can work around this with -# AWK= gawk +# It is better (though not essential) if 'awk' supports UTF-8; +# unfortunately, mawk and busybox awk do not support UTF-8. +# Solaris 10 /usr/bin/awk does not work; try AWK=gawk or AWK=nawk. AWK= awk # The full path name of a Posix-compliant shell, preferably one that supports @@ -744,7 +744,7 @@ date: $(DATEOBJS) tzselect: tzselect.ksh version VERSION=`cat version` && sed \ -e 's|#!/bin/bash|#!$(KSHELL)|g' \ - -e 's|AWK=[^}]*|AWK=$(AWK)|g' \ + -e 's|AWK=[^}]*|AWK='\''$(AWK)'\''|g' \ -e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \ -e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \ -e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \ -- 2.32.0
participants (1)
-
Paul Eggert