[MLton-commit] r4515

Wesley Terpstra MLton@mlton.org
Wed, 10 May 2006 07:30:03 -0700


Systematically made the following changes to all shell script I found:

1. Quote path variables
	"mkdir $x/bar" won't work if $x includes shell specials ("; '&...)
	This happens in both shell scripts and Makefiles

2. Generally tried to remove `cmd` usage wherever possible
	This breaks any filenames in the output. eg: `ls` is particularly
	bad and will mess up file names with spaces in them. Consider:
	for i in `ls`; do echo $i; done
	for i in *; do echo $i; done
	The first will print "foo\nbar\n" for a file "foo bar".
	The second will correctly print "foo bar\n"

3. Changed handling of shell arguements which are passed through
	Shell scripts had often broken appart and/or removed escapes.
	This problem would also affect filenames, for example:
	mlton @MLton cache="/Users/wes terpstra/cache" -- ...
	would break the option appart into two distinct halves:
		"/Users/wes
		terpstra/cache"
	The problem comes from the args="xxx $args" idiom.
	To preserve these values, you can use bash arrays (man bash).

4. Potentially modified the behaviour of bin/regression
	A comment previously stated:
                #   Must use $f.[0-9].[cS], not $f.*.[cS], because the
                #   latter will include other files, e.g. for finalize,
                #   it will also include finalize.2.
	My testing shows this to be false. Furthermore, the work-around:
                files="$f.[0-9].[cS]"
                if [ 0 -ne `ls $f.[0-9][0-9].[cS] 2>/dev/null | wc -l` ]; then 
                        files="$files $f.[0-9][0-9].[cS]"
                fi
	will break on a filename with spaces or shell specials.
	The problem is again assigning a list to a string variable.
	A way to do this correctly would've been:
		files=($f.[0-9].[cS])
	which creates a bash array with these values.
	However, then concatenating a second bash array for the 'if' case
	is a lot of work when a simpler solution is to use $f.*.[cS]


----------------------------------------------------------------------

U   mlton/branches/on-20050822-x86_64-branch/Makefile
U   mlton/branches/on-20050822-x86_64-branch/basis-library/Makefile
U   mlton/branches/on-20050822-x86_64-branch/benchmark/Makefile
U   mlton/branches/on-20050822-x86_64-branch/benchmark/tests/Makefile
U   mlton/branches/on-20050822-x86_64-branch/bin/add-cross
U   mlton/branches/on-20050822-x86_64-branch/bin/build-cross-gcc
U   mlton/branches/on-20050822-x86_64-branch/bin/clean
U   mlton/branches/on-20050822-x86_64-branch/bin/grab-wiki
U   mlton/branches/on-20050822-x86_64-branch/bin/host-arch
U   mlton/branches/on-20050822-x86_64-branch/bin/host-os
U   mlton/branches/on-20050822-x86_64-branch/bin/make-pdf-guide
U   mlton/branches/on-20050822-x86_64-branch/bin/mlton-script
U   mlton/branches/on-20050822-x86_64-branch/bin/mmake
U   mlton/branches/on-20050822-x86_64-branch/bin/msed
U   mlton/branches/on-20050822-x86_64-branch/bin/patch-mingw
U   mlton/branches/on-20050822-x86_64-branch/bin/platform
U   mlton/branches/on-20050822-x86_64-branch/bin/regression
U   mlton/branches/on-20050822-x86_64-branch/bin/sync-ignore
U   mlton/branches/on-20050822-x86_64-branch/bin/upgrade-basis
U   mlton/branches/on-20050822-x86_64-branch/mllex/Makefile
U   mlton/branches/on-20050822-x86_64-branch/mlnlffigen/Makefile
U   mlton/branches/on-20050822-x86_64-branch/mlprof/Makefile
U   mlton/branches/on-20050822-x86_64-branch/mlton/Makefile
U   mlton/branches/on-20050822-x86_64-branch/mlyacc/Makefile
U   mlton/branches/on-20050822-x86_64-branch/regression/Makefile

----------------------------------------------------------------------

Modified: mlton/branches/on-20050822-x86_64-branch/Makefile
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/Makefile	2006-05-10 13:15:15 UTC (rev 4514)
+++ mlton/branches/on-20050822-x86_64-branch/Makefile	2006-05-10 14:29:59 UTC (rev 4515)
@@ -38,7 +38,7 @@
 # If we're compiling with another version of MLton, then we want to do
 # another round of compilation so that we get a MLton built without
 # stubs.
-ifeq (other, $(shell if [ ! -x $(BIN)/mlton ]; then echo other; fi))
+ifeq (other, $(shell if [ ! -x "$(BIN)/mlton" ]; then echo other; fi))
 	BOOTSTRAP_OTHER=true
 else
 	BOOTSTRAP_OTHER=false
@@ -59,19 +59,19 @@
 # because they may be better than those that were used for the first
 # round of compilation.  So, we clean out the front end.
 ifeq (true, $(BOOTSTRAP_OTHER))
-	rm -f $(COMP)/$(AOUT)$(EXE)
-	$(MAKE) -C $(COMP)/front-end clean
+	rm -f "$(COMP)/$(AOUT)$(EXE)"
+	$(MAKE) -C "$(COMP)/front-end" clean
 endif
 	$(MAKE) compiler world
 	@echo 'Build of MLton succeeded.'
 
 .PHONY: basis-no-check
 basis-no-check:
-	mkdir -p $(LIB)/sml
-	rm -rf $(LIB)/sml/basis
-	$(CP) $(SRC)/basis-library/. $(LIB)/sml/basis
-	find $(LIB)/sml/basis -type d -name .svn | xargs rm -rf
-	find $(LIB)/sml/basis -type f -name .ignore | xargs rm -rf
+	mkdir -p "$(LIB)/sml"
+	rm -rf "$(LIB)/sml/basis"
+	$(CP) "$(SRC)/basis-library/." "$(LIB)/sml/basis"
+	find "$(LIB)/sml/basis" -type d -name .svn | xargs rm -rf
+	find "$(LIB)/sml/basis" -type f -name .ignore | xargs rm -rf
 
 .PHONY: basis
 basis:
@@ -97,15 +97,15 @@
 
 .PHONY: compiler
 compiler:
-	$(MAKE) -C $(COMP)
-	$(CP) $(COMP)/$(AOUT)$(EXE) $(LIB)/
+	$(MAKE) -C "$(COMP)"
+	$(CP) "$(COMP)/$(AOUT)$(EXE)" "$(LIB)/"
 
 .PHONY: constants
 constants:
 	@echo 'Creating constants file.'
-	$(BIN)/mlton -build-constants true >tmp.c
-	$(BIN)/mlton -output tmp tmp.c
-	./tmp >$(LIB)/$(TARGET)/constants
+	"$(BIN)/mlton" -build-constants true >tmp.c
+	"$(BIN)/mlton" -output tmp tmp.c
+	./tmp >"$(LIB)/$(TARGET)/constants"
 	rm -f tmp tmp.c
 
 DEBSRC = mlton-$(VERSION).orig
@@ -146,12 +146,12 @@
 
 .PHONY: dirs
 dirs:
-	mkdir -p $(BIN) $(LIB)/$(TARGET) $(INC)
+	mkdir -p "$(BIN)" "$(LIB)/$(TARGET)" "$(INC)"
 
 .PHONY: docs
 docs: dirs
-	$(MAKE) -C $(LEX) docs
-	$(MAKE) -C $(YACC) docs
+	$(MAKE) -C "$(LEX)" docs
+	$(MAKE) -C "$(YACC)" docs
 	if htmldoc --version >/dev/null 2>&1; then \
 		bin/make-pdf-guide; \
 	fi
@@ -160,31 +160,31 @@
 .PHONY: freebsd
 freebsd:
 	$(MAKE) clean clean-svn version
-	rm -rf $(BSDSRC)
-	mkdir -p $(BSDSRC)
-	( cd $(SRC) && tar -cpf - . ) | ( cd $(BSDSRC) && tar -xpf - )
+	rm -rf "$(BSDSRC)"
+	mkdir -p "$(BSDSRC)"
+	( cd $(SRC) && tar -cpf - . ) | ( cd "$(BSDSRC)" && tar -xpf - )
 	cd /tmp && tar -cpf - mlton-$(VERSION) | \
 		 $(GZIP) >/usr/ports/distfiles/mlton-$(VERSION)-$(RELEASE).freebsd.src.tgz
         # do not change "make" to "$(MAKE)" in the following line
-	cd $(BSDSRC)/package/freebsd && MAINTAINER_MODE=yes make build-package  
+	cd "$(BSDSRC)/package/freebsd" && MAINTAINER_MODE=yes make build-package  
 
 LIBRARIES = ckit-lib cml mlnlffi-lib mlrisc-lib mlyacc-lib smlnj-lib
 
 .PHONY: libraries-no-check
 libraries-no-check:
