[PROPOSED 1/4] Fix bug with ‘make typecheck; make clean’

* Makefile (clean_misc): Also remove typecheck_*.dir. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8df3b621..edbc4d16 100644 --- a/Makefile +++ b/Makefile @@ -944,7 +944,7 @@ check_zishrink_posix check_zishrink_right: \ touch $@ clean_misc: - rm -fr check_*.dir + rm -fr check_*.dir typecheck_*.dir rm -f *.o *.out $(TIME_T_ALTERNATIVES) \ check_* core typecheck_* \ date tzselect version.h zdump zic libtz.a -- 2.40.1

Put TZDIR’s definition in a new file tzdir.h instead of using macros that do not always work with recursive ‘make’ invocations. This follows up on the recent changes to make the Makefile more POSIX-compatible. * .gitignore: Ignore tzdir.h. * Makefile (DTZDIR): Remove. All uses removed. (tzdir.h): New target rule. (clean_misc): Remove tzdir.h. (check_public): Pass TZDIR, not TZDIR. (localtime.o, zic.o): Depend on tzdir.h. * NEWS: Mention this. * localtime.c, zic.c: Include tzdir.h. * tzfile.h (TZDIR): Remove; now defined by tzdir.h. --- .gitignore | 1 + Makefile | 27 ++++++++++++++------------- NEWS | 2 ++ localtime.c | 1 + tzfile.h | 4 ---- zic.c | 1 + 6 files changed, 19 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index cf3b8250..d50d176d 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ ChangeLog check_* date leapseconds +tzdir.h tzselect version version.h diff --git a/Makefile b/Makefile index edbc4d16..6e8e8fd9 100644 --- a/Makefile +++ b/Makefile @@ -549,10 +549,6 @@ RANLIB= : ############################################################################### -# $(CC) option to specify TZDIR, appropriately quoted. -# It is separate from CFLAGS so that CFLAGS and TZDIR can be set independently. -DTZDIR = -DTZDIR='"$(TZDIR)"' - TZCOBJS= zic.o TZDOBJS= zdump.o localtime.o asctime.o strftime.o DATEOBJS= date.o localtime.o strftime.o asctime.o @@ -690,6 +686,13 @@ tzdata.zi: $(DATAFORM).zi version zishrink.awk $(DATAFORM).zi >$@.out mv $@.out $@ +tzdir.h: + printf '%s\n' >$@.out \ + '#ifndef TZDIR' \ + '# define TZDIR "$(TZDIR)" /* TZif directory */' \ + '#endif' + mv $@.out $@ + version.h: version VERSION=`cat version` && printf '%s\n' \ 'static char const PKGVERSION[]="($(PACKAGE)) ";' \ @@ -699,10 +702,10 @@ version.h: version mv $@.out $@ zdump: $(TZDOBJS) - $(CC) -o $@ $(DTZDIR) $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS) zic: $(TZCOBJS) - $(CC) -o $@ $(DTZDIR) $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS) leapseconds: $(LEAP_DEPS) $(AWK) -v EXPIRES_LINE=$(EXPIRES_LINE) \ @@ -800,7 +803,7 @@ libtz.a: $(LIBOBJS) $(RANLIB) $@ date: $(DATEOBJS) - $(CC) -o $@ $(DTZDIR) $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS) tzselect: tzselect.ksh version VERSION=`cat version` && sed \ @@ -947,7 +950,7 @@ clean_misc: rm -fr check_*.dir typecheck_*.dir rm -f *.o *.out $(TIME_T_ALTERNATIVES) \ check_* core typecheck_* \ - date tzselect version.h zdump zic libtz.a + date tzdir.h tzselect version.h zdump zic libtz.a clean: clean_misc rm -fr *.dir tzdb-*/ rm -f *.zi $(TZS_NEW) @@ -1052,7 +1055,7 @@ check_public: $(VERSION_DEPS) mkdir public.dir ln $(VERSION_DEPS) public.dir cd public.dir \ - && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' DTZDIR=$(DTZDIR) ALL + && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' TZDIR='$(TZDIR)' ALL for i in $(TDATA_TO_CHECK) public.dir/tzdata.zi \ public.dir/vanguard.zi public.dir/main.zi \ public.dir/rearguard.zi; \ @@ -1096,7 +1099,6 @@ $(TIME_T_ALTERNATIVES): $(VERSION_DEPS) (cd $@.dir && \ $(MAKE) TOPDIR="$$wd/$@.dir" \ CFLAGS='$(CFLAGS) -Dtime_tz='"'$@'" \ - DTZDIR=$(DTZDIR) \ REDO='$(REDO)' \ D=$$wd/$@.dir \ TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \ @@ -1260,7 +1262,6 @@ typecheck_long_long typecheck_unsigned: $(VERSION_DEPS) typecheck_cflags='' && \ $(MAKE) \ CFLAGS="$(TYPECHECK_CFLAGS) \"-Dtime_t=$$i\"" \ - DTZDIR=$(DTZDIR) \ TOPDIR="`pwd`" \ install $@.dir/zdump -i -c 1970,1971 Europe/Rome @@ -1272,10 +1273,10 @@ zonenames: tzdata.zi asctime.o: private.h tzfile.h date.o: private.h difftime.o: private.h -localtime.o: private.h tzfile.h +localtime.o: private.h tzfile.h tzdir.h strftime.o: private.h tzfile.h zdump.o: version.h -zic.o: private.h tzfile.h version.h +zic.o: private.h tzfile.h tzdir.h version.h .PHONY: ALL INSTALL all .PHONY: check check_mild check_time_t_alternatives diff --git a/NEWS b/NEWS index b7884c2d..0f033eca 100644 --- a/NEWS +++ b/NEWS @@ -46,6 +46,8 @@ Unreleased, experimental changes * It no longer uses its own 'cc' in place of CC. * It now uses ARFLAGS, with default specified by POSIX. * It does not use LFLAGS incompatibly with POSIX. + Due to the CC changes, TZDIR is now #defined in a file tzfile.h + built by 'make', not in a $(CC) -D option. Changes to commentary diff --git a/localtime.c b/localtime.c index f65a4295..319fd4ee 100644 --- a/localtime.c +++ b/localtime.c @@ -15,6 +15,7 @@ #define LOCALTIME_IMPLEMENTATION #include "private.h" +#include "tzdir.h" #include "tzfile.h" #include <fcntl.h> diff --git a/tzfile.h b/tzfile.h index 9cbdcff5..fcb7ab1d 100644 --- a/tzfile.h +++ b/tzfile.h @@ -21,10 +21,6 @@ ** Information about time zone files. */ -#ifndef TZDIR -# define TZDIR "/usr/share/zoneinfo" /* Time zone object file directory */ -#endif /* !defined TZDIR */ - #ifndef TZDEFAULT # define TZDEFAULT "/etc/localtime" #endif /* !defined TZDEFAULT */ diff --git a/zic.c b/zic.c index cb473bdc..e10cb21b 100644 --- a/zic.c +++ b/zic.c @@ -14,6 +14,7 @@ #include "version.h" #include "private.h" +#include "tzdir.h" #include "tzfile.h" #include <fcntl.h> -- 2.40.1

