Skip to content

Commit 971dfcf

Browse files
committed
[build+macOS] Remove quarantine from OpenJDK installations
Context: #9651 Recent versions of macOS, Safari, and **tar**(1) [^0] interact such that if you manually download a tarball and extract it, *all the extracted files* contain the `com.apple.quarantine` extended attribute. This is a security feature, but it also means that the provisioned JDK *cannot be used*: % $HOME/android-toolchain/jdk-21/bin/javac zsh: operation not permitted: ./jdk-21/bin/javac Which in turn means if you do something "reasonable" like download Microsoft OpenJDK and place it into `$HOME/android-archives` -- so that `xaprepare` doesn't need to download it *again* -- then the provisioned JDK will be *unusable*. Which makes @jonpryor sad. Update `Step_InstallAdoptOpenJDK.MacOS.cs` to run `xattr -d -r com.apple.quarantine $HOME/android-toolchain/jdk-21`. This will *delete* the offending extended attribute, allowing e.g. `javac` to run without error. [^0]: Which versions? ¯\_(ツ)_/¯
1 parent 679bb84 commit 971dfcf

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

build-tools/xaprepare/xaprepare/Steps/Step_InstallAdoptOpenJDK.MacOS.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ void MoveContents (string sourceDir, string destinationDir)
1010
{
1111
string realSourceDir = Path.Combine (sourceDir, "Contents", "Home");
1212
Utilities.MoveDirectoryContentsRecursively (realSourceDir, destinationDir);
13+
14+
var xattr_d = new ProcessRunner ("xattr", "-d", "-r", "com.apple.quarantine", ".") {
15+
EchoStandardError = true,
16+
WorkingDirectory = destinationDir,
17+
};
18+
xattr_d.Run ();
1319
}
1420
}
1521
}

0 commit comments

Comments
 (0)