Re: git-credential-cache--daemon quits on SIGHUP, can we change it to ignore instead?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 30, 2015 at 5:08 PM, Jeff King <peff@xxxxxxxx> wrote:
> Right. And not only is that hard to get right (I doubt, for example, you
> support the arbitrary "!" shell expressions that git does), but it's
> impossible to know for sure that will be needed, because you cannot know
> all possible helpers (I might even have a helper that is a shell snippet
> that calls credential-cache).

Yep, in that case the user would have to override the result of parsing.

>> Ah, maybe the missing piece I forgot to mention is that we could make
>> our pre/1st-helper be an emacsclient command, which would tell Emacs
>> to startup the daemon. So the daemon would be a subprocess of Emacs,
>> not "git push", thereby avoiding the SIGHUP. In our current workaround
>> we startup the daemon (if it's not running) before git commands that
>> we think are going to run credential helpers (i.e. "push", "pull",
>> "fetch"), hence my thought that it would be nicer if we only did that
>> before git is *actually* going to run the helpers.
>
> I don't think even git knows it will need a helper until it is actually
> ready to call one (e.g., it may depend on getting an HTTP 401 from the
> server).

Yes, so just call me first. :)

>
> I am leaning more towards ignoring SIGHUP (configurably) being the only
> really sane path forward. Do you want to try your hand at a patch?

Something like this?

diff --git i/credential-cache--daemon.c w/credential-cache--daemon.c
index eef6fce..e3f2612 100644
--- i/credential-cache--daemon.c
+++ w/credential-cache--daemon.c
@@ -256,6 +256,9 @@ int main(int argc, const char **argv)
         OPT_END()
     };

+    int ignore_sighup = 0;
+    git_config_get_bool("credential.cache.ignoreSighup", &ignore_sighup);
+
     argc = parse_options(argc, argv, NULL, options, usage, 0);
     socket_path = argv[0];

@@ -264,6 +267,12 @@ int main(int argc, const char **argv)

     check_socket_directory(socket_path);
     register_tempfile(&socket_file, socket_path);
+
+    if (ignore_sighup) {
+        sigchain_pop(SIGHUP);
+        signal(SIGHUP, SIG_IGN);
+    }
+
     serve_cache(socket_path, debug);
     delete_tempfile(&socket_file);
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]