* Makefile (tzdir.h): Also #define TZDEFAULT. * NEWS: Mention this. * tzfile.h (TZDIR): Remove; now defined by tzdir.h. --- Makefile | 3 +++ NEWS | 3 ++- tzfile.h | 4 ---- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 6e8e8fd9..e68bdb0c 100644 --- a/Makefile +++ b/Makefile @@ -688,6 +688,9 @@ tzdata.zi: $(DATAFORM).zi version zishrink.awk tzdir.h: printf '%s\n' >$@.out \ + '#ifndef TZDEFAULT' \ + '# define TZDEFAULT "$(TZDEFAULT)" /* default zone */' \ + '#endif' \ '#ifndef TZDIR' \ '# define TZDIR "$(TZDIR)" /* TZif directory */' \ '#endif' diff --git a/NEWS b/NEWS index 0f033eca..5b228f47 100644 --- a/NEWS +++ b/NEWS @@ -47,7 +47,8 @@ Unreleased, experimental changes * It now uses ARFLAGS, with default specified by POSIX. * It does not use LFLAGS incompatibly with POSIX. Due to the CC changes, TZDIR is now #defined in a file tzfile.h - built by 'make', not in a $(CC) -D option. + built by 'make', not in a $(CC) -D option. Also, TZDEFAULT is + now treated like TZDIR as they have similar roles. Changes to commentary diff --git a/tzfile.h b/tzfile.h index fcb7ab1d..21ae37c1 100644 --- a/tzfile.h +++ b/tzfile.h @@ -21,10 +21,6 @@ ** Information about time zone files. */ -#ifndef TZDEFAULT -# define TZDEFAULT "/etc/localtime" -#endif /* !defined TZDEFAULT */ - #ifndef TZDEFRULES # define TZDEFRULES "posixrules" #endif /* !defined TZDEFRULES */ -- 2.40.1

* 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
participants (1)
-
Paul Eggert