80da60
From b520d20b8122a783f99f088758b78d928f70ee34 Mon Sep 17 00:00:00 2001
80da60
From: Paul Eggert <eggert@cs.ucla.edu>
80da60
Date: Mon, 23 Oct 2017 11:42:45 -0700
80da60
Subject: [PROPOSED] Fix Makefile quoting bug
80da60
80da60
Problem with INSTALLARGS reported by Zefram in:
80da60
https://mm.icann.org/pipermail/tz/2017-October/025360.html
80da60
Fix similar problems too.
80da60
* Makefile (ZIC_INSTALL, VALIDATE_ENV, CC, install)
80da60
(INSTALL, version, INSTALLARGS, right_posix, posix_right)
80da60
(check_public): Use apostrophes to prevent undesirable
80da60
interpretation of names by the shell.  We still do not support
80da60
directory names containing apostrophes or newlines, but this is
80da60
good enough.
80da60
* NEWS: Mention this.
80da60
---
80da60
 Makefile | 64 ++++++++++++++++++++++++++++++++--------------------------------
80da60
 NEWS     |  8 ++++++++
80da60
 2 files changed, 40 insertions(+), 32 deletions(-)
80da60
80da60
diff --git a/Makefile b/Makefile
80da60
index c92edc0..97649ca 100644
80da60
--- a/Makefile
80da60
+++ b/Makefile
80da60
@@ -313,7 +313,7 @@ ZFLAGS=
80da60
 
80da60
 # How to use zic to install tz binary files.
80da60
 
80da60
-ZIC_INSTALL=	$(ZIC) -d $(DESTDIR)$(TZDIR) $(LEAPSECONDS)
80da60
+ZIC_INSTALL=	$(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS)
80da60
 
80da60
 # The name of a Posix-compliant 'awk' on your system.
80da60
 AWK=		awk
80da60
@@ -341,8 +341,8 @@ SGML_CATALOG_FILES= \
80da60
 VALIDATE = nsgmls
80da60
 VALIDATE_FLAGS = -s -B -wall -wno-unused-param
80da60
 VALIDATE_ENV = \
80da60
-  SGML_CATALOG_FILES=$(SGML_CATALOG_FILES) \
80da60
-  SGML_SEARCH_PATH=$(SGML_SEARCH_PATH) \
80da60
+  SGML_CATALOG_FILES='$(SGML_CATALOG_FILES)' \
80da60
+  SGML_SEARCH_PATH='$(SGML_SEARCH_PATH)' \
80da60
   SP_CHARSET_FIXED=YES \
80da60
   SP_ENCODING=UTF-8
80da60
 
80da60
@@ -396,7 +396,7 @@ GZIPFLAGS=	-9n
80da60
 #MAKE=		make
80da60
 
80da60
 cc=		cc
80da60
-CC=		$(cc) -DTZDIR=\"$(TZDIR)\"
80da60
+CC=		$(cc) -DTZDIR='"$(TZDIR)"'
80da60
 
80da60
 AR=		ar
80da60
 
80da60
@@ -473,29 +473,29 @@ all:		tzselect yearistype zic zdump libtz.a $(TABDATA)
80da60
 ALL:		all date $(ENCHILADA)
80da60
 
80da60
 install:	all $(DATA) $(REDO) $(MANS)
