[Git][ghc/ghc][ghc-9.8] bindist: Use complete relative paths when cding to directories

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Thu Oct 17 17:13:48 UTC 2024



Ben Gamari pushed to branch ghc-9.8 at Glasgow Haskell Compiler / GHC


Commits:
e9aabcf5 by Matthew Pickering at 2024-10-17T13:10:09-04:00
bindist: Use complete relative paths when cding to directories

If a user has configured CDPATH on their system then `cd lib` may change
into an unexpected directory during the installation process.

If you write `cd ./lib` then it will not consult `CDPATH` to determine
what you mean.

I have added a check on ghcup-ci to verify that the bindist installation
works in this situation.

Fixes #24951

(cherry picked from commit 383c01a8928779920b4edea2f9d886ff303b8bd3)

- - - - -


1 changed file:

- hadrian/bindist/Makefile


Changes:

=====================================
hadrian/bindist/Makefile
=====================================
@@ -165,7 +165,7 @@ install_lib: lib/settings
 	$(INSTALL_DIR) "$(DESTDIR)$(ActualLibsDir)"
 	
 	@dest="$(DESTDIR)$(ActualLibsDir)"; \
-	cd lib; \
+	cd ./lib; \
 	for i in `$(FIND) . -type f`; do \
 		$(INSTALL_DIR) "$$dest/`dirname $$i`" ; \
 		case $$i in \
@@ -195,7 +195,7 @@ install_docs:
 	$(INSTALL_DIR) "$(DESTDIR)$(docdir)"
 
 	if [ -d doc ]; then \
-		cd doc; $(FIND) . -type f -exec sh -c \
+		cd ./doc; $(FIND) . -type f -exec sh -c \
 			'$(INSTALL_DIR) "$(DESTDIR)$(docdir)/`dirname $$1`" && $(INSTALL_DATA) "$$1" "$(DESTDIR)$(docdir)/`dirname $$1`"' \
 			sh '{}' ';'; \
 	fi
@@ -210,7 +210,7 @@ install_docs:
 install_data:
 	@echo "Copying data to $(DESTDIR)share"
 	$(INSTALL_DIR) "$(DESTDIR)$(datadir)"
-	cd share; $(FIND) . -type f -exec sh -c \
+	cd ./share; $(FIND) . -type f -exec sh -c \
 		'$(INSTALL_DIR) "$(DESTDIR)$(datadir)/`dirname $$1`" && \
 		$(INSTALL_DATA) "$$1" "$(DESTDIR)$(datadir)/`dirname $$1`"' \
 		sh '{}' ';';
@@ -231,7 +231,7 @@ export SHELL
 install_wrappers: install_bin_libdir install_hsc2hs_wrapper
 	@echo "Installing wrapper scripts"
 	$(INSTALL_DIR) "$(DESTDIR)$(WrapperBinsDir)"
-	for p in `cd wrappers; $(FIND) . ! -type d`; do \
+	for p in `cd ./wrappers; $(FIND) . ! -type d`; do \
 	    mk/install_script.sh "$$p" "$(DESTDIR)/$(WrapperBinsDir)/$$p" "$(WrapperBinsDir)" "$(ActualBinsDir)" "$(ActualBinsDir)/$$p" "$(ActualLibsDir)" "$(docdir)" "$(includedir)"; \
 	done
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e9aabcf5d5ddc1e65d7d804854ee20b8c24f72fd

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e9aabcf5d5ddc1e65d7d804854ee20b8c24f72fd
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20241017/c123a68a/attachment-0001.html>


More information about the ghc-commits mailing list