From: Johannes Sixt <j.sixt@viscovery.net>
To: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
Brandon Casey <casey@nrlsrc.navy.mil>
Subject: Re: [PATCH v0 3/3] Build in git-rebase.sh
Date: Mon, 25 May 2009 08:16:13 +0200 [thread overview]
Message-ID: <4A1A37AD.4080309@viscovery.net> (raw)
In-Reply-To: <20090523145042.GA13139@dektop>
Nguyen Thai Ngoc Duy schrieb:
> On Sat, May 23, 2009 at 07:26:03PM +1000, Nguyen Thai Ngoc Duy wrote:
>> On Fri, May 22, 2009 at 05:30:31PM +1000, Nguyen Thai Ngoc Duy wrote:
>>> 2009/5/22 Johannes Sixt <j.sixt@viscovery.net>:
>>>> Nguyễn Thái Ngọc Duy schrieb:
>>>>> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
>>>> Is it possible for you to test this series on Windows? Many rebase tests
>>>> fail, but I haven't investigated why.
>>> I'll try it this weekend.
>> This patch makes t3*rebase*.sh pass for me except t3412 (more exactly
>> t3412.8). That test failed even with git-rebase.sh. Hmm... Anyway
>> could you try again to see what tests still fail?
>
> Someone with better Windows knowledge than me should explain how this works. Windows'
> snprintf() just cuts out the last character in this statement:
>
> snprintf(buf, 8, "--%s", "onto"); // result: '--ont', expected: '--onto'
This doesn't happen for me: neither with Windows's original snprintf nor
with the version from compat/. Are you using the latest msysgit
environment to compile, i.e. gcc 4.4? There was a change regarding
SNPRINTF_SIZE_CORR; perhaps that's the culprit?
I don't undertand what this patch does, anyway. Where is the detail that I
am missing?
> All rebase tests now pass for me on Windows (Vista something, I have
> yet to find where it hides its "uname" command)
They also pass for me with your earlier fix-up patch, but with or without
this patch to compat/snprintf.c.
> diff --git a/compat/snprintf.c b/compat/snprintf.c
> index 357e733..1cea768 100644
> --- a/compat/snprintf.c
> +++ b/compat/snprintf.c
> @@ -13,7 +13,7 @@
> int git_vsnprintf(char *str, size_t maxsize, const char *format, va_list ap)
> {
> char *s;
> - int ret = -1;
> + int size, ret = -1;
>
> if (maxsize > 0) {
> ret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, ap);
> @@ -26,18 +26,19 @@ int git_vsnprintf(char *str, size_t maxsize, const char *format, va_list ap)
> return ret;
>
> s = NULL;
> - if (maxsize < 128)
> - maxsize = 128;
> + size = maxsize < 128 ? 128 : maxsize;
>
> while (ret == -1) {
> - maxsize *= 4;
> - str = realloc(s, maxsize);
> - if (! str)
> + size *= 4;
> + s = realloc(s, size);
> + if (!s)
> break;
> - s = str;
> - ret = vsnprintf(str, maxsize-SNPRINTF_SIZE_CORR, format, ap);
> - if (ret == maxsize-1)
> + s = s;
> + ret = vsnprintf(s, size-SNPRINTF_SIZE_CORR, format, ap);
> + if (ret == size-1)
> ret = -1;
> + else
> + memcpy(str, s, maxsize-1);
> }
> free(s);
> return ret;
next prev parent reply other threads:[~2009-05-25 6:16 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-21 9:47 [PATCH v0 1/3] doc/git-rebase.txt: remove mention of multiple strategies Nguyễn Thái Ngọc Duy
2009-05-21 9:47 ` [PATCH v0 2/3] t/t3400-rebase.sh: add more tests to help migrating git-rebase.sh to C Nguyễn Thái Ngọc Duy
2009-05-21 9:47 ` [PATCH v0 3/3] Build in git-rebase.sh Nguyễn Thái Ngọc Duy
2009-05-21 10:25 ` Jakub Narebski
2009-05-21 10:44 ` Nguyen Thai Ngoc Duy
2009-05-21 12:29 ` Jakub Narebski
2009-05-21 22:57 ` Nguyen Thai Ngoc Duy
2009-05-21 14:39 ` Junio C Hamano
2009-05-22 6:56 ` Johannes Sixt
2009-05-22 7:30 ` Nguyen Thai Ngoc Duy
2009-05-23 9:26 ` Nguyen Thai Ngoc Duy
2009-05-23 14:50 ` Nguyen Thai Ngoc Duy
2009-05-25 6:16 ` Johannes Sixt [this message]
2009-05-25 6:34 ` Nguyen Thai Ngoc Duy
2009-05-25 6:47 ` Johannes Sixt
2009-05-25 7:00 ` Nguyen Thai Ngoc Duy
2009-05-25 7:39 ` Nguyen Thai Ngoc Duy
2009-05-21 10:22 ` [PATCH v0 2/3] t/t3400-rebase.sh: add more tests to help migrating git-rebase.sh to C Jakub Narebski
2009-05-21 10:39 ` Nguyen Thai Ngoc Duy
2009-05-21 14:22 ` Junio C Hamano
2009-05-23 15:31 ` [PATCH " Nguyễn Thái Ngọc Duy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A1A37AD.4080309@viscovery.net \
--to=j.sixt@viscovery.net \
--cc=casey@nrlsrc.navy.mil \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pclouds@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).