{"thread":{"id":"34253","subject":"[PATCH] git-daemon: have --no-syslog","startedAt":"2013-06-22T17:41:22Z","lastAt":"2013-07-01T20:04:19Z","messageCount":4,"participants":["Andreas Krey","Junio C Hamano","Eric Sunshine"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"221697","messageId":"20130622174122.GA6496@inner.h.apk.li","threadId":"34253","inReplyTo":null,"subject":"[PATCH] git-daemon: have --no-syslog","fromName":"Andreas Krey","fromEmail":"a.krey@gmx.de","sentAt":"2013-06-22T17:41:22Z","receivedAt":"2013-06-22T17:41:22Z","isPatch":true,"sender":{"key":"a.krey@gmx.de","avatar":"https://avatars.githubusercontent.com/u/37810?v=4"},"body":"Some people run inetds that collect stderr of the spawned programs.\nGive them 'git-daemon --inetd --no-syslog' to keep error output\non stderr.\n\nSigned-off-by: Andreas Krey <a.krey@gmx.de>\n---\n Documentation/git-daemon.txt |  4 ++++\n daemon.c                     | 14 +++++++++++---\n 2 files changed, 15 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-daemon.txt b/Documentation/git-daemon.txt\nindex 223f731..007d3fc 100644\n--- a/Documentation/git-daemon.txt\n+++ b/Documentation/git-daemon.txt\n@@ -113,6 +113,10 @@ OPTIONS\n \tLog to syslog instead of stderr. Note that this option does not imply\n \t--verbose, thus by default only error conditions will be logged.\n \n+--no-syslog::\n+\tDisable the implicit --syslog of --inetd and --deatch, thus keeping\n+\terror output on stderr.\n+\n --user-path::\n --user-path=<path>::\n \tAllow {tilde}user notation to be used in requests.  When\ndiff --git a/daemon.c b/daemon.c\nindex 6aeddcb..2f5d5bf 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -1196,7 +1196,6 @@ int main(int argc, char **argv)\n \t\t}\n \t\tif (!strcmp(arg, \"--inetd\")) {\n \t\t\tinetd_mode = 1;\n-\t\t\tlog_syslog = 1;\n \t\t\tcontinue;\n \t\t}\n \t\tif (!strcmp(arg, \"--verbose\")) {\n@@ -1207,6 +1206,10 @@ int main(int argc, char **argv)\n \t\t\tlog_syslog = 1;\n \t\t\tcontinue;\n \t\t}\n+\t\tif (!strcmp(arg, \"--no-syslog\")) {\n+\t\t\tlog_syslog = -1;\n+\t\t\tcontinue;\n+\t\t}\n \t\tif (!strcmp(arg, \"--export-all\")) {\n \t\t\texport_all_trees = 1;\n \t\t\tcontinue;\n@@ -1263,7 +1266,6 @@ int main(int argc, char **argv)\n \t\t}\n \t\tif (!strcmp(arg, \"--detach\")) {\n \t\t\tdetach = 1;\n-\t\t\tlog_syslog = 1;\n \t\t\tcontinue;\n \t\t}\n \t\tif (!prefixcmp(arg, \"--user=\")) {\n@@ -1309,6 +1311,12 @@ int main(int argc, char **argv)\n \t\tusage(daemon_usage);\n \t}\n \n+\tif ((inetd_mode || detach) && log_syslog == 0)\n+\t\tlog_syslog = 1;\n+\n+\tif (log_syslog == -1)\n+\t\tlog_syslog = 0;\n+\n \tif (log_syslog) {\n \t\topenlog(\"git-daemon\", LOG_PID, LOG_DAEMON);\n \t\tset_die_routine(daemon_die);\n@@ -1337,7 +1345,7 @@ int main(int argc, char **argv)\n \t\tdie(\"base-path '%s' does not exist or is not a directory\",\n \t\t    base_path);\n \n-\tif (inetd_mode) {\n+\tif (inetd_mode && log_syslog) {\n \t\tif (!freopen(\"/dev/null\", \"w\", stderr))\n \t\t\tdie_errno(\"failed to redirect stderr to /dev/null\");\n \t}\n-- \n1.8.3.1.485.g9704416.dirty\n"},{"id":"221702","messageId":"7v38s9jqk0.fsf@alter.siamese.dyndns.org","threadId":"34253","inReplyTo":"20130622174122.GA6496@inner.h.apk.li","subject":"Re: [PATCH] git-daemon: have --no-syslog","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-23T06:21:03Z","receivedAt":"2013-06-23T06:21:03Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andreas Krey <a.krey@gmx.de> writes:\n\n> Some people run inetds that collect stderr of the spawned programs.\n> Give them 'git-daemon --inetd --no-syslog' to keep error output\n> on stderr.\n>\n> Signed-off-by: Andreas Krey <a.krey@gmx.de>\n> ---\n\nAre there examples of other daemon programs outside Git that have\nthis particular support to help such inetd implementations?\n\nI would like to know how widely this kind of workaround is done, and\nalso what they call the option, as a quick sanity check.\n\nThanks.\n\n>  Documentation/git-daemon.txt |  4 ++++\n>  daemon.c                     | 14 +++++++++++---\n>  2 files changed, 15 insertions(+), 3 deletions(-)\n>\n> diff --git a/Documentation/git-daemon.txt b/Documentation/git-daemon.txt\n> index 223f731..007d3fc 100644\n> --- a/Documentation/git-daemon.txt\n> +++ b/Documentation/git-daemon.txt\n> @@ -113,6 +113,10 @@ OPTIONS\n>  \tLog to syslog instead of stderr. Note that this option does not imply\n>  \t--verbose, thus by default only error conditions will be logged.\n>  \n> +--no-syslog::\n> +\tDisable the implicit --syslog of --inetd and --deatch, thus keeping\n> +\terror output on stderr.\n> +\n>  --user-path::\n>  --user-path=<path>::\n>  \tAllow {tilde}user notation to be used in requests.  When\n> diff --git a/daemon.c b/daemon.c\n> index 6aeddcb..2f5d5bf 100644\n> --- a/daemon.c\n> +++ b/daemon.c\n> @@ -1196,7 +1196,6 @@ int main(int argc, char **argv)\n>  \t\t}\n>  \t\tif (!strcmp(arg, \"--inetd\")) {\n>  \t\t\tinetd_mode = 1;\n> -\t\t\tlog_syslog = 1;\n>  \t\t\tcontinue;\n>  \t\t}\n>  \t\tif (!strcmp(arg, \"--verbose\")) {\n> @@ -1207,6 +1206,10 @@ int main(int argc, char **argv)\n>  \t\t\tlog_syslog = 1;\n>  \t\t\tcontinue;\n>  \t\t}\n> +\t\tif (!strcmp(arg, \"--no-syslog\")) {\n> +\t\t\tlog_syslog = -1;\n> +\t\t\tcontinue;\n> +\t\t}\n>  \t\tif (!strcmp(arg, \"--export-all\")) {\n>  \t\t\texport_all_trees = 1;\n>  \t\t\tcontinue;\n> @@ -1263,7 +1266,6 @@ int main(int argc, char **argv)\n>  \t\t}\n>  \t\tif (!strcmp(arg, \"--detach\")) {\n>  \t\t\tdetach = 1;\n> -\t\t\tlog_syslog = 1;\n>  \t\t\tcontinue;\n>  \t\t}\n>  \t\tif (!prefixcmp(arg, \"--user=\")) {\n> @@ -1309,6 +1311,12 @@ int main(int argc, char **argv)\n>  \t\tusage(daemon_usage);\n>  \t}\n>  \n> +\tif ((inetd_mode || detach) && log_syslog == 0)\n> +\t\tlog_syslog = 1;\n> +\n> +\tif (log_syslog == -1)\n> +\t\tlog_syslog = 0;\n> +\n>  \tif (log_syslog) {\n>  \t\topenlog(\"git-daemon\", LOG_PID, LOG_DAEMON);\n>  \t\tset_die_routine(daemon_die);\n> @@ -1337,7 +1345,7 @@ int main(int argc, char **argv)\n>  \t\tdie(\"base-path '%s' does not exist or is not a directory\",\n>  \t\t    base_path);\n>  \n> -\tif (inetd_mode) {\n> +\tif (inetd_mode && log_syslog) {\n>  \t\tif (!freopen(\"/dev/null\", \"w\", stderr))\n>  \t\t\tdie_errno(\"failed to redirect stderr to /dev/null\");\n>  \t}\n"},{"id":"221716","messageId":"CAPig+cSjEJDYVjnx1kzUuP3=1-tc3criw=H=bN03ZAQg+dhpfQ@mail.gmail.com","threadId":"34253","inReplyTo":"20130622174122.GA6496@inner.h.apk.li","subject":"Re: [PATCH] git-daemon: have --no-syslog","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-06-23T09:16:45Z","receivedAt":"2013-06-23T09:16:45Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sat, Jun 22, 2013 at 1:41 PM, Andreas Krey <a.krey@gmx.de> wrote:\n> diff --git a/Documentation/git-daemon.txt b/Documentation/git-daemon.txt\n> index 223f731..007d3fc 100644\n> --- a/Documentation/git-daemon.txt\n> +++ b/Documentation/git-daemon.txt\n> @@ -113,6 +113,10 @@ OPTIONS\n>         Log to syslog instead of stderr. Note that this option does not imply\n>         --verbose, thus by default only error conditions will be logged.\n>\n> +--no-syslog::\n> +       Disable the implicit --syslog of --inetd and --deatch, thus keeping\n\ns/deatch/detach/\n\n> +       error output on stderr.\n> +\n>  --user-path::\n>  --user-path=<path>::\n>         Allow {tilde}user notation to be used in requests.  When\n"},{"id":"222301","messageId":"20130701200419.GA22234@inner.h.apk.li","threadId":"34253","inReplyTo":"7v38s9jqk0.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] git-daemon: have --no-syslog","fromName":"Andreas Krey","fromEmail":"a.krey@gmx.de","sentAt":"2013-07-01T20:04:19Z","receivedAt":"2013-07-01T20:04:19Z","isPatch":true,"sender":{"key":"a.krey@gmx.de","avatar":"https://avatars.githubusercontent.com/u/37810?v=4"},"body":"On Sat, 22 Jun 2013 23:21:03 +0000, Junio C Hamano wrote:\n...\n> Are there examples of other daemon programs outside Git that have\n> this particular support to help such inetd implementations?\n\nUnfortunately I only know one server that exclusively uses this\ninterface, and isn't even capable of running under inetd.\n\n> I would like to know how widely this kind of workaround is done, and\n> also what they call the option, as a quick sanity check.\n\nThe only open-source inetd-like server I know of that does this is Dan\nBernstein's tcpserver (which also passes the remote IP addresse and simile\nin envvars), and it's probably more to the point to introduce\na --tcpserver in parallel to --inetd instead of doing --no-syslog.\n\nAndreas\n\n-- \n\"Totally trivial. Famous last words.\"\nFrom: Linus Torvalds <torvalds@*.org>\nDate: Fri, 22 Jan 2010 07:29:21 -0800\n"}]}