diff options
Diffstat (limited to 'data/_dpkg/runcmd.diff')
-rw-r--r-- | data/_dpkg/runcmd.diff | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/data/_dpkg/runcmd.diff b/data/_dpkg/runcmd.diff new file mode 100644 index 000000000..0d174c713 --- /dev/null +++ b/data/_dpkg/runcmd.diff @@ -0,0 +1,37 @@ +diff -ur dpkg-1.18.25/lib/dpkg/command.c dpkg-1.18.25+iPhone/lib/dpkg/command.c +--- dpkg-1.18.25/lib/dpkg/command.c 2018-03-21 18:29:34.000000000 -1000 ++++ dpkg-1.18.25+iPhone/lib/dpkg/command.c 2019-03-29 22:10:21.000000000 -1000 +@@ -18,6 +18,7 @@ + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + ++#include <sys/errno.h> + #include <config.h> + #include <compat.h> + +@@ -179,7 +180,24 @@ + command_exec(struct command *cmd) + { + execvp(cmd->filename, (char * const *)cmd->argv); +- ohshite(_("unable to execute %s (%s)"), cmd->name, cmd->filename); ++ if (errno == EPERM || errno == ENOEXEC) { ++ const char *shell; ++ if (access(DEFAULTSHELL, X_OK) == 0) { ++ shell = DEFAULTSHELL; ++ } else if (access("/etc/alternatives/sh", X_OK) == 0) { ++ shell = "/etc/alternatives/sh"; ++ } else if (access("/bin/bash", X_OK) == 0) { ++ shell = "/bin/bash"; ++ } else { ++ ohshite(_("unable to execute %s (%s): no shell!"), cmd->name, cmd->filename); ++ } ++ struct command newcmd; ++ command_init(&newcmd, shell, NULL); ++ command_add_args(&newcmd, shell, "-c", "\"$0\" \"$@\"", NULL); ++ command_add_argl(&newcmd, cmd->argv); ++ execvp(shell, (char * const *)newcmd.argv); ++ ohshite(_("unable to execute %s (%s)"), cmd->name, cmd->filename); ++ } + } + + |