Re: git-daemon problem

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Junio C Hamano
Date: Wednesday, July 12, 2006 - 10:44 pm

Matthias Lederhofer <matled@gmx.net> writes:


Hmph.  In the part of my message you did not quote:

	$ git-daemon 0<&- 1>&- 2>&- --export-all /pub/git

leaves listening sockets at fd 0/1 without any fd 2, and

	$ git-daemon 2>&- --export-all /pub/git

allocates listening socket at FD 2 (because FD 0 and FD 1 are
occupied).

Now, after we do accept(), we spawn a subprocess in handle(),
and in the child process dup2() the fd connected to the peer to
fd 0 and 1 of the child process -- and we do not do anything to
fd 2 of the child process.  So in the latter case, my tentative
patch would write error message to the listening socket -- ugh.

And as you say, fd 2 might be connected to the terminal and
healthy when you start the daemon, but later you can close the
terminal, so there is no sane place for us to try anything
sensible.

The only "right" solution I could think of is to properly
daemonize git-daemon when not running under --inetd mode.  Close
and open /dev/null the low three fds, and dissociate the process
from the controlling terminal (did I forget anything else --
perhaps chdir("/") at the top?).  And we keep the current
behaviour of assuming the sane set of low three fds when a new
option --debug is given to help people look at its stderr.  The
tentative patch to upload-pack would become moot at that point.

Hmm?

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
git-daemon problem, Matthias Lederhofer, (Tue Jul 11, 3:24 pm)
Re: git-daemon problem, Junio C Hamano, (Tue Jul 11, 4:04 pm)
Re: git-daemon problem, Junio C Hamano, (Tue Jul 11, 4:32 pm)
Re: git-daemon problem, Junio C Hamano, (Tue Jul 11, 9:42 pm)
Re: git-daemon problem, Matthias Lederhofer, (Wed Jul 12, 12:28 pm)
Re: git-daemon problem, Junio C Hamano, (Wed Jul 12, 10:44 pm)
Re: git-daemon problem, Matthias Lederhofer, (Thu Jul 13, 12:42 am)
[PATCH 1/5] daemon: use a custom die routine with syslog, Matthias Lederhofer, (Thu Jul 13, 3:02 am)
[PATCH 2/5] daemon: if one of the standard fds is missing ..., Matthias Lederhofer, (Thu Jul 13, 3:10 am)
[PATCH 5/5] daemon: new option --detach to run git-daemon ..., Matthias Lederhofer, (Thu Jul 13, 3:32 am)
[PATCH 3/5] upload-pack: ignore write errors to stderr, Matthias Lederhofer, (Thu Jul 13, 4:07 am)
Re: git-daemon problem, Andre Noll, (Thu Jul 13, 4:42 am)
Re: git-daemon problem, Matthias Lederhofer, (Thu Jul 13, 4:51 am)
Re: [PATCH 2/5] daemon: if one of the standard fds is miss ..., Matthias Lederhofer, (Thu Jul 13, 7:04 am)
Re: [PATCH 2/5] daemon: if one of the standard fds is miss ..., Matthias Lederhofer, (Thu Jul 13, 9:03 am)
[PATCH 2.1/5] daemon: if one of the standard fds is missin ..., Matthias Lederhofer, (Thu Jul 13, 9:32 am)
Re: [PATCH 5.1/5] daemon: new option --detach to run git-d ..., Matthias Lederhofer, (Thu Jul 13, 9:47 am)
[PATCH] daemon: documentation for --reuseaddr, --detach an ..., Matthias Lederhofer, (Fri Jul 14, 8:53 am)