-	mkdir -p $(LIB)/sml
-	cd $(LIB)/sml && rm -rf $(LIBRARIES)
-	$(MAKE) -C $(SRC)/lib/ckit-lib
-	$(MAKE) -C $(SRC)/lib/mlrisc-lib
-	$(MAKE) -C $(SRC)/lib/smlnj-lib
-	$(CP) $(SRC)/lib/cml/. $(LIB)/sml/cml
-	$(CP) $(SRC)/lib/ckit-lib/ckit/. $(LIB)/sml/ckit-lib
-	$(CP) $(SRC)/lib/mlnlffi/. $(LIB)/sml/mlnlffi-lib
-	$(CP) $(SRC)/lib/mlrisc-lib/MLRISC/. $(LIB)/sml/mlrisc-lib
-	$(CP) $(SRC)/lib/mlyacc/. $(LIB)/sml/mlyacc-lib
-	$(CP) $(SRC)/lib/smlnj-lib/smlnj-lib/. $(LIB)/sml/smlnj-lib
-	find $(LIB)/sml -type d -name .svn | xargs rm -rf
-	find $(LIB)/sml -type f -name .ignore | xargs rm -rf
+	mkdir -p "$(LIB)/sml"
+	cd "$(LIB)/sml" && rm -rf $(LIBRARIES)
+	$(MAKE) -C "$(SRC)/lib/ckit-lib"
+	$(MAKE) -C "$(SRC)/lib/mlrisc-lib"
+	$(MAKE) -C "$(SRC)/lib/smlnj-lib"
+	$(CP) "$(SRC)/lib/cml/." "$(LIB)/sml/cml"
+	$(CP) "$(SRC)/lib/ckit-lib/ckit/." "$(LIB)/sml/ckit-lib"
+	$(CP) "$(SRC)/lib/mlnlffi/." "$(LIB)/sml/mlnlffi-lib"
+	$(CP) "$(SRC)/lib/mlrisc-lib/MLRISC/." "$(LIB)/sml/mlrisc-lib"
+	$(CP) "$(SRC)/lib/mlyacc/." "$(LIB)/sml/mlyacc-lib"
+	$(CP) "$(SRC)/lib/smlnj-lib/smlnj-lib/." "$(LIB)/sml/smlnj-lib"
+	find "$(LIB)/sml" -type d -name .svn | xargs rm -rf
+	find "$(LIB)/sml" -type f -name .ignore | xargs rm -rf
 
 .PHONY: libraries
 libraries:
@@ -200,158 +200,158 @@
 .PHONY: nj-mlton
 nj-mlton:
 	$(MAKE) dirs runtime 
-	$(MAKE) -C $(COMP) nj-mlton
+	$(MAKE) -C "$(COMP)" nj-mlton
 	$(MAKE) script basis-no-check mlbpathmap targetmap constants libraries-no-check
 	@echo 'Build of MLton succeeded.'
 
 .PHONY: nj-mlton-dual
 nj-mlton-dual:
 	$(MAKE) dirs runtime
-	$(MAKE) -C $(COMP) nj-mlton-dual
+	$(MAKE) -C "$(COMP)" nj-mlton-dual
 	$(MAKE) script basis-no-check mlbpathmap targetmap constants libraries-no-check
 	@echo 'Build of MLton succeeded.'
 
 .PHONY: nj-mlton-quad
 nj-mlton-quad:
 	$(MAKE) dirs runtime
-	$(MAKE) -C $(COMP) nj-mlton-quad
+	$(MAKE) -C "$(COMP)" nj-mlton-quad
 	$(MAKE) script basis-no-check mlbpathmap targetmap constants libraries-no-check
 	@echo 'Build of MLton succeeded.'
 
 .PHONY: mlbpathmap
 mlbpathmap:
-	touch $(MLBPATHMAP)
+	touch "$(MLBPATHMAP)"
 	( echo 'MLTON_ROOT $$(LIB_MLTON_DIR)/sml';	\
 	  echo 'SML_LIB $$(LIB_MLTON_DIR)/sml'; ) 	\
-		>>$(MLBPATHMAP).tmp
-	mv $(MLBPATHMAP).tmp $(MLBPATHMAP)
+		>>"$(MLBPATHMAP).tmp"
+	mv "$(MLBPATHMAP).tmp" "$(MLBPATHMAP)"
 
 .PHONY: traced
 traced:
-	$(MAKE) -C $(COMP) AOUT=$(AOUT).trace COMPILE_ARGS="-const 'Exn.keepHistory true' -const 'MLton.debug true' -drop-pass 'deepFlatten'"
-	$(CP) $(COMP)/$(AOUT).trace $(LIB)/
-	$(LIB)/$(AOUT).trace @MLton -- $(LIB)/world.trace
-	sed 's/mlton-compile/mlton-compile.trace/' < $(MLTON) | sed 's/world.mlton/world.trace.mlton/' > $(MLTON).trace
-	chmod a+x $(MLTON).trace
+	$(MAKE) -C "$(COMP)" "AOUT=$(AOUT).trace" COMPILE_ARGS="-const 'Exn.keepHistory true' -const 'MLton.debug true' -drop-pass 'deepFlatten'"
+	$(CP) "$(COMP)/$(AOUT).trace" "$(LIB)/"
+	"$(LIB)/$(AOUT).trace" @MLton -- "$(LIB)/world.trace"
+	sed 's/mlton-compile/mlton-compile.trace/' < "$(MLTON)" | sed 's/world.mlton/world.trace.mlton/' > "$(MLTON).trace"
+	chmod a+x "$(MLTON).trace"
 
 .PHONY: debugged
 debugged:
-	$(MAKE) -C $(COMP) AOUT=$(AOUT).debug COMPILE_ARGS="-debug true -const 'Exn.keepHistory true' -const 'MLton.debug true' -drop-pass 'deepFlatten'"
-	$(CP) $(COMP)/$(AOUT).debug $(LIB)/
-	$(LIB)/$(AOUT).debug @MLton -- $(LIB)/world.debug
-	sed 's/mlton-compile/mlton-compile.debug/' < $(MLTON) | sed 's/world.mlton/world.debug.mlton/' > $(MLTON).debug
-	chmod a+x $(MLTON).debug
+	$(MAKE) -C "$(COMP)" "AOUT=$(AOUT).debug" COMPILE_ARGS="-debug true -const 'Exn.keepHistory true' -const 'MLton.debug true' -drop-pass 'deepFlatten'"
+	$(CP) "$(COMP)/$(AOUT).debug" "$(LIB)/"
+	"$(LIB)/$(AOUT).debug" @MLton -- "$(LIB)/world.debug"
+	sed 's/mlton-compile/mlton-compile.debug/' < "$(MLTON)" | sed 's/world.mlton/world.debug.mlton/' > "$(MLTON).debug"
+	chmod a+x "$(MLTON).debug"
 
 .PHONY: profiled
 profiled:
-	$(MAKE) -C $(COMP) AOUT=$(AOUT).alloc COMPILE_ARGS="-profile alloc"
-	$(CP) $(COMP)/$(AOUT).alloc $(LIB)/
-	$(MAKE) -C $(COMP) AOUT=$(AOUT).count COMPILE_ARGS="-profile count"
-	$(CP) $(COMP)/$(AOUT).count $(LIB)/
-	$(MAKE) -C $(COMP) AOUT=$(AOUT).time COMPILE_ARGS="-profile time"
-	$(CP) $(COMP)/$(AOUT).time $(LIB)/
-	$(LIB)/$(AOUT).alloc @MLton -- $(LIB)/world.alloc
-	$(LIB)/$(AOUT).count @MLton -- $(LIB)/world.count
-	$(LIB)/$(AOUT).time @MLton -- $(LIB)/world.time
-	sed 's/mlton-compile/mlton-compile.alloc/' < $(MLTON) | sed 's/world.mlton/world.alloc.mlton/' > $(MLTON).alloc
-	sed 's/mlton-compile/mlton-compile.count/' < $(MLTON) | sed 's/world.mlton/world.count.mlton/' > $(MLTON).count
-	sed 's/mlton-compile/mlton-compile.time/' < $(MLTON) | sed 's/world.mlton/world.time.mlton/' > $(MLTON).time
-	chmod a+x $(MLTON).alloc
-	chmod a+x $(MLTON).count
-	chmod a+x $(MLTON).time
+	$(MAKE) -C "$(COMP)" "AOUT=$(AOUT).alloc" COMPILE_ARGS="-profile alloc"
+	$(CP) "$(COMP)/$(AOUT).alloc" "$(LIB)/"
+	$(MAKE) -C "$(COMP)" "AOUT=$(AOUT).count" COMPILE_ARGS="-profile count"
+	$(CP) "$(COMP)/$(AOUT).count" "$(LIB)/"
+	$(MAKE) -C "$(COMP)" "AOUT=$(AOUT).time" COMPILE_ARGS="-profile time"
+	$(CP) "$(COMP)/$(AOUT).time" "$(LIB)/"
+	"$(LIB)/$(AOUT).alloc" @MLton -- "$(LIB)/world.alloc"
+	"$(LIB)/$(AOUT).count" @MLton -- "$(LIB)/world.count"
+	"$(LIB)/$(AOUT).time" @MLton -- "$(LIB)/world.time"
+	sed 's/mlton-compile/mlton-compile.alloc/' < "$(MLTON)" | sed 's/world.mlton/world.alloc.mlton/' > "$(MLTON).alloc"
+	sed 's/mlton-compile/mlton-compile.count/' < "$(MLTON)" | sed 's/world.mlton/world.count.mlton/' > "$(MLTON).count"
+	sed 's/mlton-compile/mlton-compile.time/' < "$(MLTON)" | sed 's/world.mlton/world.time.mlton/' > "$(MLTON).time"
+	chmod a+x "$(MLTON).alloc"
+	chmod a+x "$(MLTON).count"
+	chmod a+x "$(MLTON).time"
 
 TOPDIR = 'TOPDIR-unset'
 SOURCEDIR = $(TOPDIR)/SOURCES/mlton-$(VERSION)
 .PHONY: rpms
 rpms:
 	$(MAKE) clean clean-svn version
-	mkdir -p $(TOPDIR)
-	cd $(TOPDIR) && mkdir -p BUILD RPMS/i386 SOURCES SPECS SRPMS
-	rm -rf $(SOURCEDIR)
-	mkdir -p $(SOURCEDIR)
-	( cd $(SRC) && tar -cpf - . ) | ( cd $(SOURCEDIR) && tar -xpf - )
-	$(CP) $(SOURCEDIR)/$(SPEC) $(TOPDIR)/SPECS/mlton.spec
-	( cd $(TOPDIR)/SOURCES && tar -cpf - mlton-$(VERSION) )		\
-		| $(GZIP) >$(SOURCEDIR).tgz
-	rm -rf $(SOURCEDIR)
-	rpm -ba --quiet --clean $(TOPDIR)/SPECS/mlton.spec
+	mkdir -p "$(TOPDIR)"
+	cd "$(TOPDIR)" && mkdir -p BUILD RPMS/i386 SOURCES SPECS SRPMS
+	rm -rf "$(SOURCEDIR)"
+	mkdir -p "$(SOURCEDIR)"
+	( cd "$(SRC)" && tar -cpf - . ) | ( cd "$(SOURCEDIR)" && tar -xpf - )
+	$(CP) "$(SOURCEDIR)/$(SPEC)" "$(TOPDIR)/SPECS/mlton.spec"
+	( cd "$(TOPDIR)/SOURCES" && tar -cpf - mlton-$(VERSION) )		\
+		| $(GZIP) >"$(SOURCEDIR).tgz"
+	rm -rf "$(SOURCEDIR)"
+	rpm -ba --quiet --clean "$(TOPDIR)/SPECS/mlton.spec"
 
 .PHONY: runtime
 runtime:
 	@echo 'Compiling MLton runtime system for $(TARGET).'
 	$(MAKE) -C runtime
