Skip to content

Commit

Permalink
minimal-sdk: restrict PATH
Browse files Browse the repository at this point in the history
The main purpose of the `minimal-sdk` artifact is to serve in automated
Azure Pipelines and GitHub workflows. Let's make sure that we are not
picking up any unintended executables along the way.

One such unintended executable would be Git for Windows' gpg.exe: Git
for Windows is installed in the build agents of Azure Pipelines and
GitHub Actions, and its `/usr/bin/` is sadly in the `PATH` and will most
likely remain there indefinitely, for details, see
actions/runner-images#1525.

However, this can lead to `gpg.exe` being picked up by Git's test suite,
and unfortunately the GPG agent tends to hang in the VMs in which the
tests are run.

So why does this not happen all the time? Most likely due to mismatches
of the MSYS2 runtime, which let `gpg.exe` fail to load (and which Git's
test suite takes as sign that "we looked all around but no GPG could be
found"). This is a fragile situation, of course: at any point, outside
of Git's (or Git for Windows') control, `gpg.exe` can start working
again.

By specifically overriding the `PATH` to only include the `bin/`
directories of the minimal SDK, plus Windows' system directories, we can
avoid this from ever happening again.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Dec 1, 2020
1 parent 05c9ec7 commit 77ed3b6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion please.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4565,7 +4565,7 @@ create_sdk_artifact () { # [--out=<directory>] [--git-sdk=<directory>] [--bitnes
then
if test minimal-sdk = $mode
then
printf 'export MSYSTEM=MINGW64\nexport PATH=/mingw64/bin:/usr/bin/:/usr/bin/core_perl:$PATH\n' >"$output_path/etc/profile"
printf 'export MSYSTEM=MINGW64\nexport PATH=/mingw64/bin:/usr/bin/:/usr/bin/core_perl:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem\n' >"$output_path/etc/profile"
elif test makepkg-git = $mode
then
cat >"$output_path/etc/profile" <<-\EOF
Expand Down

0 comments on commit 77ed3b6

Please sign in to comment.