public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] http-backend: write newlines to stderr when responding with errors
@ 2026-01-08 22:59 KJ Tsanaktsidis
  2026-01-11 18:25 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: KJ Tsanaktsidis @ 2026-01-08 22:59 UTC (permalink / raw)
  To: git; +Cc: KJ Tsanaktsidis, KJ Tsanaktsidis, Junio C Hamano

From: KJ Tsanaktsidis <kjtsanaktsidis@groq.com>

The not_found and forbidden methods currently do not write a newline to
stderr after the error message. This means that if git-http-backend is
invoked through something like fcgiwrap, and the stderr of that fcgiwrap
process is sent to a logging daemon (e.g. journald), the error messages
of several git-http-backend invocations will just get strung together,
e.g.

> Not a git repository: '/var/lib/git/foo.git'Not a git repository: '/var/lib/git/foo.git'Not a git repository: '/var/lib/git/foo.git'

I think it's git-http-backend's responsibility to format these messages
properly, rather than it being fcgiwrap's job to notice that the script
didn't terminate stderr with a newline and do so itself.

Signed-off-by: KJ Tsanaktsidis <kj@kjtsanaktsidis.id.au>
---
 http-backend.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/http-backend.c b/http-backend.c
index 52f0483dd3..bda8bb91e1 100644
--- a/http-backend.c
+++ b/http-backend.c
@@ -143,8 +143,10 @@ static NORETURN void not_found(struct strbuf *hdr, const char *err, ...)
 	end_headers(hdr);
 
 	va_start(params, err);
-	if (err && *err)
+	if (err && *err) {
 		vfprintf(stderr, err, params);
+		fprintf(stderr, "\n");
+	}
 	va_end(params);
 	exit(0);
 }
@@ -159,8 +161,10 @@ static NORETURN void forbidden(struct strbuf *hdr, const char *err, ...)
 	end_headers(hdr);
 
 	va_start(params, err);
-	if (err && *err)
+	if (err && *err) {
 		vfprintf(stderr, err, params);
+		fprintf(stderr, "\n");
+	}
 	va_end(params);
 	exit(0);
 }
-- 
2.51.2


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

end of thread, other threads:[~2026-01-12  1:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-08 22:59 [PATCH] http-backend: write newlines to stderr when responding with errors KJ Tsanaktsidis
2026-01-11 18:25 ` Junio C Hamano
2026-01-12  1:44   ` [PATCH v2] " KJ Tsanaktsidis
2026-01-12  1:47   ` [PATCH] " KJ Tsanaktsidis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox