Patchwork [1,of,4] build: make install in "/doc" failed if the destination dir contained spaces

login
register
mail settings
Submitter via Mercurial-devel
Date Oct. 11, 2017, 8:46 p.m.
Message ID <f5b679cb5f18ed7f29c4.1507754777@cuben>
Download mbox | patch
Permalink /patch/24757/
State Accepted
Headers show

Comments

via Mercurial-devel - Oct. 11, 2017, 8:46 p.m.
# HG changeset patch
# User muxator <a.mux@inwind.it>
# Date 1507677588 -7200
#      Wed Oct 11 01:19:48 2017 +0200
# Node ID f5b679cb5f18ed7f29c42d7a66a3b3a172a11286
# Parent  4a6a337f9c682bdf1659295f871dc43ff33677ca
build: make install in "/doc" failed if the destination dir contained spaces

This and the following commits try to add the necessary quoting in the build
scripts to make the process more robust.

The target for now is rendering "make deb" successful even when the base
directory contains spaces (eg. "/opt/mercu rial").
The build process should succeed without scattering files in spurious
directories (eg.: "/opt/mercu/usr/bin/hg").

Patch

diff --git a/doc/Makefile b/doc/Makefile
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -18,7 +18,7 @@ 
 html: $(HTML)
 
 common.txt $(SOURCES) $(SOURCES:%.txt=%.gendoc.txt): $(GENDOC)
-	${PYTHON} gendoc.py $(basename $@) > $@.tmp
+	${PYTHON} gendoc.py "$(basename $@)" > $@.tmp
 	mv $@.tmp $@
 
 %: %.txt %.gendoc.txt common.txt
@@ -39,8 +39,8 @@ 
 install: man
 	for i in $(MAN) ; do \
 	  subdir=`echo $$i | sed -n 's/^.*\.\([0-9]\)$$/man\1/p'` ; \
-	  mkdir -p $(DESTDIR)$(MANDIR)/$$subdir ; \
-	  $(INSTALL) $$i $(DESTDIR)$(MANDIR)/$$subdir ; \
+	  mkdir -p "$(DESTDIR)$(MANDIR)"/$$subdir ; \
+	  $(INSTALL) $$i "$(DESTDIR)$(MANDIR)"/$$subdir ; \
 	done
 
 clean: