All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix condition for redirecting stderr
@ 2018-04-03 22:13 Lucas Werkmeister
  2018-04-09  2:23 ` Todd Zullinger
  0 siblings, 1 reply; 3+ messages in thread
From: Lucas Werkmeister @ 2018-04-03 22:13 UTC (permalink / raw)
  To: git
  Cc: Lucas Werkmeister, Ævar Arnfjörð Bjarmason,
	Junio C Hamano, Eric Sunshine

Since the --log-destination option was added in 0c591cacb ("daemon: add
--log-destination=(stderr|syslog|none)", 2018-02-04) with the explicit
goal of allowing logging to stderr when running in inetd mode, we should
not always redirect stderr to /dev/null in inetd mode, but rather only
when stderr is not being used for logging.

Signed-off-by: Lucas Werkmeister <mail@lucaswerkmeister.de>
---

Notes:
    I have to apologize to the list here… even though I proposed this
    option with the goal of using it on my server, for some reason I
    decided to only use it there after the next Git release had come
    out, and didn’t test it anywhere else. The code looked okay, but I
    missed this part near the end of daemon.c that made it ineffective,
    rendering the feature broken in the 2.17.0 release and making me
    look like an idiot :/ sorry, everyone.
    
    For what it’s worth, with this fix the feature appears to work as
    intended (I *have* tested it on my server now and log messages from
    git-daemon show up in the journal as intended, attributed to the
    correct unit and everything).

 daemon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/daemon.c b/daemon.c
index fe833ea7d..9d2e0d20e 100644
--- a/daemon.c
+++ b/daemon.c
@@ -1459,7 +1459,7 @@ int cmd_main(int argc, const char **argv)
 		die("base-path '%s' does not exist or is not a directory",
 		    base_path);
 
-	if (inetd_mode) {
+	if (log_destination != LOG_DESTINATION_STDERR) {
 		if (!freopen("/dev/null", "w", stderr))
 			die_errno("failed to redirect stderr to /dev/null");
 	}
-- 
2.16.3


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

* Re: [PATCH] Fix condition for redirecting stderr
  2018-04-03 22:13 [PATCH] Fix condition for redirecting stderr Lucas Werkmeister
@ 2018-04-09  2:23 ` Todd Zullinger
  2018-04-09 20:09   ` Lucas Werkmeister
  0 siblings, 1 reply; 3+ messages in thread
From: Todd Zullinger @ 2018-04-09  2:23 UTC (permalink / raw)
  To: Lucas Werkmeister
  Cc: git, Ævar Arnfjörð Bjarmason, Junio C Hamano,
	Eric Sunshine

Lucas Werkmeister wrote:
> Since the --log-destination option was added in 0c591cacb ("daemon: add
> --log-destination=(stderr|syslog|none)", 2018-02-04) with the explicit
> goal of allowing logging to stderr when running in inetd mode, we should
> not always redirect stderr to /dev/null in inetd mode, but rather only
> when stderr is not being used for logging.

Perhaps 's/^F/daemon: f/' on the subject?  (Junio may well
already have done so while queueing locally.)

The patch itself looks reasonable (to my relatively untrained eyes).

-- 
Todd
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Hardware:  the parts of a computer that can be kicked.
    -- Jeff Pesis


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

* Re: [PATCH] Fix condition for redirecting stderr
  2018-04-09  2:23 ` Todd Zullinger
@ 2018-04-09 20:09   ` Lucas Werkmeister
  0 siblings, 0 replies; 3+ messages in thread
From: Lucas Werkmeister @ 2018-04-09 20:09 UTC (permalink / raw)
  To: Todd Zullinger; +Cc: git

On 09.04.2018 04:23, Todd Zullinger wrote:
> Lucas Werkmeister wrote:
>> Since the --log-destination option was added in 0c591cacb ("daemon: add
>> --log-destination=(stderr|syslog|none)", 2018-02-04) with the explicit
>> goal of allowing logging to stderr when running in inetd mode, we should
>> not always redirect stderr to /dev/null in inetd mode, but rather only
>> when stderr is not being used for logging.
> 
> Perhaps 's/^F/daemon: f/' on the subject?  (Junio may well
> already have done so while queueing locally.)

Indeed, sorry! Looks like Junio fixed it on his end (going by the
“what’s cooking” email), so I won’t reroll. (But I can at least set up a
local commit-msg hook to make sure I don’t forget the subject area again.)

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

end of thread, other threads:[~2018-04-09 20:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-03 22:13 [PATCH] Fix condition for redirecting stderr Lucas Werkmeister
2018-04-09  2:23 ` Todd Zullinger
2018-04-09 20:09   ` Lucas Werkmeister

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.