* [PATCH] git-daemon: Worked around uclibc buffer problem
@ 2008-10-09 21:34 Lars Stoltenow
2008-10-10 0:16 ` Nicolas Pitre
0 siblings, 1 reply; 4+ messages in thread
From: Lars Stoltenow @ 2008-10-09 21:34 UTC (permalink / raw)
To: git
uclibc immediately write()s every string argument to fprintf, which causes
superfluous 'remote: ' strings to appear when cloning repos. This patch
makes it write the message in one shot.
Signed-off-by: Lars Stoltenow <penma@penma.de>
---
builtin-pack-objects.c | 7 +++++--
progress.c | 8 ++++++--
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 1158e42..94f7404 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -2232,9 +2232,12 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
if (nr_result)
prepare_pack(window, depth);
write_pack_file();
- if (progress)
- fprintf(stderr, "Total %"PRIu32" (delta %"PRIu32"),"
+ if (progress) {
+ char message[128];
+ snprintf(message, sizeof(message), "Total %"PRIu32" (delta %"PRIu32"),"
" reused %"PRIu32" (delta %"PRIu32")\n",
written, written_delta, reused, reused_delta);
+ fputs(message, stderr);
+ }
return 0;
}
diff --git a/progress.c b/progress.c
index 55a8687..56c9134 100644
--- a/progress.c
+++ b/progress.c
@@ -94,16 +94,20 @@ static int display(struct progress *progress, unsigned n, const char *done)
if (progress->total) {
unsigned percent = n * 100 / progress->total;
if (percent != progress->last_percent || progress_update) {
+ char message[128];
progress->last_percent = percent;
- fprintf(stderr, "%s: %3u%% (%u/%u)%s%s",
+ snprintf(message, sizeof(message), "%s: %3u%% (%u/%u)%s%s",
progress->title, percent, n,
progress->total, tp, eol);
+ fputs(message, stderr);
fflush(stderr);
progress_update = 0;
return 1;
}
} else if (progress_update) {
- fprintf(stderr, "%s: %u%s%s", progress->title, n, tp, eol);
+ char message[128];
+ snprintf(message, sizeof(message), "%s: %u%s%s", progress->title, n, tp, eol);
+ fputs(message, stderr);
fflush(stderr);
progress_update = 0;
return 1;
--
1.6.0.2.GIT
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] git-daemon: Worked around uclibc buffer problem
2008-10-09 21:34 [PATCH] git-daemon: Worked around uclibc buffer problem Lars Stoltenow
@ 2008-10-10 0:16 ` Nicolas Pitre
2008-10-10 13:33 ` Lars Stoltenow
0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Pitre @ 2008-10-10 0:16 UTC (permalink / raw)
To: Lars Stoltenow; +Cc: git
On Thu, 9 Oct 2008, Lars Stoltenow wrote:
> uclibc immediately write()s every string argument to fprintf, which causes
> superfluous 'remote: ' strings to appear when cloning repos. This patch
> makes it write the message in one shot.
What is your client version? From v1.6.0.2 and later (with commit
6b9c42b4da) this shouldn't matter as things are properly handled on the
receiving end.
Nicolas
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] git-daemon: Worked around uclibc buffer problem
2008-10-10 0:16 ` Nicolas Pitre
@ 2008-10-10 13:33 ` Lars Stoltenow
0 siblings, 0 replies; 4+ messages in thread
From: Lars Stoltenow @ 2008-10-10 13:33 UTC (permalink / raw)
To: git
On Thu, Oct 09, 2008 at 08:16:03PM -0400, Nicolas Pitre wrote:
> What is your client version? From v1.6.0.2 and later (with commit
> 6b9c42b4da) this shouldn't matter as things are properly handled on the
> receiving end.
Yah, looks good. I did test it with 1.6.0.1 and some 1.5.* versions on
the client side only. With 1.6.0.2, it works with the unfixed daemon too.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] git-daemon: Worked around uclibc buffer problem
@ 2008-10-09 22:51 Lars Stoltenow
0 siblings, 0 replies; 4+ messages in thread
From: Lars Stoltenow @ 2008-10-09 22:51 UTC (permalink / raw)
To: git
uclibc immediately write()s every string argument to fprintf, which causes
superfluous 'remote: ' strings to appear when cloning repos. This patch
makes it write the message in one shot.
Signed-off-by: Lars Stoltenow <penma@penma.de>
---
builtin-pack-objects.c | 7 +++++--
progress.c | 8 ++++++--
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 1158e42..94f7404 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -2232,9 +2232,12 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
if (nr_result)
prepare_pack(window, depth);
write_pack_file();
- if (progress)
- fprintf(stderr, "Total %"PRIu32" (delta %"PRIu32"),"
+ if (progress) {
+ char message[128];
+ snprintf(message, sizeof(message), "Total %"PRIu32" (delta %"PRIu32"),"
" reused %"PRIu32" (delta %"PRIu32")\n",
written, written_delta, reused, reused_delta);
+ fputs(message, stderr);
+ }
return 0;
}
diff --git a/progress.c b/progress.c
index 55a8687..56c9134 100644
--- a/progress.c
+++ b/progress.c
@@ -94,16 +94,20 @@ static int display(struct progress *progress, unsigned n, const char *done)
if (progress->total) {
unsigned percent = n * 100 / progress->total;
if (percent != progress->last_percent || progress_update) {
+ char message[128];
progress->last_percent = percent;
- fprintf(stderr, "%s: %3u%% (%u/%u)%s%s",
+ snprintf(message, sizeof(message), "%s: %3u%% (%u/%u)%s%s",
progress->title, percent, n,
progress->total, tp, eol);
+ fputs(message, stderr);
fflush(stderr);
progress_update = 0;
return 1;
}
} else if (progress_update) {
- fprintf(stderr, "%s: %u%s%s", progress->title, n, tp, eol);
+ char message[128];
+ snprintf(message, sizeof(message), "%s: %u%s%s", progress->title, n, tp, eol);
+ fputs(message, stderr);
fflush(stderr);
progress_update = 0;
return 1;
--
1.6.0.2.GIT
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-10-10 14:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-09 21:34 [PATCH] git-daemon: Worked around uclibc buffer problem Lars Stoltenow
2008-10-10 0:16 ` Nicolas Pitre
2008-10-10 13:33 ` Lars Stoltenow
-- strict thread matches above, loose matches on Subject: below --
2008-10-09 22:51 Lars Stoltenow
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox