{"thread":{"id":"15844","subject":"[PATCH] git-daemon: Worked around uclibc buffer problem","startedAt":"2008-10-09T21:34:48Z","lastAt":"2008-10-10T13:33:29Z","messageCount":3,"participants":["Lars Stoltenow","Nicolas Pitre"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"92714","messageId":"20081009213448.GA11204@derf.homelinux.org","threadId":"15844","inReplyTo":null,"subject":"[PATCH] git-daemon: Worked around uclibc buffer problem","fromName":"Lars Stoltenow","fromEmail":"penma@derf.homelinux.org","sentAt":"2008-10-09T21:34:48Z","receivedAt":"2008-10-09T21:34:48Z","isPatch":true,"sender":{"key":"penma@derf.homelinux.org","avatar":null},"body":"uclibc immediately write()s every string argument to fprintf, which causes\nsuperfluous 'remote: ' strings to appear when cloning repos. This patch\nmakes it write the message in one shot.\n\nSigned-off-by: Lars Stoltenow <penma@penma.de>\n---\n builtin-pack-objects.c |    7 +++++--\n progress.c             |    8 ++++++--\n 2 files changed, 11 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin-pack-objects.c b/builtin-pack-objects.c\nindex 1158e42..94f7404 100644\n--- a/builtin-pack-objects.c\n+++ b/builtin-pack-objects.c\n@@ -2232,9 +2232,12 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)\n \tif (nr_result)\n \t\tprepare_pack(window, depth);\n \twrite_pack_file();\n-\tif (progress)\n-\t\tfprintf(stderr, \"Total %\"PRIu32\" (delta %\"PRIu32\"),\"\n+\tif (progress) {\n+\t\tchar message[128];\n+\t\tsnprintf(message, sizeof(message), \"Total %\"PRIu32\" (delta %\"PRIu32\"),\"\n \t\t\t\" reused %\"PRIu32\" (delta %\"PRIu32\")\\n\",\n \t\t\twritten, written_delta, reused, reused_delta);\n+\t\tfputs(message, stderr);\n+\t}\n \treturn 0;\n }\ndiff --git a/progress.c b/progress.c\nindex 55a8687..56c9134 100644\n--- a/progress.c\n+++ b/progress.c\n@@ -94,16 +94,20 @@ static int display(struct progress *progress, unsigned n, const char *done)\n \tif (progress->total) {\n \t\tunsigned percent = n * 100 / progress->total;\n \t\tif (percent != progress->last_percent || progress_update) {\n+\t\t\tchar message[128];\n \t\t\tprogress->last_percent = percent;\n-\t\t\tfprintf(stderr, \"%s: %3u%% (%u/%u)%s%s\",\n+\t\t\tsnprintf(message, sizeof(message), \"%s: %3u%% (%u/%u)%s%s\",\n \t\t\t\tprogress->title, percent, n,\n \t\t\t\tprogress->total, tp, eol);\n+\t\t\tfputs(message, stderr);\n \t\t\tfflush(stderr);\n \t\t\tprogress_update = 0;\n \t\t\treturn 1;\n \t\t}\n \t} else if (progress_update) {\n-\t\tfprintf(stderr, \"%s: %u%s%s\", progress->title, n, tp, eol);\n+\t\tchar message[128];\n+\t\tsnprintf(message, sizeof(message), \"%s: %u%s%s\", progress->title, n, tp, eol);\n+\t\tfputs(message, stderr);\n \t\tfflush(stderr);\n \t\tprogress_update = 0;\n \t\treturn 1;\n-- \n1.6.0.2.GIT\n"},{"id":"92725","messageId":"alpine.LFD.2.00.0810092010370.26244@xanadu.home","threadId":"15844","inReplyTo":"20081009213448.GA11204@derf.homelinux.org","subject":"Re: [PATCH] git-daemon: Worked around uclibc buffer problem","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2008-10-10T00:16:03Z","receivedAt":"2008-10-10T00:16:03Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Thu, 9 Oct 2008, Lars Stoltenow wrote:\n\n> uclibc immediately write()s every string argument to fprintf, which causes\n> superfluous 'remote: ' strings to appear when cloning repos. This patch\n> makes it write the message in one shot.\n\nWhat is your client version?  From v1.6.0.2 and later (with commit \n6b9c42b4da) this shouldn't matter as things are properly handled on the \nreceiving end.\n\n\nNicolas\n"},{"id":"92752","messageId":"20081010133329.GA26129@derf.homelinux.org","threadId":"15844","inReplyTo":"alpine.LFD.2.00.0810092010370.26244@xanadu.home","subject":"Re: [PATCH] git-daemon: Worked around uclibc buffer problem","fromName":"Lars Stoltenow","fromEmail":"penma@derf.homelinux.org","sentAt":"2008-10-10T13:33:29Z","receivedAt":"2008-10-10T13:33:29Z","isPatch":true,"sender":{"key":"penma@derf.homelinux.org","avatar":null},"body":"On Thu, Oct 09, 2008 at 08:16:03PM -0400, Nicolas Pitre wrote:\n> What is your client version?  From v1.6.0.2 and later (with commit \n> 6b9c42b4da) this shouldn't matter as things are properly handled on the \n> receiving end.\n\nYah, looks good. I did test it with 1.6.0.1 and some 1.5.* versions on\nthe client side only. With 1.6.0.2, it works with the unfixed daemon too.\n"}]}