summaryrefslogtreecommitdiff
path: root/data/_dpkg
diff options
context:
space:
mode:
authorSam Bingner <sam@bingner.com>2019-03-29 23:57:11 -1000
committerSam Bingner <sam@bingner.com>2019-03-29 23:57:11 -1000
commit75c2158d2a7b1ae2def3c5b31dbbf33148225902 (patch)
treecd868b1d46da40694b742966a1e3b65acdcc8073 /data/_dpkg
parent06ef0d89ea57d333861c065c8c2870f3aa67b31b (diff)
Make dpkg exec smarter; Update bash, tcsh, and zsh
Diffstat (limited to 'data/_dpkg')
-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);
++ }
}
+