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: Noam Postavsky <npostavs@users.sourceforge.net>, git@vger.kernel.org
Subject: Re: git-credential-cache--daemon quits on SIGHUP, can we change it to ignore instead?
Date: Mon, 26 Oct 2015 17:50:16 -0400	[thread overview]
Message-ID: <20151026215016.GA17419@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqqfv0ylwa7.fsf@gitster.mtv.corp.google.com>

On Sun, Oct 25, 2015 at 09:58:56AM -0700, Junio C Hamano wrote:

> >>> I cannot speak for the person who was primarily responsible for
> >>> designing this behaviour, but I happen to agree with the current
> >>> behaviour in the situation where it was designed to be used.  Upon
> >>> the first use in your session, the "daemon" is auto-spawned, you can
> >>> keep talking with that same instance during your session, and you do
> >>> not have to do anything special to shut it down when you log out.
> >>> Isn't that what happens here?
> >>
> >> After looking at this some more, I've discovered this is NOT what
> >> actually happens here. If I "git push" from a shell and then log out
> >> and log in again, another "git push" does NOT ask me for a password.
> >> In other words, the daemon is NOT shut down automatically when I log
> >> out. Given that, does it make sense to change the daemon to ignore
> >> SIGHUP, or is there some way to change it so that it does exit on
> >> logout?
> 
> I have a feeling that it would be moving in a wrong direction to
> change the code to ignore HUP, as I do think "logout to shutdown"
> would be the desired behaviour.  If you are not seeing that happen,
> perhaps the first thing to do is to figure out why and fix the code
> so that it happens?
> 
> I dunno.  I'll cc Peff so that he can take a look when he comes
> back.

I could see it going both ways.

If SIGHUP means "I am logging out, my session is over", then I agree it
makes sense to drop any credentials. And that is what SIGHUP meant when
people logged in through hard-wired terminals.

But these days, people often have several simultaneous sessions open.
They may have multiple ssh sessions to a single machine, or they may
have a bunch of terminal windows open, each of which has a login shell
and will send HUP to its children when it exits. In that case, you have
a meta-session surrounding those individual terminal sessions, and you
probably do want to keep the cache going as long as the meta session[1].

This is all further complicated by bash's huponexit option, which I
think is off by default. So I, for example, have never noticed this
behavior even with multiple xterms, because my cache never actually gets
SIGHUP.  I don't know what shell Noam is using, but I wonder if tweaking
that option (or a similar one if not bash) might be helpful to signal
"let this stuff keep running even after I exit".

But I am also not opposed to making it configurable somehow in git, if
there really are two cases that cannot otherwise be distinguished.

-Peff

[1] Of course we have no idea when that meta-session is closed. But if
    you have a script that runs on X logout, for instance, you could put
    "git credential-cache exit" in it.

  reply	other threads:[~2015-10-26 21:50 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-10 16:45 git-credential-cache--daemon quits on SIGHUP, can we change it to ignore instead? Noam Postavsky
2015-10-18 15:15 ` Noam Postavsky
2015-10-18 17:58   ` Junio C Hamano
2015-10-19  0:51     ` Noam Postavsky
2015-10-21  2:35     ` Noam Postavsky
2015-10-24 21:47       ` Noam Postavsky
2015-10-25 16:58         ` Junio C Hamano
2015-10-26 21:50           ` Jeff King [this message]
2015-10-27  0:50             ` Noam Postavsky
2015-10-27 18:41               ` Jeff King
2015-10-27 19:04                 ` Junio C Hamano
2015-10-27 17:52             ` Junio C Hamano
2015-10-27 18:47               ` Jeff King
2015-10-28  3:46                 ` Noam Postavsky
2015-10-30  0:10                   ` Jeff King
2015-10-30  0:43                     ` Noam Postavsky
2015-10-30  0:50                       ` Jeff King
2015-10-30  1:20                         ` Noam Postavsky
2015-10-30 21:08                           ` Jeff King
2015-11-09  2:58                             ` Noam Postavsky
2015-11-09 15:53                               ` Jeff King
2015-11-10  1:05                                 ` Noam Postavsky
2015-11-10 12:25                                   ` Jeff King
2015-11-10 12:26                                     ` Jeff King
2015-11-11  0:22                                       ` Noam Postavsky
2015-12-04 18:55                                     ` Junio C Hamano
2015-12-04 19:06                                       ` Jeff King
2015-12-04 20:05                                         ` Junio C Hamano
2015-12-04 23:25                                           ` Jeff King

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=20151026215016.GA17419@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=npostavs@users.sourceforge.net \
    /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).