Skip to content

Commit 9545f5f

Browse files
committedJul 6, 2020
boostrap: Enable mksh by default on macOS 10.11+.
El Capitan (10.11) introduced System Integrity Protection (SIP), and one of the side effects of this protection is that system shells (i.e. /bin/*sh) unset any variables that may affect the security of the system. This causes problems with packages that rely on e.g. LD_LIBRARY_PATH. Using a shell outside of the system paths allows us to work around this, at least for now. Tested in bulk builds on macOS Catalina, though with SIP disabled (as there is no way to run sandboxed builds with SIP enabled).
1 parent 671976c commit 9545f5f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed
 

‎bootstrap/bootstrap

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22

3-
# $NetBSD: bootstrap,v 1.285 2020/07/06 10:25:29 jperkin Exp $
3+
# $NetBSD: bootstrap,v 1.286 2020/07/06 10:43:47 jperkin Exp $
44
#
55
# Copyright (c) 2001-2011 Alistair Crooks <agc@NetBSD.org>
66
# All rights reserved.
@@ -589,6 +589,15 @@ Darwin)
589589
need_sed=yes
590590
fi
591591

592+
# Avoid system shells on macOS versions that enable System Integrity
593+
# Protection (SIP) as it affects packages that rely on variables such
594+
# as LD_LIBRARY_PATH. SIP unsets any variables that may affect
595+
# security when using system binaries, i.e. /bin/*sh, but using a
596+
# non-system shell is unaffected, at least for now.
597+
if [ $macos_version -ge 1011 ]; then
598+
need_mksh=yes
599+
fi
600+
592601
case "$macos_version" in
593602
100[7-9])
594603
packagemaker=/Applications/PackageMaker.app/Contents/MacOS/PackageMaker

0 commit comments

Comments
 (0)