ninja: remove impure dependency on /bin/sh

This commit is contained in:
Max
2025-08-08 18:25:26 +02:00
parent 4f5a5cff52
commit 0c0992bb99
2 changed files with 31 additions and 1 deletions

View File

@@ -0,0 +1,27 @@
From cf438f7a3ab2e70b06ec12653d1111e35084733f Mon Sep 17 00:00:00 2001
From: Max <max@privatevoid.net>
Date: Fri, 8 Aug 2025 18:20:48 +0200
Subject: [PATCH] spawn sh instead of /bin/sh
---
src/subprocess-posix.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/subprocess-posix.cc b/src/subprocess-posix.cc
index 0e62b3b..c1c31aa 100644
--- a/src/subprocess-posix.cc
+++ b/src/subprocess-posix.cc
@@ -129,8 +129,8 @@ bool Subprocess::Start(SubprocessSet* set, const string& command) {
if (err != 0)
Fatal("posix_spawnattr_setflags: %s", strerror(err));
- const char* spawned_args[] = { "/bin/sh", "-c", command.c_str(), NULL };
- err = posix_spawn(&pid_, "/bin/sh", &action, &attr,
+ const char* spawned_args[] = { "sh", "-c", command.c_str(), NULL };
+ err = posix_spawnp(&pid_, "sh", &action, &attr,
const_cast<char**>(spawned_args), environ);
if (err != 0)
Fatal("posix_spawn: %s", strerror(err));
--
2.50.1

View File

@@ -52,8 +52,11 @@ stdenv.mkDerivation (finalAttrs: {
libxslt.bin
];
patches = [
./0001-spawn-sh-instead-of-bin-sh.patch
]
# TODO: remove together with ninja 1.11
patches = lib.optionals (lib.versionOlder finalAttrs.version "1.12") [
++ lib.optionals (lib.versionOlder finalAttrs.version "1.12") [
(fetchpatch {
name = "ninja1.11-python3.13-compat.patch";
url = "https://github.com/ninja-build/ninja/commit/9cf13cd1ecb7ae649394f4133d121a01e191560b.patch";