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

Re: Fwd: Fwd: git-daemon access-hook race condition

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 12, 2013, 22:20 UTC
Message-ID
<xmqqa9jhof6k.fsf@gitster.dls.corp.google.com>
In-Reply-To
<xmqqioy5oiif.fsf@gitster.dls.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 19 quoted lines
> Eugene Sajine <euguess@gmail.com> writes:
>
>> So are you really sure that it is a non-starter to have
>> --before-service/--after-service options for access-hook?
>
> Given the definition of "--access-hook" in "git help daemon":
>
>     --access-hook=<path>::
>             Every time a client connects, first run an external command
>             specified by the <path> ... The external command can decide
>             to decline the service by exiting with a non-zero status (or
>             to allow it by exiting with a zero status)....
>
> There is *NO* way in anywhere --after-service makes any sense (and
> by definition --before-service is redundant).
>
> What you _could_ propose is to define a *new* hook that is run when
> the spawned service has returned, with the same information that is
> fed to the access hook (possibly with its exit status).
Scratch that "exit status" part, as I do not think it is useful.

To a receive-pack and a send-pack that is talking to it, if a push results in a failure, it is a failure. Likewise for upload-pack and fetch-pack for a transfer in the reverse direction.

And the way that failure is communicated from the receive-pack to the end-user via the send-pack is for the receive-pack to send a protocol message that tells the send-pack about the failure, and the send-pack showing the error message and signalling the failure with its exit status. Likewise for upload-pack and fetch-pack (hence "fetch", which is conceptually a thin wrapper around it).

Between the deamon and the receive-pack (or the fetch-pack) process, however, such a failed push (or fetch) is still a success. "I correctly diagnosed and successfully sent a rejection notice to the other end" is signalled by receive-pack to the daemon by exiting with success (i.e. 0) exit status.

So even if we feed the exit status of the service process to the hook script specified by the --post-service-hook, it does not tell the script if the service "succeeded" in that sense.

Previous: Eugene SajineNext: Eugene Sajine
Message 8 of 10 in “Fwd: git-daemon access-hook race condition”
  1. Eugene SajineSep 12, 2013
  2. Junio C HamanoSep 12, 2013
  3. Fwd: Fwd: git-daemon access-hook race conditionEugene Sajine, Sep 12, 2013
  4. Junio C HamanoSep 12, 2013
  5. Eugene SajineSep 12, 2013
  6. Eugene SajineSep 12, 2013
  7. Eugene SajineSep 13, 2013
  8. Junio C HamanoSep 12, 2013
  9. Eugene SajineSep 12, 2013
  10. Junio C HamanoSep 12, 2013

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.