git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] git-daemon: have --no-syslog
@ 2013-06-22 17:41 Andreas Krey
  2013-06-23  6:21 ` Junio C Hamano
  2013-06-23  9:16 ` Eric Sunshine
  0 siblings, 2 replies; 4+ messages in thread
From: Andreas Krey @ 2013-06-22 17:41 UTC (permalink / raw)
  To: Git List; +Cc: Junio C Hamano, Erik Faye-Lund

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>
---
 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");
 	}
-- 
1.8.3.1.485.g9704416.dirty

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] git-daemon: have --no-syslog
  2013-06-22 17:41 [PATCH] git-daemon: have --no-syslog Andreas Krey
@ 2013-06-23  6:21 ` Junio C Hamano
  2013-07-01 20:04   ` Andreas Krey
  2013-06-23  9:16 ` Eric Sunshine
  1 sibling, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2013-06-23  6:21 UTC (permalink / raw)
  To: Andreas Krey; +Cc: Git List, Erik Faye-Lund

Andreas Krey <a.krey@gmx.de> writes:

> 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.

>  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");
>  	}

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] git-daemon: have --no-syslog
  2013-06-22 17:41 [PATCH] git-daemon: have --no-syslog Andreas Krey
  2013-06-23  6:21 ` Junio C Hamano
@ 2013-06-23  9:16 ` Eric Sunshine
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Sunshine @ 2013-06-23  9:16 UTC (permalink / raw)
  To: Andreas Krey; +Cc: Git List, Junio C Hamano, Erik Faye-Lund

On Sat, Jun 22, 2013 at 1:41 PM, Andreas Krey <a.krey@gmx.de> wrote:
> 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

s/deatch/detach/

> +       error output on stderr.
> +
>  --user-path::
>  --user-path=<path>::
>         Allow {tilde}user notation to be used in requests.  When

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] git-daemon: have --no-syslog
  2013-06-23  6:21 ` Junio C Hamano
@ 2013-07-01 20:04   ` Andreas Krey
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Krey @ 2013-07-01 20:04 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git List, Erik Faye-Lund

On Sat, 22 Jun 2013 23:21:03 +0000, Junio C Hamano wrote:
...
> Are there examples of other daemon programs outside Git that have
> this particular support to help such inetd implementations?

Unfortunately I only know one server that exclusively uses this
interface, and isn't even capable of running under inetd.

> 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.

The only open-source inetd-like server I know of that does this is Dan
Bernstein's tcpserver (which also passes the remote IP addresse and simile
in envvars), and it's probably more to the point to introduce
a --tcpserver in parallel to --inetd instead of doing --no-syslog.

Andreas

-- 
"Totally trivial. Famous last words."
From: Linus Torvalds <torvalds@*.org>
Date: Fri, 22 Jan 2010 07:29:21 -0800

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-07-01 20:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-22 17:41 [PATCH] git-daemon: have --no-syslog Andreas Krey
2013-06-23  6:21 ` Junio C Hamano
2013-07-01 20:04   ` Andreas Krey
2013-06-23  9:16 ` Eric Sunshine

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).