git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: M Hickford via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org, M Hickford <mirth.hickford@gmail.com>
Subject: Re: [PATCH] Documentation: clarify that cache forgets credentials if the system restarts
Date: Wed, 21 Dec 2022 21:41:11 -0500	[thread overview]
Message-ID: <Y6PDx7Ij4NA/kBB7@coredump.intra.peff.net> (raw)
In-Reply-To: <xmqqo7rxror4.fsf@gitster.g>

On Wed, Dec 21, 2022 at 08:15:59PM +0900, Junio C Hamano wrote:

> This is not a new issue, but I am not sure if "never touch the disk"
> is a honest thing to say (I know there is no "write this in a file"
> done by the cache daemon, but the running daemon can be swapped out
> and I do not think we do anything to prevent the in-core structure
> credential_cache_entry from getting written to the swap.

Right, we don't do anything like mlock(), mostly because of the
portability problems (though obviously we could make an optional
wrapper, which is strictly better than the status quo). On the other
hand, neither does git itself, so we're only holding credential-cache to
the same standard. Arguably the cache holds credentials longer, but a
fetch or push may run for quite a while bottle-necked on network or pack
generation/indexing (and both of those operations create memory pressure
which may trigger swap).

But I agree that it is more accurate to say "does not touch the
filesystem" or your "instead of written to a file".

> Taking all of the above together, perhaps something like this?
> 
>     ... caches credentials for use by future Git programs.  The
>     stored credentials are kept in memory of the cache-daemon
>     process (instead of written to a file) and are forgotten after a
>     configuarble timeout.  The cache-daemon dies with the cached
>     credentials upon a system shutdown/restart, or when it receives
>     SIGHUP (i.e. by logging out, you disconnect from the terminal
>     the daemon was started from); the latter can be disabled with
>     credentialCache.ignoreSIGHUP configuration.  The cache is
>     accessible over a Unix domain socket, ...

That seems reasonable. I was going to suggest also mentioning that we
can ask the daemon to exit manually, but that is pretty well covered
later in the document. On the other hand, it may make sense to put all
of this together in the description.

As brian mentioned, not every system behaves the same with respect to
SIGHUP here. So we may need to be a little more vague here.

So maybe more like:

  ...are forgotten after a configurable timeout, or if the daemon exits.

  You can ask the daemon to exit manually, forgetting all cached
  credentials before their timeout, by running:

    git credential-cache exit

  The daemon will also exit when it receives a signal. Depending on the
  configuration of your system, this may happen automatically when you
  log out. If you want to inhibit this behavior (and let items time out
  as normal even when you're logged out), you can set the
  credentialCache.ignoreSIGHUP configuration variable to `true`.

There are many possible variations, of course. I was mostly just trying
to get across the point that:

  - there are several ways for the daemon to exit

  - sighup / logout handling may depend on your system

And I am happy with any text that says so.

-Peff

  reply	other threads:[~2022-12-22  2:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-21  8:23 [PATCH] Documentation: clarify that cache forgets credentials if the system restarts M Hickford via GitGitGadget
2022-12-21 11:15 ` Junio C Hamano
2022-12-22  2:41   ` Jeff King [this message]
2023-01-28 20:08     ` M Hickford
2022-12-21 22:09 ` brian m. carlson
2023-01-28 20:09 ` [PATCH v2] " M Hickford via GitGitGadget
2023-01-28 20:13   ` [PATCH v3] " M Hickford via GitGitGadget
2023-01-29  6:48     ` Jeff King
2023-01-29 17:26       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y6PDx7Ij4NA/kBB7@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    --cc=mirth.hickford@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).