* [PATCH V2 0/2] Fix l10n
@ 2017-02-16 17:07 Maxim Moseychuk
2017-02-16 17:07 ` [PATCH V2 1/2] bisect_next_all: convert xsnprintf to xstrfmt Maxim Moseychuk
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Maxim Moseychuk @ 2017-02-16 17:07 UTC (permalink / raw)
To: git; +Cc: peff, jonathantanmy, Maxim Moseychuk
In some places static size buffers can't store formatted string.
If it be happen then git die.
Jonathan Tan: Thanks a lot for your help.
Maxim Moseychuk (2):
bisect_next_all: convert xsnprintf to xstrfmt
stop_progress_msg: convert xsnprintf to xstrfmt
bisect.c | 9 +++++----
progress.c | 9 +++------
2 files changed, 8 insertions(+), 10 deletions(-)
--
2.11.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH V2 1/2] bisect_next_all: convert xsnprintf to xstrfmt
2017-02-16 17:07 [PATCH V2 0/2] Fix l10n Maxim Moseychuk
@ 2017-02-16 17:07 ` Maxim Moseychuk
2017-02-16 17:07 ` [PATCH V2 2/2] stop_progress_msg: " Maxim Moseychuk
2017-02-16 23:33 ` [PATCH V2 0/2] Fix l10n Junio C Hamano
2 siblings, 0 replies; 6+ messages in thread
From: Maxim Moseychuk @ 2017-02-16 17:07 UTC (permalink / raw)
To: git; +Cc: peff, jonathantanmy, Maxim Moseychuk
Git can't run bisect between 2048+ commits if use russian translation.
Reproduce "LANG=ru_RU.UTF8 git bisect start v4.9 v4.8" on linux sources.
Dummy solution: just increase buffer size but is not safe.
Size gettext string is a runtime value.
Signed-off-by: Maxim Moseychuk <franchesko.salias.hudro.pedros@gmail.com>
---
bisect.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/bisect.c b/bisect.c
index 21bc6daa4..787543cad 100644
--- a/bisect.c
+++ b/bisect.c
@@ -940,7 +940,7 @@ int bisect_next_all(const char *prefix, int no_checkout)
struct commit_list *tried;
int reaches = 0, all = 0, nr, steps;
const unsigned char *bisect_rev;
- char steps_msg[32];
+ char *steps_msg;
read_bisect_terms(&term_bad, &term_good);
if (read_bisect_refs())
@@ -990,14 +990,15 @@ int bisect_next_all(const char *prefix, int no_checkout)
nr = all - reaches - 1;
steps = estimate_bisect_steps(all);
- xsnprintf(steps_msg, sizeof(steps_msg),
- Q_("(roughly %d step)", "(roughly %d steps)", steps),
- steps);
+
+ steps_msg = xstrfmt(Q_("(roughly %d step)", "(roughly %d steps)",
+ steps), steps);
/* TRANSLATORS: the last %s will be replaced with
"(roughly %d steps)" translation */
printf(Q_("Bisecting: %d revision left to test after this %s\n",
"Bisecting: %d revisions left to test after this %s\n",
nr), nr, steps_msg);
+ free(steps_msg);
return bisect_checkout(bisect_rev, no_checkout);
}
--
2.11.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH V2 2/2] stop_progress_msg: convert xsnprintf to xstrfmt
2017-02-16 17:07 [PATCH V2 0/2] Fix l10n Maxim Moseychuk
2017-02-16 17:07 ` [PATCH V2 1/2] bisect_next_all: convert xsnprintf to xstrfmt Maxim Moseychuk
@ 2017-02-16 17:07 ` Maxim Moseychuk
2017-02-16 23:33 ` [PATCH V2 0/2] Fix l10n Junio C Hamano
2 siblings, 0 replies; 6+ messages in thread
From: Maxim Moseychuk @ 2017-02-16 17:07 UTC (permalink / raw)
To: git; +Cc: peff, jonathantanmy, Maxim Moseychuk
Replace local safe string buffer allocation by xstrfmt.
Signed-off-by: Maxim Moseychuk <franchesko.salias.hudro.pedros@gmail.com>
---
progress.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/progress.c b/progress.c
index 76a88c573..29d0dad58 100644
--- a/progress.c
+++ b/progress.c
@@ -243,21 +243,18 @@ void stop_progress_msg(struct progress **p_progress, const char *msg)
*p_progress = NULL;
if (progress->last_value != -1) {
/* Force the last update */
- char buf[128], *bufp;
- size_t len = strlen(msg) + 5;
+ char *bufp;
struct throughput *tp = progress->throughput;
- bufp = (len < sizeof(buf)) ? buf : xmallocz(len);
if (tp) {
unsigned int rate = !tp->avg_misecs ? 0 :
tp->avg_bytes / tp->avg_misecs;
throughput_string(&tp->display, tp->curr_total, rate);
}
progress_update = 1;
- xsnprintf(bufp, len + 1, ", %s.\n", msg);
+ bufp = xstrfmt(", %s.\n", msg);
display(progress, progress->last_value, bufp);
- if (buf != bufp)
- free(bufp);
+ free(bufp);
}
clear_progress_signal();
if (progress->throughput)
--
2.11.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH V2 0/2] Fix l10n
2017-02-16 17:07 [PATCH V2 0/2] Fix l10n Maxim Moseychuk
2017-02-16 17:07 ` [PATCH V2 1/2] bisect_next_all: convert xsnprintf to xstrfmt Maxim Moseychuk
2017-02-16 17:07 ` [PATCH V2 2/2] stop_progress_msg: " Maxim Moseychuk
@ 2017-02-16 23:33 ` Junio C Hamano
2017-02-16 23:37 ` Unknown
2 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2017-02-16 23:33 UTC (permalink / raw)
To: Maxim Moseychuk; +Cc: git, peff, jonathantanmy
Maxim Moseychuk <franchesko.salias.hudro.pedros@gmail.com> writes:
> In some places static size buffers can't store formatted string.
> If it be happen then git die.
>
> Jonathan Tan: Thanks a lot for your help.
>
> Maxim Moseychuk (2):
> bisect_next_all: convert xsnprintf to xstrfmt
> stop_progress_msg: convert xsnprintf to xstrfmt
>
> bisect.c | 9 +++++----
> progress.c | 9 +++------
> 2 files changed, 8 insertions(+), 10 deletions(-)
>
> --
> 2.11.1
Thanks. Queued with minor log message fixes and pushed out.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V2 0/2] Fix l10n
2017-02-16 23:33 ` [PATCH V2 0/2] Fix l10n Junio C Hamano
@ 2017-02-16 23:37 ` Unknown
2017-02-17 1:16 ` Junio C Hamano
0 siblings, 1 reply; 6+ messages in thread
From: Unknown @ 2017-02-16 23:37 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, peff, jonathantanmy
В Чт, 16/02/2017 в 15:33 -0800, Junio C Hamano пишет:
> Maxim Moseychuk <franchesko.salias.hudro.pedros@gmail.com> writes:
>
> > In some places static size buffers can't store formatted string.
> > If it be happen then git die.
> >
> > Jonathan Tan: Thanks a lot for your help.
> >
> > Maxim Moseychuk (2):
> > bisect_next_all: convert xsnprintf to xstrfmt
> > stop_progress_msg: convert xsnprintf to xstrfmt
> >
> > bisect.c | 9 +++++----
> > progress.c | 9 +++------
> > 2 files changed, 8 insertions(+), 10 deletions(-)
> >
> > --
> > 2.11.1
>
> Thanks. Queued with minor log message fixes and pushed out.
If is not too late, please check the version 3.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V2 0/2] Fix l10n
2017-02-16 23:37 ` Unknown
@ 2017-02-17 1:16 ` Junio C Hamano
0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2017-02-17 1:16 UTC (permalink / raw)
To: MM; +Cc: git, peff, jonathantanmy
Unknown <franchesko.salias.hudro.pedros@gmail.com> writes:
> В Чт, 16/02/2017 в 15:33 -0800, Junio C Hamano пишет:
>>
>> Thanks. Queued with minor log message fixes and pushed out.
>
> If is not too late, please check the version 3.
I already squashed in the change s/bufp/buf/ in the version I queued
and pushed out on 'pu', so we should be good. I compared the result
of applying your updated patches and did not see any other changes.
Thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-02-17 1:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-16 17:07 [PATCH V2 0/2] Fix l10n Maxim Moseychuk
2017-02-16 17:07 ` [PATCH V2 1/2] bisect_next_all: convert xsnprintf to xstrfmt Maxim Moseychuk
2017-02-16 17:07 ` [PATCH V2 2/2] stop_progress_msg: " Maxim Moseychuk
2017-02-16 23:33 ` [PATCH V2 0/2] Fix l10n Junio C Hamano
2017-02-16 23:37 ` Unknown
2017-02-17 1:16 ` Junio C Hamano
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.