Skip to content

Commit

Permalink
popen: call /usr/bin/sh instead of /bin/sh
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lazka authored and dscho committed Aug 27, 2024
1 parent 7b84fed commit 6f87e23
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion winsup/cygwin/syscalls.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4423,7 +4423,7 @@ popen (const char *command, const char *in_type)
fcntl (stdchild, F_SETFD, stdchild_state | FD_CLOEXEC);

/* Start a shell process to run the given command without forking. */
pid_t pid = ch_spawn.worker ("/bin/sh", argv, environ, _P_NOWAIT,
pid_t pid = ch_spawn.worker ("/usr/bin/sh", argv, environ, _P_NOWAIT,
__std[0], __std[1]);

/* Reinstate the close-on-exec state */
Expand Down

0 comments on commit 6f87e23

Please sign in to comment.