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

[PATCH v3 09/23] remote-curl: accept empty line as terminator

From
Sverre Rabbelier <srabbelier@gmail.com>
Date
Jul 16, 2011, 13:03 UTC
Message-ID
<1310821424-4750-10-git-send-email-srabbelier@gmail.com>
In-Reply-To
<1310821424-4750-1-git-send-email-srabbelier@gmail.com>

This went unnoticed because the transport helper infrastructore did not check the return value of the helper, nor did the helper print anything before exiting.

While at it also make sure that the stream doesn't end unexpectedly.
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
---
  Added the 'check fo unexpected EOF' chunk.
 remote-curl.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/remote-curl.c b/remote-curl.c
index b5be25c..30554f4 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -857,7 +857,14 @@ int main(int argc, const char **argv)
 	http_init(remote);
 
 	do {
-		if (strbuf_getline(&buf, stdin, '\n') == EOF)
+		if (strbuf_getline(&buf, stdin, '\n') == EOF) {
+			if (ferror(stdin))
+				fprintf(stderr, "Error reading command stream\n");
+			else
+				fprintf(stderr, "Unexpected end of command stream\n");
+			return 1;
+		}
+		if (buf.len == 0)
 			break;
 		if (!prefixcmp(buf.buf, "fetch ")) {
 			if (nongit)
@@ -897,6 +904,7 @@ int main(int argc, const char **argv)
 			printf("\n");
 			fflush(stdout);
 		} else {
+			fprintf(stderr, "Unknown command '%s'\n", buf.buf);
 			return 1;
 		}
 		strbuf_reset(&buf);
-- 
1.7.5.1.292.g728120
Previous: Sverre RabbelierNext: Sverre Rabbelier
Message 12 of 29 in “remote-helper improvements”
  1. 00/23 remote-helper improvementsSverre Rabbelier, Jul 16, 2011
  2. 01/23 transport-helper: fix minor leak in push_refs_with_exportSverre Rabbelier, Jul 16, 2011
  3. 02/23 t5800: factor out some ref testsSverre Rabbelier, Jul 16, 2011
  4. 03/23 t5800: use skip_all instead of prereqSverre Rabbelier, Jul 16, 2011
  5. 04/23 t5800: document some non-functional parts of remote helpersSverre Rabbelier, Jul 16, 2011
  6. 05/23 git-remote-testgit: import non-HEAD refsSverre Rabbelier, Jul 16, 2011
  7. 06/23 transport-helper: don't feed bogus refs to export pushSverre Rabbelier, Jul 16, 2011
  8. 07/23 git_remote_helpers: push all refs during a non-local exportSverre Rabbelier, Jul 16, 2011
  9. Junio C HamanoJul 17, 2011
  10. Sverre RabbelierJul 23, 2011
  11. 08/23 remote-helpers: export GIT_DIR variable to helpersSverre Rabbelier, Jul 16, 2011
  12. 09/23 remote-curl: accept empty line as terminatorSverre Rabbelier, Jul 16, 2011
  13. 10/23 git-remote-testgit: only push for non-local repositoriesSverre Rabbelier, Jul 16, 2011
  14. 11/23 git-remote-testgit: fix error handlingSverre Rabbelier, Jul 16, 2011
  15. 12/23 fast-import: introduce 'done' commandSverre Rabbelier, Jul 16, 2011
  16. 13/23 fast-export: support done featureSverre Rabbelier, Jul 16, 2011
  17. 14/23 transport-helper: factor out push_update_refs_statusSverre Rabbelier, Jul 16, 2011
  18. 15/23 transport-helper: check status code of finish_commandSverre Rabbelier, Jul 16, 2011
  19. 16/23 transport-helper: use the new done feature where possibleSverre Rabbelier, Jul 16, 2011
  20. 17/23 transport-helper: update ref status after push with exportSverre Rabbelier, Jul 16, 2011
  21. 18/23 transport-helper: change import semanticsSverre Rabbelier, Jul 16, 2011
  22. Dmitry IvankovJul 18, 2011
  23. 19/23 transport-helper: Use capname for refspec capability tooSverre Rabbelier, Jul 16, 2011
  24. 20/23 transport-helper: implement marks location as capabilitySverre Rabbelier, Jul 16, 2011
  25. 21/23 transport-helper: die early on encountering deleted refsSverre Rabbelier, Jul 16, 2011
  26. 22/23 t5800: document inability to push new branch with old contentSverre Rabbelier, Jul 16, 2011
  27. 23/23 t5800: point out that deleting branches does not workSverre Rabbelier, Jul 16, 2011
  28. Jeff KingJul 18, 2011
  29. Sverre RabbelierJul 23, 2011

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.