MSYS2-packages/msys2-runtime/0021-popen-call-usr-bin-sh-instead-of-bin-sh.patch
Johannes Schindelin 6365cf1bc0 msys2-runtime: upgrade to v3.6.5
This corresponds to https://github.com/msys2/msys2-runtime/pull/313

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2025-10-10 16:28:18 +02:00

32 lines
1.3 KiB
Diff

From b5154609113547a19e86e6a0c9e272f80937786a Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Fri, 5 Jun 2020 20:09:11 +0200
Subject: [PATCH 21/N] popen: call /usr/bin/sh instead of /bin/sh
We mount /usr/bin to /bin, but in a chroot this is broken and we
have no /bin, so try to use the real path.
chroot is used by pacman to run install scripts when called with --root
and this broke programs in install scripts calling popen()
(install-info from texinfo for example)
There are more paths hardcoded to /bin in cygwin which might also be broken
in this scenario, so this maybe should be extended to all of them.
---
winsup/cygwin/syscalls.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index eddc0f6..3295922 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -4536,7 +4536,7 @@ popen (const char *command, const char *in_type)
/* Start a shell process to run the given command without forking. */
child_info_spawn ch_spawn_local (_CH_NADA);
- pid_t pid = ch_spawn_local.worker ("/bin/sh", argv, environ, _P_NOWAIT,
+ pid_t pid = ch_spawn_local.worker ("/usr/bin/sh", argv, environ, _P_NOWAIT,
__std[0], __std[1]);
/* Reinstate the close-on-exec state */