[commit: ghc] master: Don't use $SHELL in wrapper scripts (a10c2e6)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 05:32:26 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/a10c2e6e9e9af3addbf91c0bb374257fb6c72553/ghc

>---------------------------------------------------------------

commit a10c2e6e9e9af3addbf91c0bb374257fb6c72553
Author: Joachim Breitner <nomeata at debian.org>
Date:   Tue Aug 1 19:30:09 2017 +0000

    Don't use $SHELL in wrapper scripts
    
    Do not use $SHELL as $SHELL is the user's preferred interactive shell.
    We do not want this to leak into the wrapper scripts.


>---------------------------------------------------------------

a10c2e6e9e9af3addbf91c0bb374257fb6c72553
 driver/ghci/ghc.mk     | 4 ++--
 rules/shell-wrapper.mk | 6 +++---
 utils/mkdirhier/ghc.mk | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/driver/ghci/ghc.mk b/driver/ghci/ghc.mk
index 0f31884..0e18a5f 100644
--- a/driver/ghci/ghc.mk
+++ b/driver/ghci/ghc.mk
@@ -21,7 +21,7 @@ install_driver_ghci:
 	$(INSTALL_DIR) "$(DESTDIR)$(bindir)"
 	$(call removeFiles,                                "$(WRAPPER)")
 	$(CREATE_SCRIPT)                                   "$(WRAPPER)"
-	echo '#!$(SHELL)'                               >> "$(WRAPPER)"
+	echo '#!/bin/sh'                                   >> "$(WRAPPER)"
 	echo 'exec "$(bindir)/$(CrossCompilePrefix)ghc-$(ProjectVersion)" --interactive "$$@"' >> "$(WRAPPER)"
 	$(EXECUTABLE_FILE)                                 "$(WRAPPER)"
 	$(call removeFiles,"$(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghci")
@@ -56,7 +56,7 @@ install_driver_ghcii: GHCII_SCRIPT_VERSIONED = $(DESTDIR)$(bindir)/ghcii-$(Proje
 install_driver_ghcii:
 	$(INSTALL_DIR) "$(DESTDIR)$(bindir)"
 	$(call removeFiles,"$(GHCII_SCRIPT)")
-	echo "#!$(SHELL)"                                  >> $(GHCII_SCRIPT)
+	echo "#!/bin/sh"                                        >> $(GHCII_SCRIPT)
 	echo 'exec "$$(dirname "$$0")"/ghc --interactive "$$@"' >> $(GHCII_SCRIPT)
 	$(EXECUTABLE_FILE) $(GHCII_SCRIPT)
 	cp $(GHCII_SCRIPT) $(GHCII_SCRIPT_VERSIONED)
diff --git a/rules/shell-wrapper.mk b/rules/shell-wrapper.mk
index eb7d8f1..bdab6e2 100644
--- a/rules/shell-wrapper.mk
+++ b/rules/shell-wrapper.mk
@@ -41,7 +41,7 @@ $$($1_$2_INPLACE_WRAPPER): $$($1_$2_SHELL_WRAPPER_NAME)
 endif
 $$($1_$2_INPLACE_WRAPPER): $$($1_$2_INPLACE)
 	$$(call removeFiles,                                                    $$@)
-	echo '#!$$(SHELL)'                                                   >> $$@
+	echo '#!/bin/sh'                                                     >> $$@
 	echo 'executablename="$$(TOP)/$$<"'                                  >> $$@
 	echo 'datadir="$$(TOP)/$$(INPLACE_LIB)"'                             >> $$@
 	echo 'bindir="$$(TOP)/$$(INPLACE_BIN)"'                              >> $$@
@@ -80,7 +80,7 @@ install_$1_$2_wrapper:
 	$$(INSTALL_DIR) "$$(DESTDIR)$$(bindir)"
 	$$(call removeFiles,                                        "$$(WRAPPER)")
 	$$(CREATE_SCRIPT)                                           "$$(WRAPPER)"
-	echo '#!$$(SHELL)'                                       >> "$$(WRAPPER)"
+	echo '#!/bin/sh'                                         >> "$$(WRAPPER)"
 	echo 'exedir="$$(ghclibexecdir)/bin"'                    >> "$$(WRAPPER)"
 	echo 'exeprog="$$($1_$2_PROG)"'                          >> "$$(WRAPPER)"
 	echo 'executablename="$$$$exedir/$$$$exeprog"'           >> "$$(WRAPPER)"
@@ -106,7 +106,7 @@ BINDIST_EXTRAS += $$($1_$2_BINDIST_WRAPPER)
 
 $$($1_$2_BINDIST_WRAPPER): $1/$2/build/tmp/$$($1_$2_PROG)
 	$$(call removeFiles,                                                  $$@)
-	echo '#!$$(SHELL)'                                                 >> $$@
+	echo '#!/bin/sh'                                                   >> $$@
 ifeq "$$(DYNAMIC_GHC_PROGRAMS)" "YES"
 	echo '$$(call prependLibraryPath,$$($1_$2_DEP_LIB_REL_DIRS_SEARCHPATH))' >> $$@
 endif
diff --git a/utils/mkdirhier/ghc.mk b/utils/mkdirhier/ghc.mk
index 55803f0..2e3a301 100644
--- a/utils/mkdirhier/ghc.mk
+++ b/utils/mkdirhier/ghc.mk
@@ -14,7 +14,7 @@ $(MKDIRHIER) : utils/mkdirhier/mkdirhier.sh
 	mkdir -p $(INPLACE_BIN)
 	mkdir -p $(INPLACE_LIB)
 	$(call removeFiles,$@)
-	echo '#!$(SHELL)'  		 >> $@
+	echo '#!/bin/sh'  		 >> $@
 	cat utils/mkdirhier/mkdirhier.sh >> $@
 	$(EXECUTABLE_FILE) $@
 



More information about the ghc-commits mailing list