git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: hooks scripts and noexec partition

From
Jeff King <peff@peff.net>
Date
Jan 15, 2014, 09:16 UTC
Message-ID
<20140115091609.GC14335@sigill.intra.peff.net>
In-Reply-To
<CAJ1PRS=96aSp3GE+wj=zHX=JGfZbjUeiUuiDDvfJNuRhrbK_Yg@mail.gmail.com>
On Tue, Jan 14, 2014 at 04:41:03PM +0100, krzf83@gmail.com  wrote:
> git can't execute hooks no partitions mounted with noexec - even if
> those are just scripts with shebang line

Right. Git does not know that they are shell (or other) scripts; they could be anything, and the advertised interface is that git will run exec on them (and it is explicitly OK for them to exist but not be executable, and git takes this as a sign that they are inactive).

> and they actualy work by
> hooks/./post-comit (because I use small patch on kernel that allows
> running scripts that way on noexec partition)

If you are suggesting that git always execute them as "hooks/./$hook", that might make sense if such behavior is widespread. But it sounds like you are running a custom kernel patch to get around the noexec setting. Here is the custom git patch to match it. :)

diff --git a/run-command.c b/run-command.c
index 3914d9c..ae84e87 100644
--- a/run-command.c
+++ b/run-command.c
@@ -753,7 +753,7 @@ int finish_async(struct async *async)
 
 char *find_hook(const char *name)
 {
-	char *path = git_path("hooks/%s", name);
+	char *path = git_path("hooks/./%s", name);
 	if (access(path, X_OK) < 0)
 		path = NULL;
 

-Peff
Previous: krzf83@gmail.comNext: krzf83@gmail.com
Message 2 of 4 in “hooks scripts and noexec partition”
  1. krzf83@gmail.comJan 14, 2014
  2. Jeff KingJan 15, 2014
  3. krzf83@gmail.comDec 14, 2014
  4. Jeff KingDec 17, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.