80da60
-		mkdir -p $(DESTDIR)$(ETCDIR) $(DESTDIR)$(TZDIR) \
80da60
-			$(DESTDIR)$(LIBDIR) \
80da60
-			$(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \
80da60
-			$(DESTDIR)$(MANDIR)/man8
80da60
+		mkdir -p '$(DESTDIR)$(ETCDIR)' '$(DESTDIR)$(TZDIR)' \
80da60
+			'$(DESTDIR)$(LIBDIR)' \
80da60
+			'$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \
80da60
+			'$(DESTDIR)$(MANDIR)/man8'
80da60
 		$(ZIC_INSTALL) -l $(LOCALTIME) -p $(POSIXRULES)
80da60
-		cp -f $(TABDATA) $(DESTDIR)$(TZDIR)/.
80da60
-		cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/.
80da60
-		cp libtz.a $(DESTDIR)$(LIBDIR)/.
80da60
-		$(RANLIB) $(DESTDIR)$(LIBDIR)/libtz.a
80da60
-		cp -f newctime.3 newtzset.3 $(DESTDIR)$(MANDIR)/man3/.
80da60
-		cp -f tzfile.5 $(DESTDIR)$(MANDIR)/man5/.
80da60
-		cp -f tzselect.8 zdump.8 zic.8 $(DESTDIR)$(MANDIR)/man8/.
80da60
+		cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.'
80da60
+		cp tzselect zic zdump '$(DESTDIR)$(ETCDIR)/.'
80da60
+		cp libtz.a '$(DESTDIR)$(LIBDIR)/.'
80da60
+		$(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a'
80da60
+		cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.'
80da60
+		cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.'
80da60
+		cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.'
80da60
 
80da60
 INSTALL:	ALL install date.1
80da60
-		mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
80da60
-		cp date $(DESTDIR)$(BINDIR)/.
80da60
-		cp -f date.1 $(DESTDIR)$(MANDIR)/man1/.
80da60
+		mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1'
80da60
+		cp date '$(DESTDIR)$(BINDIR)/.'
80da60
+		cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.'
80da60
 
80da60
 version:	$(VERSION_DEPS)
80da60
 		{ (type git) >/dev/null 2>&1 && \
80da60
 		  V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \
80da60
 				--abbrev=7 --dirty` || \
80da60
-		  V=$(VERSION); } && \
80da60
+		  V='$(VERSION)'; } && \
80da60
 		printf '%s\n' "$$V" >$@.out
80da60
 		mv $@.out $@
80da60
 
80da60
@@ -529,12 +529,12 @@ leapseconds:	$(LEAP_DEPS)
80da60
 # Arguments to pass to submakes of install_data.
80da60
 # They can be overridden by later submake arguments.
80da60
 INSTALLARGS = \
80da60
- BACKWARD=$(BACKWARD) \
80da60
- DESTDIR=$(DESTDIR) \
80da60
+ BACKWARD='$(BACKWARD)' \
80da60
+ DESTDIR='$(DESTDIR)' \
80da60
  LEAPSECONDS='$(LEAPSECONDS)' \
80da60
  PACKRATDATA='$(PACKRATDATA)' \
80da60
- TZDIR=$(TZDIR) \
80da60
- YEARISTYPE=$(YEARISTYPE) \
80da60
+ TZDIR='$(TZDIR)' \
80da60
+ YEARISTYPE='$(YEARISTYPE)' \
80da60
  ZIC='$(ZIC)'
80da60
 
80da60
 # 'make install_data' installs one set of tz binary files.
80da60
@@ -558,16 +558,16 @@ right_only:
80da60
 # You must replace all of $(TZDIR) to switch from not using leap seconds
80da60
 # to using them, or vice versa.
80da60
 right_posix:	right_only
80da60
-		rm -fr $(DESTDIR)$(TZDIR)-leaps
80da60
-		ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \
80da60
-		  $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-leaps right_only
80da60
-		$(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-posix posix_only
80da60
+		rm -fr '$(DESTDIR)$(TZDIR)-leaps'
80da60
+		ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \
80da60
+		  $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
80da60
+		$(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
80da60
 
80da60
 posix_right:	posix_only
80da60
-		rm -fr $(DESTDIR)$(TZDIR)-posix
80da60
-		ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \
80da60
-		  $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-posix posix_only
80da60
-		$(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-leaps right_only
80da60
+		rm -fr '$(DESTDIR)$(TZDIR)-posix'
80da60
+		ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \
80da60
+		  $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only
80da60
+		$(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only
80da60
 
80da60
 # This obsolescent rule is present for backwards compatibility with
80da60
 # tz releases 2014g through 2015g.  It should go away eventually.
80da60
@@ -764,7 +764,7 @@ set-timestamps.out: $(ENCHILADA)
80da60
 
80da60
 check_public:
80da60
 		$(MAKE) maintainer-clean
80da60
-		$(MAKE) "CFLAGS=$(GCC_DEBUG_FLAGS)" ALL
80da60
+		$(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' ALL
80da60
 		mkdir -p public.dir
80da60
 		for i in $(TDATA) tzdata.zi; do \
80da60
 		  $(zic) -v -d public.dir $$i 2>&1 || exit; \
80da60
diff --git a/NEWS b/NEWS
80da60
index bd2bec2..75ab095 100644
80da60
--- a/NEWS
80da60
+++ b/NEWS
80da60
@@ -1,5 +1,13 @@
80da60
 News for the tz database
80da60
 
80da60
+Unreleased, experimental changes
80da60
+
80da60
+  Changes to build procedure
80da60
+
80da60
+    The Makefile now quotes values like BACKWARD more carefully when
80da60
+    passing them to the shell.  (Problem reported by Zefram.)
80da60
+
80da60
+
80da60
 Release 2017c - 2017-10-20 14:49:34 -0700
80da60
 
80da60
   Briefly:
80da60
-- 
80da60
2.13.6
80da60