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

Re: [PATCH v2] receive-pack: add option to interrupt pre-receive when client exits

From
Jiang Xin <worldhello.net@gmail.com>
Date
Jan 27, 2022, 03:21 UTC
Message-ID
<CANYiYbGME-=w4raiwW3w1_gHzVpsvdStz7xVpKqAwx2r_Vezzw@mail.gmail.com>
In-Reply-To
<20220126214438.3066132-1-robin.jarry@6wind.com>
On Thu, Jan 27, 2022 at 10:03 AM Robin Jarry <robin.jarry@6wind.com> wrote:
Show 5 quoted lines
> @@ -800,6 +806,19 @@ static void prepare_push_cert_sha1(struct child_process *proc)
>         }
>  }
>
> +static volatile pid_t hook_pid;
Can we use a flag instead of hook_pid to distinguish the source of the
SIGPIPE signal?
1. "pre-receive" hook exits early without consuming stdin.
2. "pre-receive" hook hangs after receiving commands from stdin, until
client quits by receiving a "ctrl-c".
Show 6 quoted lines
> +static void kill_hook(int signum)
> +{
> +       if (hook_pid != 0) {
> +               kill(hook_pid, signum);
> +               waitpid(hook_pid, NULL, 0);
> +               hook_pid = 0;

Can we let the signal handler in "pre-receive" to do it job? And we can show some user friendly error message here. E.g.:

    die("broken pipe: seems like the pre-receive hook exits early
without consuming its stdin");

-- Jiang Xin

Previous: Robin JarryNext: Robin Jarry
Message 5 of 20 in “receive-pack: interrupt pre-receive when client disconnects”
  1. receive-pack: interrupt pre-receive when client disconnectsRobin Jarry, Jan 25, 2022
  2. Jiang XinJan 26, 2022
  3. Robin JarryJan 26, 2022
  4. receive-pack: add option to interrupt pre-receive when client exitsRobin Jarry, Jan 26, 2022
  5. Jiang XinJan 27, 2022
  6. Robin JarryJan 27, 2022
  7. Junio C HamanoJan 27, 2022
  8. Robin JarryJan 27, 2022
  9. Junio C HamanoJan 27, 2022
  10. Robin JarryJan 27, 2022
  11. receive-pack: check if client is alive before completing the pushRobin Jarry, Jan 27, 2022
  12. Junio C HamanoJan 28, 2022
  13. Robin JarryJan 28, 2022
  14. Junio C HamanoJan 28, 2022
  15. Robin JarryJan 28, 2022
  16. receive-pack: check if client is alive before completing the pushRobin Jarry, Jan 28, 2022
  17. Ævar Arnfjörð BjarmasonFeb 4, 2022
  18. Junio C HamanoFeb 4, 2022
  19. Robin JarryFeb 7, 2022
  20. Junio C HamanoJan 27, 2022

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.