summaryrefslogtreecommitdiff
path: root/data/_dpkg/runcmd.diff
diff options
context:
space:
mode:
Diffstat (limited to 'data/_dpkg/runcmd.diff')
-rw-r--r--data/_dpkg/runcmd.diff41
1 files changed, 31 insertions, 10 deletions
diff --git a/data/_dpkg/runcmd.diff b/data/_dpkg/runcmd.diff
index dd2213d51..0d174c713 100644
--- a/data/_dpkg/runcmd.diff
+++ b/data/_dpkg/runcmd.diff
@@ -1,16 +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 2018-10-12 12:36:05.000000000 -1000
-@@ -178,7 +178,11 @@
- void
++++ 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);
-+ struct command newcmd;
-+ command_init(&newcmd, DEFAULTSHELL, NULL);
-+ command_add_args(&newcmd, DEFAULTSHELL, "-c", "\"$0\" \"$@\"", NULL);
-+ command_add_argl(&newcmd, cmd->argv);
-+ execvp(DEFAULTSHELL, (char * const *)newcmd.argv);
- ohshite(_("unable to execute %s (%s)"), cmd->name, cmd->filename);
+ 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);
++ }
}
+