Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 1 | From b520d20b8122a783f99f088758b78d928f70ee34 Mon Sep 17 00:00:00 2001 |
| 2 | From: Paul Eggert <eggert@cs.ucla.edu> |
| 3 | Date: Mon, 23 Oct 2017 11:42:45 -0700 |
| 4 | Subject: [PATCH] Fix Makefile quoting bug |
| 5 | |
| 6 | Problem with INSTALLARGS reported by Zefram in: |
| 7 | https://mm.icann.org/pipermail/tz/2017-October/025360.html |
| 8 | Fix similar problems too. |
| 9 | * Makefile (ZIC_INSTALL, VALIDATE_ENV, CC, install) |
| 10 | (INSTALL, version, INSTALLARGS, right_posix, posix_right) |
| 11 | (check_public): Use apostrophes to prevent undesirable |
| 12 | interpretation of names by the shell. We still do not support |
| 13 | directory names containing apostrophes or newlines, but this is |
| 14 | good enough. |
| 15 | |
| 16 | Upstream-Status: Backport |
| 17 | Signed-off-by: Armin Kuster <akuster@mvista.com> |
| 18 | |
| 19 | * NEWS: Mention this. |
| 20 | --- |
| 21 | Makefile | 64 ++++++++++++++++++++++++++++++++-------------------------------- |
| 22 | NEWS | 8 ++++++++ |
| 23 | 2 files changed, 40 insertions(+), 32 deletions(-) |
| 24 | |
| 25 | diff --git a/Makefile b/Makefile |
| 26 | index c92edc0..97649ca 100644 |
| 27 | --- a/Makefile |
| 28 | +++ b/Makefile |
| 29 | @@ -313,7 +313,7 @@ ZFLAGS= |
| 30 | |
| 31 | # How to use zic to install tz binary files. |
| 32 | |
| 33 | -ZIC_INSTALL= $(ZIC) -d $(DESTDIR)$(TZDIR) $(LEAPSECONDS) |
| 34 | +ZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS) |
| 35 | |
| 36 | # The name of a Posix-compliant 'awk' on your system. |
| 37 | AWK= awk |
| 38 | @@ -341,8 +341,8 @@ SGML_CATALOG_FILES= \ |
| 39 | VALIDATE = nsgmls |
| 40 | VALIDATE_FLAGS = -s -B -wall -wno-unused-param |
| 41 | VALIDATE_ENV = \ |
| 42 | - SGML_CATALOG_FILES=$(SGML_CATALOG_FILES) \ |
| 43 | - SGML_SEARCH_PATH=$(SGML_SEARCH_PATH) \ |
| 44 | + SGML_CATALOG_FILES='$(SGML_CATALOG_FILES)' \ |
| 45 | + SGML_SEARCH_PATH='$(SGML_SEARCH_PATH)' \ |
| 46 | SP_CHARSET_FIXED=YES \ |
| 47 | SP_ENCODING=UTF-8 |
| 48 | |
| 49 | @@ -396,7 +396,7 @@ GZIPFLAGS= -9n |
| 50 | #MAKE= make |
| 51 | |
| 52 | cc= cc |
| 53 | -CC= $(cc) -DTZDIR=\"$(TZDIR)\" |
| 54 | +CC= $(cc) -DTZDIR='"$(TZDIR)"' |
| 55 | |
| 56 | AR= ar |
| 57 | |
| 58 | @@ -473,29 +473,29 @@ all: tzselect yearistype zic zdump libtz.a $(TABDATA) |
| 59 | ALL: all date $(ENCHILADA) |
| 60 | |
| 61 | install: all $(DATA) $(REDO) $(MANS) |
| 62 | - mkdir -p $(DESTDIR)$(ETCDIR) $(DESTDIR)$(TZDIR) \ |
| 63 | - $(DESTDIR)$(LIBDIR) \ |
| 64 | - $(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \ |
| 65 | - $(DESTDIR)$(MANDIR)/man8 |
| 66 | + mkdir -p '$(DESTDIR)$(ETCDIR)' '$(DESTDIR)$(TZDIR)' \ |
| 67 | + '$(DESTDIR)$(LIBDIR)' \ |
| 68 | + '$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \ |
| 69 | + '$(DESTDIR)$(MANDIR)/man8' |
| 70 | $(ZIC_INSTALL) -l $(LOCALTIME) -p $(POSIXRULES) |
| 71 | - cp -f $(TABDATA) $(DESTDIR)$(TZDIR)/. |
| 72 | - cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/. |
| 73 | - cp libtz.a $(DESTDIR)$(LIBDIR)/. |
| 74 | - $(RANLIB) $(DESTDIR)$(LIBDIR)/libtz.a |
| 75 | - cp -f newctime.3 newtzset.3 $(DESTDIR)$(MANDIR)/man3/. |
| 76 | - cp -f tzfile.5 $(DESTDIR)$(MANDIR)/man5/. |
| 77 | - cp -f tzselect.8 zdump.8 zic.8 $(DESTDIR)$(MANDIR)/man8/. |
| 78 | + cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.' |
| 79 | + cp tzselect zic zdump '$(DESTDIR)$(ETCDIR)/.' |
| 80 | + cp libtz.a '$(DESTDIR)$(LIBDIR)/.' |
| 81 | + $(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a' |
| 82 | + cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.' |
| 83 | + cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.' |
| 84 | + cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.' |
| 85 | |
| 86 | INSTALL: ALL install date.1 |
| 87 | - mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1 |
| 88 | - cp date $(DESTDIR)$(BINDIR)/. |
| 89 | - cp -f date.1 $(DESTDIR)$(MANDIR)/man1/. |
| 90 | + mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1' |
| 91 | + cp date '$(DESTDIR)$(BINDIR)/.' |
| 92 | + cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.' |
| 93 | |
| 94 | version: $(VERSION_DEPS) |
| 95 | { (type git) >/dev/null 2>&1 && \ |
| 96 | V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \ |
| 97 | --abbrev=7 --dirty` || \ |
| 98 | - V=$(VERSION); } && \ |
| 99 | + V='$(VERSION)'; } && \ |
| 100 | printf '%s\n' "$$V" >$@.out |
| 101 | mv $@.out $@ |
| 102 | |
| 103 | @@ -529,12 +529,12 @@ leapseconds: $(LEAP_DEPS) |
| 104 | # Arguments to pass to submakes of install_data. |
| 105 | # They can be overridden by later submake arguments. |
| 106 | INSTALLARGS = \ |
| 107 | - BACKWARD=$(BACKWARD) \ |
| 108 | - DESTDIR=$(DESTDIR) \ |
| 109 | + BACKWARD='$(BACKWARD)' \ |
| 110 | + DESTDIR='$(DESTDIR)' \ |
| 111 | LEAPSECONDS='$(LEAPSECONDS)' \ |
| 112 | PACKRATDATA='$(PACKRATDATA)' \ |
| 113 | - TZDIR=$(TZDIR) \ |
| 114 | - YEARISTYPE=$(YEARISTYPE) \ |
| 115 | + TZDIR='$(TZDIR)' \ |
| 116 | + YEARISTYPE='$(YEARISTYPE)' \ |
| 117 | ZIC='$(ZIC)' |
| 118 | |
| 119 | # 'make install_data' installs one set of tz binary files. |
| 120 | @@ -558,16 +558,16 @@ right_only: |
| 121 | # You must replace all of $(TZDIR) to switch from not using leap seconds |
| 122 | # to using them, or vice versa. |
| 123 | right_posix: right_only |
| 124 | - rm -fr $(DESTDIR)$(TZDIR)-leaps |
| 125 | - ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \ |
| 126 | - $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-leaps right_only |
| 127 | - $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-posix posix_only |
| 128 | + rm -fr '$(DESTDIR)$(TZDIR)-leaps' |
| 129 | + ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \ |
| 130 | + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only |
| 131 | + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only |
| 132 | |
| 133 | posix_right: posix_only |
| 134 | - rm -fr $(DESTDIR)$(TZDIR)-posix |
| 135 | - ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \ |
| 136 | - $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-posix posix_only |
| 137 | - $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-leaps right_only |
| 138 | + rm -fr '$(DESTDIR)$(TZDIR)-posix' |
| 139 | + ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \ |
| 140 | + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only |
| 141 | + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only |
| 142 | |
| 143 | # This obsolescent rule is present for backwards compatibility with |
| 144 | # tz releases 2014g through 2015g. It should go away eventually. |
| 145 | @@ -764,7 +764,7 @@ set-timestamps.out: $(ENCHILADA) |
| 146 | |
| 147 | check_public: |
| 148 | $(MAKE) maintainer-clean |
| 149 | - $(MAKE) "CFLAGS=$(GCC_DEBUG_FLAGS)" ALL |
| 150 | + $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' ALL |
| 151 | mkdir -p public.dir |
| 152 | for i in $(TDATA) tzdata.zi; do \ |
| 153 | $(zic) -v -d public.dir $$i 2>&1 || exit; \ |
| 154 | diff --git a/NEWS b/NEWS |
| 155 | index bd2bec2..75ab095 100644 |
| 156 | --- a/NEWS |
| 157 | +++ b/NEWS |
| 158 | @@ -1,5 +1,13 @@ |
| 159 | News for the tz database |
| 160 | |
| 161 | +Unreleased, experimental changes |
| 162 | + |
| 163 | + Changes to build procedure |
| 164 | + |
| 165 | + The Makefile now quotes values like BACKWARD more carefully when |
| 166 | + passing them to the shell. (Problem reported by Zefram.) |
| 167 | + |
| 168 | + |
| 169 | Release 2017c - 2017-10-20 14:49:34 -0700 |
| 170 | |
| 171 | Briefly: |
| 172 | -- |
| 173 | 2.7.4 |
| 174 | |