On Sun, Oct 18, 2015 at 1:58 PM, Junio C Hamano <gitster@xxxxxxxxx> 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 don't understand why this happens, but the attached self-contained pair of programs demonstrate the behaviour: If I do make call-note-sighup note-sighup urxvt -e ./call-note-sighup ; cat note-sighup sighup.log DOES contain "got sighup", but if I instead do make call-note-sighup note-sighup ./call-note-sighup ; exit afterwards sighup.log does NOT contain "got sighup" (and I must do "pkill note-sighup" to get rid of the lingering note-sighup process).
#include <stdio.h> #include <unistd.h> int main(void) { remove("sighup.log"); int pid = fork(); if (pid < 0) { perror("fork"); return 1; } else if (pid == 0) { execl("./note-sighup", "./note-sighup", NULL); perror("execl(./note-sighup)"); return 1; } else { fprintf(stderr, "waiting for sigup.log to appear\n"); while (!access("sighup.log", F_OK)) { } fprintf(stderr, "okay, note-sighup.log has arrived, exiting in 5 seconds...\n"); sleep(5); } return 0; }
#include <unistd.h> #include <stdio.h> #include <string.h> #include <signal.h> static volatile int got_sighup = 0; void sighup_handler(int sig) { got_sighup = 1; } int main(void) { struct sigaction act; memset(&act, 0, sizeof act); act.sa_handler = sighup_handler; sigaction(SIGHUP, &act, NULL); FILE* out = fopen("sighup.log", "w"); setbuf(out, NULL); fprintf(out, "starting note-sighup\n"); for (;;) { sleep(1000); if (got_sighup) { got_sighup = 0; fprintf(out, "got sighup\n"); } } return 0; }