Re: hooks scripts and noexec partition
- From
Jeff King <peff@peff.net>
- Date
- Dec 17, 2014, 03:03 UTC
- Message-ID
- <20141217030328.GB4033@peff.net>
- In-Reply-To
- <CAJ1PRS=KmiQJG91nxG5pQXPHX2XruoyL9c4yzzPeYayw+UAjPw@mail.gmail.com>
On Sun, Dec 14, 2014 at 02:44:35AM +0100, krzf83@gmail.com wrote:
> Thanks for the patch, however it is not working (no change, hooks > still dont work on noexec partition). Since I see that you are fluent > in git code and C can you by any chance tell me how to modify > run-command.c to make git run hooks as: /bin/sh <hook_path> ?
I do not think that is a smart thing to do in general, as there is no guarantee that the hook is in fact a shell script (and not a binary, or some other scripting language). But if you want do a one-off patch for yourself, knowing that you will only use shell scripts, it is probably something like:
diff --git a/run-command.c b/run-command.c index a476999..ccfccf0 100644 --- a/run-command.c +++ b/run-command.c @@ -812,6 +812,7 @@ int run_hook_ve(const char *const *env, const char *name, va_list args) if (!p) return 0; + argv_array_push(&hook.args, "/bin/sh"); argv_array_push(&hook.args, p); while ((p = va_arg(args, const char *))) argv_array_push(&hook.args, p); -Peff