git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git-daemon: have --no-syslog

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 23, 2013, 06:21 UTC
Message-ID
<7v38s9jqk0.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20130622174122.GA6496@inner.h.apk.li>
Andreas Krey <a.krey@gmx.de> writes:
Show 6 quoted lines
> Some people run inetds that collect stderr of the spawned programs.
> Give them 'git-daemon --inetd --no-syslog' to keep error output
> on stderr.
>
> Signed-off-by: Andreas Krey <a.krey@gmx.de>
> ---

Are there examples of other daemon programs outside Git that have this particular support to help such inetd implementations?

I would like to know how widely this kind of workaround is done, and also what they call the option, as a quick sanity check.

Thanks.
Show 72 quoted lines
>  Documentation/git-daemon.txt |  4 ++++
>  daemon.c                     | 14 +++++++++++---
>  2 files changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/git-daemon.txt b/Documentation/git-daemon.txt
> index 223f731..007d3fc 100644
> --- a/Documentation/git-daemon.txt
> +++ b/Documentation/git-daemon.txt
> @@ -113,6 +113,10 @@ OPTIONS
>  	Log to syslog instead of stderr. Note that this option does not imply
>  	--verbose, thus by default only error conditions will be logged.
>  
> +--no-syslog::
> +	Disable the implicit --syslog of --inetd and --deatch, thus keeping
> +	error output on stderr.
> +
>  --user-path::
>  --user-path=<path>::
>  	Allow {tilde}user notation to be used in requests.  When
> diff --git a/daemon.c b/daemon.c
> index 6aeddcb..2f5d5bf 100644
> --- a/daemon.c
> +++ b/daemon.c
> @@ -1196,7 +1196,6 @@ int main(int argc, char **argv)
>  		}
>  		if (!strcmp(arg, "--inetd")) {
>  			inetd_mode = 1;
> -			log_syslog = 1;
>  			continue;
>  		}
>  		if (!strcmp(arg, "--verbose")) {
> @@ -1207,6 +1206,10 @@ int main(int argc, char **argv)
>  			log_syslog = 1;
>  			continue;
>  		}
> +		if (!strcmp(arg, "--no-syslog")) {
> +			log_syslog = -1;
> +			continue;
> +		}
>  		if (!strcmp(arg, "--export-all")) {
>  			export_all_trees = 1;
>  			continue;
> @@ -1263,7 +1266,6 @@ int main(int argc, char **argv)
>  		}
>  		if (!strcmp(arg, "--detach")) {
>  			detach = 1;
> -			log_syslog = 1;
>  			continue;
>  		}
>  		if (!prefixcmp(arg, "--user=")) {
> @@ -1309,6 +1311,12 @@ int main(int argc, char **argv)
>  		usage(daemon_usage);
>  	}
>  
> +	if ((inetd_mode || detach) && log_syslog == 0)
> +		log_syslog = 1;
> +
> +	if (log_syslog == -1)
> +		log_syslog = 0;
> +
>  	if (log_syslog) {
>  		openlog("git-daemon", LOG_PID, LOG_DAEMON);
>  		set_die_routine(daemon_die);
> @@ -1337,7 +1345,7 @@ int main(int argc, char **argv)
>  		die("base-path '%s' does not exist or is not a directory",
>  		    base_path);
>  
> -	if (inetd_mode) {
> +	if (inetd_mode && log_syslog) {
>  		if (!freopen("/dev/null", "w", stderr))
>  			die_errno("failed to redirect stderr to /dev/null");
>  	}
Previous: Andreas KreyNext: Andreas Krey
Message 2 of 4 in “git-daemon: have --no-syslog”
  1. git-daemon: have --no-syslogAndreas Krey, Jun 22, 2013
  2. Junio C HamanoJun 23, 2013
  3. Andreas KreyJul 1, 2013
  4. Eric SunshineJun 23, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.