From ae0f679062acbeed66581b22b840be2e1b1a1806 Mon Sep 17 00:00:00 2001
From: Ian Lynagh <igloo@earth.li>
Date: Thu, 28 Jul 2011 16:03:13 +0100
Subject: [PATCH] Fix the permissions of all the package.conf.d files when
 installing

Fixes trac #5311.
---
 ghc.mk | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/ghc.mk b/ghc.mk
index f67585599a6b..b359ecca7a30 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -889,9 +889,11 @@ install_packages: libffi/package.conf.install rts/package.conf.install
 	           "$(INSTALLED_GHC_PKG_REAL)"                             \
 	               --global-conf "$(INSTALLED_PACKAGE_CONF)" hide $p))
 # when we install the packages above, ghc-pkg obeys umask when creating
-# package.cache, but for everything else we specify the permissions. We
-# therefore now fix the permissions of package.cache
-	$(CREATE_DATA) '$(INSTALLED_PACKAGE_CONF)/package.cache'
+# the package.conf files, but for everything else we specify the
+# permissions. We therefore now fix the permissions of package.cache.
+# This means "sudo make install" does the right thing even if it runs
+# with an 077 umask.
+	for f in '$(INSTALLED_PACKAGE_CONF)'/*; do $(CREATE_DATA) "$$f"; done
 
 # -----------------------------------------------------------------------------
 # Binary distributions
-- 
GitLab