-	$(CP) include/*.h $(INC)/
-	$(CP) runtime/*.a $(LIB)/$(TARGET)/
+	$(CP) include/*.h "$(INC)/"
+	$(CP) runtime/*.a "$(LIB)/$(TARGET)/"
 	mv runtime/gen/c-types.sml \
 		basis-library/config/c/$(TARGET_ARCH)-$(TARGET_OS)/c-types.sml	
 	mv runtime/gen/basis-ffi.sml \
 		basis-library/primitive/basis-ffi.sml
-	mkdir -p $(INC)/gc
-	mkdir -p $(INC)/util
-	mkdir -p $(INC)/platform
-	$(CP) runtime/*.h $(INC)/
-	$(CP) runtime/gc/*.h $(INC)/gc
-	$(CP) runtime/util/*.h $(INC)/util
-	$(CP) runtime/platform/*.h $(INC)/platform
-	$(CP) bytecode/interpret.h $(INC)
+	mkdir -p "$(INC)/gc"
+	mkdir -p "$(INC)/util"
+	mkdir -p "$(INC)/platform"
+	$(CP) runtime/*.h "$(INC)/"
+	$(CP) runtime/gc/*.h "$(INC)/gc"
+	$(CP) runtime/util/*.h "$(INC)/util"
+	$(CP) runtime/platform/*.h "$(INC)/platform"
+	$(CP) bytecode/interpret.h "$(INC)"
 	$(MAKE) -C bytecode
-	bytecode/print-opcodes >$(LIB)/opcodes
-	ar r $(LIB)/$(TARGET)/libmlton.a bytecode/interpret.o 
-	ar r $(LIB)/$(TARGET)/libmlton-gdb.a bytecode/interpret-gdb.o 
-	for x in $(LIB)/$(TARGET)/*.a; do $(RANLIB) $$x; done
+	bytecode/print-opcodes >"$(LIB)/opcodes"
+	ar r "$(LIB)/$(TARGET)/libmlton.a" bytecode/interpret.o 
+	ar r "$(LIB)/$(TARGET)/libmlton-gdb.a" bytecode/interpret-gdb.o 
+	for x in "$(LIB)"/"$(TARGET)"/*.a; do $(RANLIB) "$$x"; done
 
 .PHONY: script
 script:
-	$(CP) bin/mlton-script $(MLTON)
-	chmod a+x $(MLTON)
-	$(CP) $(SRC)/bin/platform $(LIB)
+	$(CP) bin/mlton-script "$(MLTON)"
+	chmod a+x "$(MLTON)"
+	$(CP) "$(SRC)/bin/platform" "$(LIB)"
 
 .PHONY: targetmap
 targetmap:
-	touch $(TARGETMAP)
-	( sed '/$(TARGET)/d' <$(TARGETMAP); 			\
+	touch "$(TARGETMAP)"
+	( sed '/$(TARGET)/d' <"$(TARGETMAP)"; 			\
 		echo '$(TARGET) $(TARGET_ARCH) $(TARGET_OS)' ) 	\
-		>>$(TARGETMAP).tmp
-	mv $(TARGETMAP).tmp $(TARGETMAP)
+		>>"$(TARGETMAP).tmp"
+	mv "$(TARGETMAP).tmp" "$(TARGETMAP)"
 
 .PHONY: tools
 tools:
-	$(MAKE) -C $(LEX)
-	$(MAKE) -C $(NLFFIGEN)
-	$(MAKE) -C $(PROF)
-	$(MAKE) -C $(YACC)
-	$(CP) $(LEX)/$(LEX)$(EXE) 		\
-		$(NLFFIGEN)/$(NLFFIGEN)$(EXE)	\
-		$(PROF)/$(PROF)$(EXE)		\
-		$(YACC)/$(YACC)$(EXE)		\
-		$(BIN)/
+	$(MAKE) -C "$(LEX)"
+	$(MAKE) -C "$(NLFFIGEN)"
+	$(MAKE) -C "$(PROF)"
+	$(MAKE) -C "$(YACC)"
+	$(CP) "$(LEX)/$(LEX)$(EXE)" 		\
+		"$(NLFFIGEN)/$(NLFFIGEN)$(EXE)"	\
+		"$(PROF)/$(PROF)$(EXE)"		\
+		"$(YACC)/$(YACC)$(EXE)"		\
+		"$(BIN)/"
 
 .PHONY: version
 version:
 	@echo 'Instantiating version numbers.'
 	for f in							\
 		package/debian/changelog				\
-		$(SPEC)							\
+		"$(SPEC)"							\
 		package/freebsd/Makefile				\
 		mlton/control/control-flags.sml;			\
 	do								\
-		sed "s/\(.*\)MLTONVERSION\(.*\)/\1$(VERSION)\2/" <$$f >z && \
-		mv z $$f;						\
+		sed "s/\(.*\)MLTONVERSION\(.*\)/\1$(VERSION)\2/" <"$$f" >z && \
+		mv z "$$f";						\
 	done
-	sed <$(SPEC) >z "/^Release:/s;.*;Release: $(RELEASE);"
-	mv z $(SPEC)
+	sed <"$(SPEC)" >z "/^Release:/s;.*;Release: $(RELEASE);"
+	mv z "$(SPEC)"
 
 .PHONY: world-no-check
 world-no-check: 
 	@echo 'Making world.'
 	$(MAKE) basis-no-check
-	$(LIB)/$(AOUT)$(EXE) @MLton -- $(LIB)/world
+	"$(LIB)/$(AOUT)$(EXE)" @MLton -- "$(LIB)/world"
 
 .PHONY: world
 world: 
 	$(MAKE) world-no-check
 	@echo 'Type checking basis.'
-	$(MLTON) -disable-ann deadCode \
+	"$(MLTON)" -disable-ann deadCode \
 		-stop tc \
 		'$$(SML_LIB)/basis/libs/all.mlb' \
 		>/dev/null
@@ -405,65 +405,65 @@
 
 .PHONY: install-no-docs
 install-no-docs:
-	mkdir -p $(TLIB) $(TBIN) $(TMAN)
-	$(CP) $(LIB)/. $(TLIB)/
-	rm -f $(TLIB)/self/libmlton-gdb.a
+	mkdir -p "$(TLIB)" "$(TBIN)" "$(TMAN)"
+	$(CP) "$(LIB)/." "$(TLIB)/"
+	rm -f "$(TLIB)/self/libmlton-gdb.a"
 	sed "/^lib=/s;.*;lib='$(prefix)/$(ULIB)';" 			\
-		<$(SRC)/bin/mlton-script >$(TBIN)/mlton
-	chmod a+x $(TBIN)/mlton
-	cd $(BIN) && $(CP) $(LEX)$(EXE) $(NLFFIGEN)$(EXE)		\
-		 $(PROF)$(EXE) $(YACC)$(EXE) $(TBIN)/
-	( cd $(SRC)/man && tar cf - $(MAN_PAGES)) | \
-		( cd $(TMAN)/ && tar xf - )
+		<"$(SRC)/bin/mlton-script" >"$(TBIN)/mlton"
+	chmod a+x "$(TBIN)/mlton"
+	cd "$(BIN)" && $(CP) "$(LEX)$(EXE)" "$(NLFFIGEN)$(EXE)"		\
+		 "$(PROF)$(EXE)" "$(YACC)$(EXE)" "$(TBIN)/"
+	( cd "$(SRC)/man" && tar cf - $(MAN_PAGES)) | \
+		( cd "$(TMAN)/" && tar xf - )
 	if $(GZIP_MAN); then						\
-		cd $(TMAN) && $(GZIP) $(MAN_PAGES);			\
+		cd "$(TMAN)" && $(GZIP) $(MAN_PAGES);			\
 	fi
 	case "$(TARGET_OS)" in						\
 	cygwin|darwin|solaris)						\
 	;;								\
 	*)								\
-		for f in $(TLIB)/$(AOUT)$(EXE) $(TBIN)/$(LEX)$(EXE)	\
-			$(TBIN)/$(NLFFIGEN)$(EXE) $(TBIN)/$(PROF)$(EXE)	\
-			$(TBIN)/$(YACC)$(EXE); do			\
+		for f in "$(TLIB)/$(AOUT)$(EXE)" "$(TBIN)/$(LEX)$(EXE)"	\
+			"$(TBIN)/$(NLFFIGEN)$(EXE)" "$(TBIN)/$(PROF)$(EXE)"	\
+			"$(TBIN)/$(YACC)$(EXE)"; do			\
 			strip --remove-section=.comment			\
-				--remove-section=.note $$f; 		\
+				--remove-section=.note "$$f"; 		\
 		done							\
 	esac
 
 .PHONY: install-docs
 install-docs:
-	mkdir -p $(TDOC)
+	mkdir -p "$(TDOC)"
 	(								\
-		cd $(SRC)/doc &&					\
-		$(CP) changelog examples guide license README $(TDOC)/	\
+		cd "$(SRC)/doc" &&					\
+		$(CP) changelog examples guide license README "$(TDOC)/"	\
 	)
-	mv $(TDOC)/guide/mlton-guide.pdf $(TDOC)/
+	mv "$(TDOC)/guide/mlton-guide.pdf" "$(TDOC)/"
 	(								\
-		cd $(SRC)/util &&					\
-		$(CP) cmcat cm2mlb $(TDOC)/				\
+		cd "$(SRC)/util" &&					\
+		$(CP) cmcat cm2mlb "$(TDOC)/"				\
 	)
 	for f in callcc command-line hello-world same-fringe signals	\
 			size taut thread1 thread2 thread-switch timeout \
 		; do 							\
-		$(CP) $(SRC)/regression/$$f.sml $(TEXM)/; 		\
+		$(CP) "$(SRC)/regression/$$f.sml" "$(TEXM)/"; 		\
 	done
-	$(GZIP) -c $(LEX)/$(LEX).ps >$(TDOC)/$(LEX).ps.gz
-	$(GZIP) -c $(YACC)/$(YACC).ps >$(TDOC)/$(YACC).ps.gz
-	find $(TDOC)/ -name .svn -type d | xargs rm -rf
-	find $(TDOC)/ -name .ignore -type f | xargs rm -rf
-	find $(TEXM)/ -name .svn -type d | xargs rm -rf
-	find $(TEXM)/ -name .ignore -type f | xargs rm -rf
+	$(GZIP) -c "$(LEX)/$(LEX).ps" >"$(TDOC)/$(LEX).ps.gz"
+	$(GZIP) -c "$(YACC)/$(YACC).ps" >"$(TDOC)/$(YACC).ps.gz"
+	find "$(TDOC)/" -name .svn -type d | xargs rm -rf
+	find "$(TDOC)/" -name .ignore -type f | xargs rm -rf
+	find "$(TEXM)/" -name .svn -type d | xargs rm -rf
+	find "$(TEXM)/" -name .ignore -type f | xargs rm -rf
 
 TDOCBASE = $(DESTDIR)$(prefix)/share/doc-base
 
 .PHONY: post-install-debian
 post-install-debian:	
-	cd $(TDOC)/ && rm -rf license
-	$(CP) $(SRC)/debian/copyright $(SRC)/debian/README.Debian $(TDOC)/
-	$(CP) $(SRC)/debian/changelog $(TDOC)/changelog.Debian
+	cd "$(TDOC)/" && rm -rf license
+	$(CP) "$(SRC)/debian/copyright" "$(SRC)/debian/README.Debian" "$(TDOC)/"
+	$(CP) "$(SRC)/debian/changelog" "$(TDOC)/changelog.Debian"
 	mkdir -p $(TDOCBASE)
 	for f in mllex mlton mlyacc; do \
-		$(CP) $(SRC)/debian/$$f.doc-base $(TDOCBASE)/$$f; \
+		$(CP) "$(SRC)/debian/$$f.doc-base" "$(TDOCBASE)/$$f"; \
 	done
-	cd $(TDOC)/ && $(GZIP) changelog changelog.Debian
-	chown -R root.root $(TDOC) $(TLIB)
+	cd "$(TDOC)/" && $(GZIP) changelog changelog.Debian
+	chown -R root.root "$(TDOC)" "$(TLIB)"

Modified: mlton/branches/on-20050822-x86_64-branch/basis-library/Makefile
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/basis-library/Makefile	2006-05-10 13:15:15 UTC (rev 4514)
+++ mlton/branches/on-20050822-x86_64-branch/basis-library/Makefile	2006-05-10 14:29:59 UTC (rev 4515)
@@ -32,7 +32,7 @@
 
 .PHONY: type-check-def
 type-check-def:
-	$(MLTON) -disable-ann deadCode -stop tc -show-types true \
+	"$(MLTON)" -disable-ann deadCode -stop tc -show-types true \
 		libs/all.mlb; \
 
 .PHONY: type-check-all
@@ -50,7 +50,7 @@
 		break; \
 	fi; \
 	echo "Type checking: $$objptrrep $$header $$seqindex $$targetarch $$targetos $$defchar $$defint $$defreal $$defword"; \
-	$(MLTON) -disable-ann deadCode -stop tc -show-types true \
+	"$(MLTON)" -disable-ann deadCode -stop tc -show-types true \
 		-mlb-path-map "maps/$$objptrrep" \
 		-mlb-path-map "maps/$$header" \
 		-mlb-path-map "maps/$$seqindex" \

Modified: mlton/branches/on-20050822-x86_64-branch/benchmark/Makefile
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/benchmark/Makefile	2006-05-10 13:15:15 UTC (rev 4514)
+++ mlton/branches/on-20050822-x86_64-branch/benchmark/Makefile	2006-05-10 14:29:59 UTC (rev 4515)
@@ -20,11 +20,11 @@
 
 all: 	$(NAME)
 
-$(NAME): $(NAME).mlb $(shell PATH=$(BIN):$$PATH && $(MLTON) -stop f $(NAME).mlb)
+$(NAME): $(NAME).mlb $(shell PATH="$(BIN):$$PATH" && "$(MLTON)" -stop f $(NAME).mlb)
 	@echo 'Compiling $(NAME)'
-	$(MLTON) $(FLAGS) $(NAME).mlb
+	"$(MLTON)" $(FLAGS) $(NAME).mlb
 
-$(NAME).sml: $(NAME).cm $(shell $(MLTON) -stop f $(NAME).cm)
+$(NAME).sml: $(NAME).cm $(shell "$(MLTON)" -stop f $(NAME).cm)
 	mlton -stop sml $(NAME).cm
 
 .PHONY: clean
@@ -56,4 +56,4 @@
 
 .PHONY: qtest
 qtest: $(NAME)
-	export PATH=$(PATH):$$PATH && cd tests && ../benchmark $(QBFLAGS) $(QBENCH) && $(MAKE) clean
+	export PATH="$(PATH):$$PATH" && cd tests && ../benchmark $(QBFLAGS) $(QBENCH) && $(MAKE) clean

Modified: mlton/branches/on-20050822-x86_64-branch/benchmark/tests/Makefile
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/benchmark/tests/Makefile	2006-05-10 13:15:15 UTC (rev 4514)
+++ mlton/branches/on-20050822-x86_64-branch/benchmark/tests/Makefile	2006-05-10 14:29:59 UTC (rev 4515)
@@ -12,8 +12,8 @@
 clean:
 	../../bin/clean
 	rm -f *.c *.s
-	for f in `ls`; do 			\
-		if [ -x $$f -a ! -d $$f ]; then	\
-			rm -f $$f;		\
+	for f in *; do 			\
+		if [ -x "$$f" -a ! -d "$$f" ]; then	\
+			rm -f "$$f";		\
 		fi;				\
 	done

Modified: mlton/branches/on-20050822-x86_64-branch/bin/add-cross
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/bin/add-cross	2006-05-10 13:15:15 UTC (rev 4514)
+++ mlton/branches/on-20050822-x86_64-branch/bin/add-cross	2006-05-10 14:29:59 UTC (rev 4515)
@@ -54,10 +54,10 @@
         ;;
 esac
 
-name=`basename $0`
+name=`basename "$0"`
 original=`pwd`
-dir=`dirname $0`
-src=`cd $dir/.. && pwd`
+dir=`dirname "$0"`
+src=`cd "$dir/.." && pwd`
 
 PATH="$dir":$PATH
 
@@ -75,17 +75,17 @@
 
 tmp='/tmp/mlton-add-cross'
 
-( cd $src && mmake dirs )
+( cd "$src" && mmake dirs )
 
 ssh $machine "rm -rf $tmp && mkdir $tmp"
 
 echo 'Making runtime.' 
-( cd $src && tar cf - bin runtime ) | 
+( cd "$src" && tar cf - bin runtime ) | 
         ssh $machine "cd $tmp && tar xf - && cd runtime &&
                 ../bin/mmake COMPILE_FAST=yes TARGET_ARCH=$crossArch TARGET_OS=$crossOS clean all"
 ssh $machine "cd $tmp/runtime && tar cf - *.a" | 
-        ( cd $lib/$crossTarget && tar xf - )
-( cd $src &&
+        ( cd "$lib/$crossTarget" && tar xf - )
+( cd "$src" &&
         mmake TARGET=$crossTarget TARGET_ARCH=$crossArch TARGET_OS=$crossOS \
                 mlbpathmap targetmap )
 
@@ -109,8 +109,8 @@
 
 exe='print-constants'
 echo "Compiling and running print-constants on $machine."
-cd $original
-$src/build/bin/mlton -build-constants true | 
+cd "$original"
+"$src/build/bin/mlton" -build-constants true | 
         ssh $machine "cd $tmp/runtime &&
                         cat >$exe.c && 
                         gcc -I. -o $exe $exe.c libmlton.a libgdtoa.a -lgmp -lm $libs"

Modified: mlton/branches/on-20050822-x86_64-branch/bin/build-cross-gcc
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/bin/build-cross-gcc	2006-05-10 13:15:15 UTC (rev 4514)
+++ mlton/branches/on-20050822-x86_64-branch/bin/build-cross-gcc	2006-05-10 14:29:59 UTC (rev 4515)
@@ -28,7 +28,7 @@
 }
 
 root=`pwd`
-name=`basename $0`
+name=`basename "$0"`
 
 usage () {
         die "usage: $name {cygwin|mingw|sun}"
@@ -101,7 +101,7 @@
                 die "Must create $prefix/$target/{include,lib}."
         fi
         # The GCC tools expect limits.h to be in sys-include, not include.
-        ( cd $prefix/$target && 
+        ( cd "$prefix/$target" && 
                 mkdir -p sys-include &&
                 mv include/limits.h sys-include )
 ;;
@@ -121,57 +121,57 @@
         exists $cygwin.tar
         exists $w32api.tar
         echo 'Copying include files and libraries needed by cross compiler.'
-        cd $root
+        cd "$root"
         mkdir -p cygwin
         cd cygwin
         tar x <../$cygwin.tar
         tar x <../$w32api.tar
-        mkdir -p $prefix/$target || 
+        mkdir -p "$prefix/$target" || 
                 die "Cannot create $prefix/$target."
-        (cd usr && tar c include lib) | (cd $prefix/$target/ && tar x)
+        (cd usr && tar c include lib) | (cd "$prefix/$target/" && tar x)
 ;;
 mingw)
         exists $mingw.tar
         exists $w32api.tar
         echo 'Copying include files and libraries needed by cross compiler.'
-        cd $root
+        cd "$root"
         mkdir -p mingw
         cd mingw
         tar x <../$mingw.tar
         tar x <../$w32api.tar
-        mkdir -p $prefix/$target || 
+        mkdir -p "$prefix/$target" || 
                 die "Cannot create $prefix/$target."
-        (tar c include lib) | (cd $prefix/$target/ && tar x)
+        (tar c include lib) | (cd "$prefix/$target/" && tar x)
 ;;
 *)
 ;;
 esac
 
 echo 'Building binutils.'
-cd $root
-if [ ! -d $binutils ]; then
+cd "$root"
+if [ ! -d "$binutils" ]; then
         tar x <$binutils.tar
 fi
 mkdir -p build-binutils
 cd build-binutils
-../$binutils/configure --prefix=$prefix --target=$target \
-        >$root/configure-binutils-log 2>&1 ||
+"../$binutils/configure" "--prefix=$prefix" "--target=$target" \
+        >"$root/configure-binutils-log" 2>&1 ||
         die "Configure of binutils failed."
-make all install >$root/build-binutils-log 2>&1 ||
+make all install >"$root/build-binutils-log" 2>&1 ||
         die "Build of binutils failed."
 
 echo 'Building gcc.'
-cd $root
-tar x <$gccTar
+cd "$root"
+tar x <"$gccTar"
 mkdir -p build-gcc
 cd build-gcc
-eval ../gcc-$gccVers/configure -v $configureGCCFlags \
+eval "../gcc-$gccVers/configure" -v $configureGCCFlags \
         --enable-languages=c \
-        --prefix=$prefix \
-        --target=$target \
-        >$root/configure-gcc-log 2>&1 || 
+        "--prefix=$prefix" \
+        "--target=$target" \
+        >"$root/configure-gcc-log" 2>&1 || 
         die "Configure of gcc failed."
-eval make $makeGCCFlags all install >$root/build-gcc-log 2>&1 || 
+eval make $makeGCCFlags all install >"$root/build-gcc-log" 2>&1 || 
         die "Build of gcc failed."
 
 echo 'Success.'

Modified: mlton/branches/on-20050822-x86_64-branch/bin/clean
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/bin/clean	2006-05-10 13:15:15 UTC (rev 4514)
+++ mlton/branches/on-20050822-x86_64-branch/bin/clean	2006-05-10 14:29:59 UTC (rev 4515)
@@ -2,11 +2,11 @@
 
 set -e
 
-dir=`dirname $0`
-root=`cd $dir/.. && pwd`
+dir=`dirname "$0"`
+root=`cd "$dir/.." && pwd`
 bin="$root/bin"
 
-case `$bin/host-os` in
+case `"$bin/host-os"` in
 cygwin|freebsd|linux)
         grepFlags='-q'
 ;;
@@ -18,14 +18,15 @@
 ignore='.ignore'
 doit () {
         rm -rf '.#'* .*~ *~ *.a *.o .cm core mlmon.out svn-commit.*
-        if [ -r $ignore ]; then
-                for f in `cat $ignore`; do rm -rf $f; done
+        if [ -r "$ignore" ]; then
+		# xargs allows us to have quoted strings for filenames
+		xargs rm -rf < "$ignore"
         fi
-        for f in `ls`; do
-                if [ -d $f ]; then
-                        cd $f
+        for f in *; do
+                if [ -d "$f" ]; then
+                        cd "$f"
                         if [ -r Makefile ]; then
-				$bin/mmake clean || doit
+				"$bin/mmake" clean || doit
                         else
                                 doit
                         fi

Modified: mlton/branches/on-20050822-x86_64-branch/bin/grab-wiki
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/bin/grab-wiki	2006-05-10 13:15:15 UTC (rev 4514)
+++ mlton/branches/on-20050822-x86_64-branch/bin/grab-wiki	2006-05-10 14:29:59 UTC (rev 4515)
@@ -2,9 +2,9 @@
 
 set -e
 
-name=`basename $0`
-dir=`dirname $0`
-src=`cd $dir/.. && pwd`
+name=`basename "$0"`
+dir=`dirname "$0"`
+src=`cd "$dir/.." && pwd`
 
 die () {
         echo >&2 "$1"
@@ -39,36 +39,36 @@
 drop='\(Download\|.*MoinEditorBackup\|OldPages\|Preferences\|RecentChanges\|TemporaryBugExamples\|TemporaryUpload\|WikiSandBox\)'
 
 if $useLocal; then 
-	(cd $HOME/mlton/guide-in && tar.write .) | tar.read;
+	(cd "$HOME/mlton/guide-in" && tar.write .) | tar.read;
 else
 echo "Getting index:" 
 lynx -dump "$base/Index?action=titleindex" | \
-    grep -v >$index -e '^$' -e "^$drop$"
+    grep -v >"$index" -e '^$' -e "^$drop$"
 
 echo "Getting pages:" 
-wget -B $base -c -nv -i $index
+wget -B "$base" -c -nv -i "$index"
  
 echo "Getting CSS:"
 for f in common screen print; do
-	wget -c $base/wiki/mlton/css/$f.css
+	wget -c "$base/wiki/mlton/css/$f.css"
 done
 
 echo "Getting images:"
 for f in bottom email ftp news top www; do
-	wget -c $base/wiki/mlton/img/moin-$f.png
+	wget -c "$base/wiki/mlton/img/moin-$f.png"
 done
 fi
 
 echo "Fixing pages:" 
 
 # Eliminate ungrabbed pages from Index.
-grep -v "$drop" Index >$tmp
-mv $tmp Index
+grep -v "$drop" Index >"$tmp"
+mv "$tmp" Index
 
 wwwImg='<img src="moin-www.png" alt="[WWW]" height="11" width="11">'
 
 # Write sed script to file.
-cat >$script <<EOF
+cat >"$script" <<EOF
 # Delete search box.
 /<form .* action = "http:\/\/www.google.com\/custom">/,+6d
 # Replace highlight actions with no-op.
@@ -93,15 +93,15 @@
 s;\(<a href *= *"http://mlton.org[^>]*>\);\1$wwwImg;g
 EOF
 
-for f in $(cat $index); do
-	echo $f
-	head -n -19 <$f >$tmp
+for f in $(cat "$index"); do
+	echo "$f"
+	head -n -19 <"$f" >"$tmp"
 	(
-		sed -f $script <$tmp
+		sed -f "$script" <"$tmp"
 		echo '</body></html>'
-	) >$f
+	) >"$f"
 done
 
-rm -f $tmp $index $script 
+rm -f "$tmp" "$index" "$script"
 
 cp Home index.html

Modified: mlton/branches/on-20050822-x86_64-branch/bin/host-arch
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/bin/host-arch	2006-05-10 13:15:15 UTC (rev 4514)
+++ mlton/branches/on-20050822-x86_64-branch/bin/host-arch	2006-05-10 14:29:59 UTC (rev 4515)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 
 set -e
-name=`basename $0`
-dir=`dirname $0`
-bin=`cd $dir && pwd`
+name=`basename "$0"`
+dir=`dirname "$0"`
+bin=`cd "$dir" && pwd`
 
 die () {
         echo >&2 "$1"
@@ -22,6 +22,6 @@
 ;;
 esac
 
-eval `$bin/platform`
+eval `"$bin/platform"`
 
 echo $HOST_ARCH

Modified: mlton/branches/on-20050822-x86_64-branch/bin/host-os
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/bin/host-os	2006-05-10 13:15:15 UTC (rev 4514)
+++ mlton/branches/on-20050822-x86_64-branch/bin/host-os	2006-05-10 14:29:59 UTC (rev 4515)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 
 set -e
-name=`basename $0`
-dir=`dirname $0`
-bin=`cd $dir && pwd`
+name=`basename "$0"`
+dir=`dirname "$0"`
+bin=`cd "$dir" && pwd`
 
 die () {
         echo >&2 "$1"
@@ -22,6 +22,6 @@
 ;;
 esac
 
-eval `$bin/platform`
+eval `"$bin/platform"`
 
 echo $HOST_OS

Modified: mlton/branches/on-20050822-x86_64-branch/bin/make-pdf-guide
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/bin/make-pdf-guide	2006-05-10 13:15:15 UTC (rev 4514)
+++ mlton/branches/on-20050822-x86_64-branch/bin/make-pdf-guide	2006-05-10 14:29:59 UTC (rev 4515)
@@ -2,9 +2,9 @@
 
 set -e
 
-name=`basename $0`
-dir=`dirname $0`
-src=`cd $dir/.. && pwd`
+name=`basename "$0"`
+dir=`dirname "$0"`
+src=`cd "$dir/.." && pwd`
 bin="$src/bin"
 
 die () {
@@ -32,19 +32,20 @@
 tmp='/tmp/mlton-guide'
 version=`date +%Y%m%d`
 
-rm -rf $tmp
-mkdir $tmp
-cd $tmp
+rm -rf "$tmp"
+mkdir "$tmp"
+cd "$tmp"
 
-( cd $src/doc/guide && tar -cf - . ) | tar -xf -
+( cd "$src/doc/guide" && tar -cf - . ) | tar -xf -
 
 # The grep -v takes out files that aren't wiki pages.
-ls -1 | grep -v '\.' >$pages
+# Hope that no files contain spaces or other specials -> `cat "$pages"` dies
+ls -1 | grep -v '\.' >"$pages"
 
 echo 'Massaging HTML.'
 
-for f in `cat $pages`; do
-cat >$script <<EOF
+for f in `cat "$pages"`; do
+cat >"$script" <<EOF
 /^<table bgcolor = lightblue/,+29d
 s;\(<body .*\);\1\n<h1>$f</h1>;
 s;<FONT[^>]*>;;g
@@ -53,12 +54,12 @@
 s;<td colspan = 3;<td align = right;
 s;<img src=\"\(http://mlton.org[^>]*\)>;<img src="moin-www.png"><a href=\"\1>image</a>;g
 EOF
-	$bin/msed -f $script <$f >.tmp
-	mv .tmp $f
+	"$bin/msed" -f "$script" <"$f" >.tmp
+	mv .tmp "$f"
 done
 
 echo 'Generating PDF titlepage.'
-cat >$titlepage <<EOF
+cat >"$titlepage" <<EOF
 <html>
 <head><title>MLton Guide ($version)</title></head>
 <body>
@@ -124,14 +125,14 @@
 Index
 EOF
 
-grep -v '^\(Home\|Index\)$' $pages 
-) >$book
+grep -v '^\(Home\|Index\)$' "$pages" 
+) >"$book"
 
 echo 'Running htmldoc.'
-htmldoc --batch $book || true
+htmldoc --batch "$book" || true
 
-mv $pdf $src/doc/guide
+mv "$pdf" "$src/doc/guide"
 
 cd
 
-rm -rf $tmp
+rm -rf "$tmp"

Modified: mlton/branches/on-20050822-x86_64-branch/bin/mlton-script
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/bin/mlton-script	2006-05-10 13:15:15 UTC (rev 4514)
+++ mlton/branches/on-20050822-x86_64-branch/bin/mlton-script	2006-05-10 14:29:59 UTC (rev 4515)
@@ -4,9 +4,9 @@
 
 set -e
 
-dir=`dirname $0`
-lib=`cd $dir/../lib && pwd`
-eval `$lib/platform`
+dir=`dirname "$0"`
+lib=`cd "$dir/../lib" && pwd`
+eval `"$lib/platform"`
 gcc='gcc'
 case "$HOST_OS" in
 mingw)
@@ -28,12 +28,12 @@
         njHeap="$lib/mlton.$HOST_ARCH-$HOST_OS"
 fi
 
-rargs=""
+declare -a rargs
 case "$1" in
 @MLton)
         shift
         while [ "$#" -gt 0 -a "$1" != "--" ]; do
-                rargs="$rargs $1"
+                rargs[${#rargs[@]}]="$1"
                 shift
         done
         if [ "$#" -gt 0 -a "$1" == "--" ]; then
@@ -49,7 +49,7 @@
 # $njHeap (which exists), then use MLton, otherwise use SML/NJ.
 doit () {
         if [ -x "$mlton" -a -s "$world" -a ! "$njHeap" -nt "$world" ]; then
-                exec "$mlton" @MLton load-world "$world" ram-slop 0.5 $rargs -- "$@"
+                exec "$mlton" @MLton load-world "$world" ram-slop 0.5 "${rargs[@]}" -- "$@"
         elif [ -s "$njHeap" ]; then
                 exec "$nj" @SMLload="$njHeap" "$@"
         fi

Modified: mlton/branches/on-20050822-x86_64-branch/bin/mmake
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/bin/mmake	2006-05-10 13:15:15 UTC (rev 4514)
+++ mlton/branches/on-20050822-x86_64-branch/bin/mmake	2006-05-10 14:29:59 UTC (rev 4515)
@@ -3,7 +3,7 @@
 set -e
 
 die () {
-        echo $1 >&2
+        echo "$1" >&2
         exit 1
 }
 
@@ -15,4 +15,4 @@
         die 'Can'\''t find GNU make'
 fi
 
-exec $make "$@"
+exec "$make" "$@"

Modified: mlton/branches/on-20050822-x86_64-branch/bin/msed
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/bin/msed	2006-05-10 13:15:15 UTC (rev 4514)
+++ mlton/branches/on-20050822-x86_64-branch/bin/msed	2006-05-10 14:29:59 UTC (rev 4515)
@@ -3,7 +3,7 @@
 set -e
 
 die () {
-        echo $1 >&2
+        echo "$1" >&2
         exit 1
 }
 
@@ -15,4 +15,4 @@
         die 'Can'\''t find GNU sed'
 fi
 
-exec $sed "$@"
+exec "$sed" "$@"

Modified: mlton/branches/on-20050822-x86_64-branch/bin/patch-mingw
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/bin/patch-mingw	2006-05-10 13:15:15 UTC (rev 4514)
+++ mlton/branches/on-20050822-x86_64-branch/bin/patch-mingw	2006-05-10 14:29:59 UTC (rev 4515)
@@ -2,12 +2,12 @@
 
 set -e
 
-dir=`dirname $0`
+dir=`dirname "$0"`
 
 for f in `find "$dir" -type f | grep -v '\.svn' | grep -v '~'`; do
 	if head -n 1 "$f" | grep -q '#!/usr/bin/env bash'; then
 		echo "Processing $f"
-		sed 's;#!/usr/bin/env bash;#!/usr/bin/env sh;' <$f >.tmp;
-		mv .tmp $f;
+		sed 's;#!/usr/bin/env bash;#!/usr/bin/env sh;' <"$f" >.tmp;
+		mv .tmp "$f";
 	fi
 done

Modified: mlton/branches/on-20050822-x86_64-branch/bin/platform
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/bin/platform	2006-05-10 13:15:15 UTC (rev 4514)
+++ mlton/branches/on-20050822-x86_64-branch/bin/platform	2006-05-10 14:29:59 UTC (rev 4515)
@@ -2,9 +2,9 @@
 
 set -e
 
-name=`basename $0`
-dir=`dirname $0`
-bin=`cd $dir && pwd`
+name=`basename "$0"`
+dir=`dirname "$0"`
+bin=`cd "$dir" && pwd`
 
 die () {
         echo >&2 "$1"

Modified: mlton/branches/on-20050822-x86_64-branch/bin/regression
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/bin/regression	2006-05-10 13:15:15 UTC (rev 4514)
+++ mlton/branches/on-20050822-x86_64-branch/bin/regression	2006-05-10 14:29:59 UTC (rev 4515)
@@ -5,7 +5,7 @@
 
 # set -e
 
-name=`basename $0`
+name=`basename "$0"`
 
 usage () {
         echo >&2 "usage: $name [-cross target] [-run-only target] [-short] [-skip-to reg] [mlton flags ...]"
@@ -17,6 +17,7 @@
 runOnly='false'
 short='false'
 skipTo=''
+declare -a flags
 while [ "$#" -gt 0 ]; do
         case "$1" in
         -cross)
@@ -54,20 +55,24 @@
                 shift
                 ;;
         *)
-                flags="$@"
-                break
+                flags[${#flags[@]}]="$1"
+		shift
                 ;;
         esac
 done
 
-dir=`dirname $0`
-src=`cd $dir/.. && pwd`
+dir=`dirname "$0"`
+src=`cd "$dir/.." && pwd`
 bin="$src/build/bin"
 lib="$src/build/lib"
 mlton="$bin/mlton"
-flags="-type-check true $flags"
+flags[${#flags[@]}]="-type-check"
+flags[${#flags[@]}]="true"
 if $cross; then
-        flags="$flags -target $crossTarget -stop g"
+	flags[${#flags[@]}]="-target"
+	flags[${#flags[@]}]="$crossTarget"
+	flags[${#flags[@]}]="-stop"
+	flags[${#flags[@]}]="-g"
 fi
 cont='callcc.sml callcc2.sml callcc3.sml once.sml'
 flatArray='finalize.sml flat-array.sml flat-array.2.sml'
@@ -76,23 +81,23 @@
 thread='thread0.sml thread1.sml thread2.sml mutex.sml prodcons.sml same-fringe.sml timeout.sml'
 world='world1.sml world2.sml world3.sml world4.sml world5.sml world6.sml'
 tmp=/tmp/z.regression.$$
-PATH=$bin:$src/bin/.:$PATH
+PATH="$bin:$src/bin/.:$PATH"
 
-eval `$lib/platform`
+eval `"$lib/platform"`
 
 compFail () {
-        echo "compilation of $f failed with $flags"
+        echo "compilation of $f failed with ${flags[*]}"
 }
 
-$mlton -verbose 1 || echo 'no mlton present'
-echo "flags = $flags"
+"$mlton" -verbose 1 || echo 'no mlton present'
+echo "flags = ${flags[*]}"
 
-cd $src/regression
+cd "$src/regression"
 
 if $fail; then
-        for f in `ls fail/*.sml`; do
+        for f in fail/*.sml; do
                 echo "testing $f"
-                ( $mlton $flags -stop tc $f >/dev/null 2>&1 &&
+                ( "$mlton" "${flags[@]}" -stop tc "$f" >/dev/null 2>&1 &&
                         echo "compilation of $f should have failed but did not" ) ||
                         true
         done
@@ -109,8 +114,8 @@
 ;;
 esac
 
-for f in `ls *.sml`; do
-        f=`basename $f .sml`
+for f in *.sml; do
+        f=`basename "$f" .sml`
         if [ "$skipTo" != "" ]; then
                 if [ "$skipTo" != "$f" ]; then
                         echo "skipping $f"
@@ -161,15 +166,14 @@
                                 \"nonexhaustiveMatch ignore\"
                                 \"redundantMatch ignore\"
                         in $f.sml 
-                        end" >$mlb
-                cmd="$mlton $flags $extraFlags -output $f $mlb"
-                eval $cmd
-                rm $mlb
+                        end" >"$mlb"
+                "$mlton" "${flags[@]}" $extraFlags -output "$f" "$mlb"
                 if [ "$?" -ne '0' ] || ((! $cross) && [ ! -x "$f" ]); then
-                        compFail $f
+                        compFail "$f"
                 fi
+                rm "$mlb"
 	else
-                case $crossTarget in
+                case "$crossTarget" in
                 *mingw)
                         libs='-lws2_32 -lkernel32 -lpsapi -lnetapi32'
                 ;;
@@ -181,27 +185,26 @@
                 ;;
                 esac
                 libs="-lmlton -lgmp $libs -lgdtoa -lm"
-                # Must use $f.[0-9].[cS], not $f.*.[cS], because the
-                # latter will include other files, e.g. for finalize,
-                # it will also include finalize.2.
-                files="$f.[0-9].[cS]"
-                if [ 0 -ne `ls $f.[0-9][0-9].[cS] 2>/dev/null | wc -l` ]; then 
-                        files="$files $f.[0-9][0-9].[cS]"
-                fi
-                gcc -o $f -w -O1                                \
+		# OLD COMMENT:
+                #   Must use $f.[0-9].[cS], not $f.*.[cS], because the
+                #   latter will include other files, e.g. for finalize,
+                #   it will also include finalize.2.
+		# I think this is untrue, and have dropped it as the work-
+		# around used was unsafe for special characters.
+                gcc -o "$f" -w -O1                              \
                         -I "../build/lib/include"               \
                         -L"../build/lib/$crossTarget"           \
                         -L/usr/pkg/lib                          \
                         -L/usr/local/lib                        \
-                        $files $libs
+                        "$f".*.[cS] $libs
 	fi
-        if [ ! -r $f.nonterm -a $cross = 'false' -a -x $f ]; then
+        if [ ! -r "$f".nonterm -a $cross = 'false' -a -x "$f" ]; then
                 nonZeroMsg='Nonzero exit status.'
 		if $forMinGW; then
                        nonZeroMsg="$nonZeroMsg"'\r'
 		fi
-                ( ./$f || echo -e "$nonZeroMsg" ) >$tmp 2>&1 
-                if [ -r $f.ok ]; then
+                ( "./$f" || echo -e "$nonZeroMsg" ) >$tmp 2>&1 
+                if [ -r "$f.ok" ]; then
                         compare="$f.$HOST_ARCH-$HOST_OS.ok"
                         if [ ! -r $compare ]; then
                                 compare="$f.ok"
@@ -210,8 +213,8 @@
                                 compare="$f.sed.ok"
                                 /c/cygwin/bin/sed 's/$/\r/' <"$f.ok" >"$compare"
 			fi
-                        if ! diff $compare $tmp; then
-                                echo "difference with $flags"
+                        if ! diff "$compare" "$tmp"; then
+                                echo "difference with ${flags[*]}"
                         fi
                 fi
         fi
@@ -220,47 +223,47 @@
         exit 0
 fi
 mmake clean >/dev/null
-cd $src/benchmark/tests
-for f in `ls *.sml`; do
-        f=`basename $f .sml`
-        tmpf=/tmp/$f.$$
+cd "$src/benchmark/tests"
+for f in *.sml; do
+        f=`basename "$f" .sml`
+        tmpf="/tmp/$f.$$"
         case "$f" in
         fxp|hamlet)
                 echo "skipping $f"
         ;;
         *)
                         echo "testing $f"
-                echo "val _ = Main.doit 0" | cat $f.sml - > $tmpf.sml
-                $mlton -output $tmpf $flags                     \
+                echo "val _ = Main.doit 0" | cat "$f.sml" - > "$tmpf.sml"
+                $mlton -output "$tmpf" "${flags[@]}"            \
                         -default-ann 'nonexhaustiveMatch ignore'\
                         -default-ann 'redundantMatch ignore'    \
-                        $tmpf.sml
+                        "$tmpf.sml"
                 if [ $? -ne 0 ]; then
-                        compFail $f
+                        compFail "$f"
                 fi
-                rm -f $tmpf $tmpf.sml
+                rm -f "$tmpf" "$tmpf.sml"
         ;;
         esac
 done 
 mmake clean >/dev/null
-cd $src
+cd "$src"
 for f in mllex mlyacc mlprof; do
-    tmpf=/tmp/$f.$$
-    cd $src/$f
+    tmpf="/tmp/$f.$$"
+    cd "$src/$f"
     case "$f" in
     foobar)
             echo "skipping $f"
     ;;
     *)
         echo "testing $f"
-        mmake -W $f >/dev/null
-        $mlton $flags -output $tmpf $f.mlb
+        mmake -W "$f" >/dev/null
+        "$mlton" "${flags[@]}" -output "$tmpf" "$f.mlb"
         if [ $? -ne 0 ]; then
-                compFail $f
+                compFail "$f"
         fi
-        rm -f $tmpf
+        rm -f "$tmpf"
     ;;
     esac
 done
 
-rm -f $tmp
+rm -f "$tmp"

Modified: mlton/branches/on-20050822-x86_64-branch/bin/sync-ignore
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/bin/sync-ignore	2006-05-10 13:15:15 UTC (rev 4514)
+++ mlton/branches/on-20050822-x86_64-branch/bin/sync-ignore	2006-05-10 14:29:59 UTC (rev 4515)
@@ -2,9 +2,9 @@
 
 set -e
 
-name=`basename $0`
-dir=`dirname $0`
-root=`cd $dir/.. && pwd`
+name=`basename "$0"`
+dir=`dirname "$0"`
+root=`cd "$dir/.." && pwd`
 
 die () {
         echo >&2 "$1"
@@ -25,11 +25,11 @@
 
 p='svn:ignore'
 
-for i in `find $root -type f -name .ignore`; do
-        d=`dirname $i`
+for i in `find "$root" -type f -name .ignore`; do
+        d=`dirname "$i"`
         tmp='/tmp/z.ign'
-        svn propget $p $d | head -n -1 >$tmp
-        if ! diff -q $i $tmp >/dev/null; then
-                svn propset $p -F $i $d
+        svn propget "$p" "$d" | head -n -1 >"$tmp"
+        if ! diff -q "$i" "$tmp" >/dev/null; then
+                svn propset "$p" -F "$i" "$d"
         fi
 done

Modified: mlton/branches/on-20050822-x86_64-branch/bin/upgrade-basis
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/bin/upgrade-basis	2006-05-10 13:15:15 UTC (rev 4514)
+++ mlton/branches/on-20050822-x86_64-branch/bin/upgrade-basis	2006-05-10 14:29:59 UTC (rev 4515)
@@ -7,8 +7,8 @@
         exit 1
 }
 
-bin=`dirname $0`
-name=`basename $0`
+bin=`dirname "$0"`
+name=`basename "$0"`
 
 usage () {
         die "usage: $name <PATH> <ARCH> <OS>"
@@ -27,16 +27,16 @@
 
 tmp="$$.sml"
 
-echo "val () = print \"I work\"" >$tmp
-if ! mlton $tmp 1>&2; then
+echo "val () = print \"I work\"" >"$tmp"
+if ! mlton "$tmp" 1>&2; then
         die "Error: cannot upgrade basis because the compiler doesn't work" 
 fi
 
 feature () {
         feature="$1"
         sml="$2"
-        echo "$feature" >$tmp
-        if ! mlton -stop tc $tmp >/dev/null 2>&1; then
+        echo "$feature" >"$tmp"
+        if ! mlton -stop tc "$tmp" >/dev/null 2>&1; then
                 echo "$sml"
         fi
 }
@@ -95,7 +95,7 @@
 structure Word32 = Word
 structure LargeWord = Word'
 
-eval `$bin/platform`
+eval `"$bin/platform"`
 case "$ARCH" in
 alpha)
         arch='Alpha'
@@ -237,5 +237,5 @@
    end
 EOF
 
-rm -f $tmp
-rm -f `basename $tmp .sml`
+rm -f "$tmp"
+rm -f `basename "$tmp" .sml`

Modified: mlton/branches/on-20050822-x86_64-branch/mllex/Makefile
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/mllex/Makefile	2006-05-10 13:15:15 UTC (rev 4514)
+++ mlton/branches/on-20050822-x86_64-branch/mllex/Makefile	2006-05-10 14:29:59 UTC (rev 4515)
@@ -18,11 +18,11 @@
 
 all:	$(NAME)
 
-$(NAME): $(NAME).mlb $(shell PATH=$(BIN):$$PATH && $(MLTON) -stop f $(NAME).mlb)
+$(NAME): $(NAME).mlb $(shell PATH="$(BIN):$$PATH" && "$(MLTON)" -stop f $(NAME).mlb)
 	@echo 'Compiling $(NAME)'
-	$(MLTON) $(FLAGS) $(NAME).mlb
+	"$(MLTON)" $(FLAGS) $(NAME).mlb
 
-$(NAME).sml: $(NAME).cm $(shell $(MLTON) -stop f $(NAME).cm)
+$(NAME).sml: $(NAME).cm $(shell "$(MLTON)" -stop f $(NAME).cm)
 	mlton -stop sml $(NAME).cm
 
 html/index.html: $(TEX_FILES)

Modified: mlton/branches/on-20050822-x86_64-branch/mlnlffigen/Makefile
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/mlnlffigen/Makefile	2006-05-10 13:15:15 UTC (rev 4514)
+++ mlton/branches/on-20050822-x86_64-branch/mlnlffigen/Makefile	2006-05-10 14:29:59 UTC (rev 4515)
@@ -17,7 +17,7 @@
 
 all:	$(NAME)
 
-$(NAME): $(NAME).mlb $(shell PATH=$(BIN):$$PATH && $(MLTON) -stop f $(NAME).mlb)
+$(NAME): $(NAME).mlb $(shell PATH="$(BIN):$$PATH" && "$(MLTON)" -stop f $(NAME).mlb)
 	@echo 'Compiling $(NAME)'
 	$(MLTON) $(FLAGS) $(NAME).mlb
 

Modified: mlton/branches/on-20050822-x86_64-branch/mlprof/Makefile
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/mlprof/Makefile	2006-05-10 13:15:15 UTC (rev 4514)
+++ mlton/branches/on-20050822-x86_64-branch/mlprof/Makefile	2006-05-10 14:29:59 UTC (rev 4515)
@@ -18,11 +18,11 @@
 
 all:	$(NAME)
 
-$(NAME): $(NAME).mlb $(shell PATH=$(BIN):$$PATH && $(MLTON) -stop f $(NAME).mlb)
+$(NAME): $(NAME).mlb $(shell PATH="$(BIN):$$PATH" && "$(MLTON)" -stop f $(NAME).mlb)
 	@echo 'Compiling $(NAME)'
 	$(MLTON) $(FLAGS) $(NAME).mlb
 
-$(NAME).sml: $(NAME).cm $(shell $(MLTON) -stop f $(NAME).cm)
+$(NAME).sml: $(NAME).cm $(shell "$(MLTON)" -stop f $(NAME).cm)
 	mlton -stop sml $(NAME).cm
 
 .PHONY: clean

Modified: mlton/branches/on-20050822-x86_64-branch/mlton/Makefile
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/mlton/Makefile	2006-05-10 13:15:15 UTC (rev 4514)
+++ mlton/branches/on-20050822-x86_64-branch/mlton/Makefile	2006-05-10 14:29:59 UTC (rev 4515)
@@ -9,8 +9,8 @@
 SRC = $(shell cd .. && pwd)
 BUILD = $(SRC)/build
 BIN = $(BUILD)/bin
-HOST_ARCH = $(shell $(SRC)/bin/host-arch)
-HOST_OS = $(shell $(SRC)/bin/host-os)
+HOST_ARCH = $(shell "$(SRC)/bin/host-arch")
+HOST_OS = $(shell "$(SRC)/bin/host-os")
 LIB = $(BUILD)/lib
 MLTON = mlton
 TARGET = self
@@ -20,7 +20,7 @@
 
 FLAGS = @MLton ram-slop 0.7 gc-summary $(RUNTIME_ARGS) --
 
-ifeq (self, $(shell if [ -x $(BIN)/mlton ]; then echo self; fi))
+ifeq (self, $(shell if [ -x "$(BIN)/mlton" ]; then echo self; fi))
   # We're compiling MLton with itself, so don't use any stubs.
   FILE = mlton.mlb
   FLAGS += -default-ann 'sequenceNonUnit warn'
@@ -42,15 +42,15 @@
 endif
 endif
 
-ifeq (new,$(shell PATH=$(BIN):$$PATH; mlton -target self >/dev/null 2>&1 && echo new))
+ifeq (new,$(shell PATH="$(BIN):$$PATH"; mlton -target self >/dev/null 2>&1 && echo new))
   FLAGS += -target $(TARGET)
 else
   FLAGS += -host $(TARGET)
 endif
-ifeq (new,$(shell PATH=$(BIN):$$PATH; mlton -verbose 1 >/dev/null 2>&1 && echo new))
-  FLAGS += -verbose 2 -output $(AOUT)
+ifeq (new,$(shell PATH="$(BIN):$$PATH"; mlton -verbose 1 >/dev/null 2>&1 && echo new))
+  FLAGS += -verbose 2 -output "$(AOUT)"
 else
-  FLAGS += -v -o $(AOUT)
+  FLAGS += -v -o "$(AOUT)"
 endif
 FLAGS += $(COMPILE_ARGS)
 
@@ -86,7 +86,7 @@
 #! Pass $(PATH) to upgrade-basis because it is run via #!/usr/bin/env
 # bash, which resets the path.
 $(UP):
-	$(SRC)/bin/upgrade-basis "$(PATH)" "$(HOST_ARCH)" "$(HOST_OS)" >$(UP)
+	"$(SRC)/bin/upgrade-basis" "$(PATH)" "$(HOST_ARCH)" "$(HOST_OS)" >$(UP)
 
 mlton.sml: $(SOURCES)
 	rm -f mlton.sml && mlton -stop sml mlton.cm && chmod -w mlton.sml
@@ -117,7 +117,7 @@
 		echo 'Control.polyEqWarn := false;';				\
 		echo 'CM.make "sources.cm";';					\
 		echo 'Main.exportNJ ("$(LIB)/mlton");'	\
-	) | $(SML)
+	) | "$(SML)"
 
 .PHONY: nj-mlton-dual
 nj-mlton-dual: $(SOURCES)
@@ -130,7 +130,7 @@
 		echo 'val _ = CM.Server.start {cmd = (CommandLine.name (), ["@CMslave"]), name = "server2", pathtrans = NONE, pref = 0};';\
 		echo 'CM.make "sources.cm";';					\
 		echo 'Main.exportNJ ("$(LIB)/mlton");'	\
-	) | $(SML)
+	) | "$(SML)"
 
 .PHONY: nj-mlton-quad
 nj-mlton-quad: $(SOURCES)
@@ -145,7 +145,7 @@
 		echo 'val _ = CM.Server.start {cmd = (CommandLine.name (), ["@CMslave"]), name = "server4", pathtrans = NONE, pref = 0};';\
 		echo 'CM.make "sources.cm";';					\
 		echo 'Main.exportNJ ("$(LIB)/mlton");'	\
-	) | $(SML)
+	) | "$(SML)"
 
 .PHONY: nj-whole
 nj-whole: $(SOURCES)
@@ -163,7 +163,7 @@
 		echo 'val _ = Main.exportNJ ("$(SRC)/basis-library", "$(LIB)/mlton")';	\
 		echo 'end';							\
 	) >mlton.whole.sml
-	$(SML) <mlton.whole.sml
+	"$(SML)" <mlton.whole.sml
 
 .PHONY: warn
 warn:

Modified: mlton/branches/on-20050822-x86_64-branch/mlyacc/Makefile
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/mlyacc/Makefile	2006-05-10 13:15:15 UTC (rev 4514)
+++ mlton/branches/on-20050822-x86_64-branch/mlyacc/Makefile	2006-05-10 14:29:59 UTC (rev 4515)
@@ -18,11 +18,11 @@
 
 all:	$(NAME)
 
-$(NAME): $(NAME).mlb $(shell PATH=$(BIN):$$PATH && $(MLTON) -stop f $(NAME).mlb)
+$(NAME): $(NAME).mlb $(shell PATH="$(BIN):$$PATH" && "$(MLTON)" -stop f $(NAME).mlb)
 	@echo 'Compiling $(NAME)'
-	$(MLTON) $(FLAGS) $(NAME).mlb
+	"$(MLTON)" $(FLAGS) $(NAME).mlb
 
-$(NAME).sml: $(NAME).cm $(shell $(MLTON) -stop f $(NAME).cm)
+$(NAME).sml: $(NAME).cm $(shell "$(MLTON)" -stop f $(NAME).cm)
 	mlton -stop sml $(NAME).cm
 
 src/yacc.lex.sml: src/yacc.lex

Modified: mlton/branches/on-20050822-x86_64-branch/regression/Makefile
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/regression/Makefile	2006-05-10 13:15:15 UTC (rev 4514)
+++ mlton/branches/on-20050822-x86_64-branch/regression/Makefile	2006-05-10 14:29:59 UTC (rev 4515)
@@ -12,9 +12,9 @@
 clean:
 	../bin/clean
 	rm -f *.[csS]
-	for f in `ls`; do 			\
-		if [ -x $$f -a ! -d $$f ]; then	\
-			rm -f $$f;		\
+	for f in *; do 			\
+		if [ -x "$$f" -a ! -d "$$f" ]; then	\
+			rm -f "$$f";		\
 		fi;				\
 	done
 
@@ -22,5 +22,3 @@
 .PHONY: abnormal
 abnormal:
 	ls -1 | egrep -v '\.ok$$|\.sml$$'
-
-