threads / discuss / 8199

git-rebase (1.5.0.6) errors

Subject: git-rebase (1.5.0.6) errors

## tl;dr

9 messages between May 18, 2007 and May 20, 2007.

replies: 8people: 4as markdown or json

Ilpo Järvinen· May 18, 2007, 08:47 UTC · lore
Hi,

ijjarvin@kivilampi-30:~/work/src/submit$ git-rebase net-2.6.22-origin First, rewinding head to replay your work on top of it... HEAD is now at d739437... [IPV4]: Correct rp_filter help text. fatal: cannot convert from utf-8 to utf-8

ijjarvin@kivilampi-30:~/work/src/submit$ git-log -n 1 | cat
commit d739437207064cdcea8f9c81442284106cbcb67f
Author: Dave Jones <davej@redhat.com>
Date:   Thu May 17 15:02:21 2007 -0700
    [IPV4]: Correct rp_filter help text.
    
    As mentioned in http://bugzilla.kernel.org/show_bug.cgi?id=5015
    The helptext implies that this is on by default.
    This may be true on some distros (Fedora/RHEL have it enabled
    in /etc/sysctl.conf), but the kernel defaults to it off.
    
    Signed-off-by: Dave Jones <davej@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
ijjarvin@kivilampi-30:~/work/src/submit$ git-rebase --abort
HEAD is now at e413863... [TCP] FRTO: Add missing ECN CWR sending to one of the responses
ijjarvin@kivilampi-30:~/work/src/submit$ git --version
git version 1.5.0.6
I find at least two problems in it...
  - Non-sense error message: "convert from utf-8 to utf-8" ?!?
  - It fails to rebase the e413863 changeset
-- 
 i.
Paolo Teti· May 18, 2007, 10:31 UTC · re: Ilpo Järvinen · lore

Re: git-rebase (1.5.0.6) errors

2007/5/18, Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>:
Show 7 quoted lines
> Hi,
>
>
> ijjarvin@kivilampi-30:~/work/src/submit$ git-rebase net-2.6.22-origin
> First, rewinding head to replay your work on top of it...
> HEAD is now at d739437... [IPV4]: Correct rp_filter help text.
> fatal: cannot convert from utf-8 to utf-8

Now I can't test or try to reproduce your error, but looking at the source code (only with gitweb) I have found another bad use of size_t instead of ssize_t in the reencode_string(..) that take part at the conversion process.

Using size_t in the next portion of code the check "count == -1" is never true.
while (1) {
		size_t cnt = iconv(conv, &cp, &insz, &outpos, &outsz);
		if (cnt == -1) {
			size_t sofar;
			if (errno != E2BIG) {
				free(out);
				iconv_close(conv);
				return NULL;
			}
Please someone could fixes this bad use of size_t?..
Sorry, but now I can't install/use git because I'm on a customer workstation..
David Kastrup· May 18, 2007, 10:49 UTC · re: Paolo Teti · lore

Re: git-rebase (1.5.0.6) errors

"Paolo Teti" <paolo.teti@gmail.com> writes:
Show 17 quoted lines
> 2007/5/18, Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>:
>> Hi,
>>
>>
>> ijjarvin@kivilampi-30:~/work/src/submit$ git-rebase net-2.6.22-origin
>> First, rewinding head to replay your work on top of it...
>> HEAD is now at d739437... [IPV4]: Correct rp_filter help text.
>> fatal: cannot convert from utf-8 to utf-8
>
>
> Now I can't test or try to reproduce your error,
> but looking at the source code (only with gitweb)
> I have found another bad use of size_t instead of ssize_t
> in the reencode_string(..) that take part at the conversion process.
>
> Using size_t in the next portion of code the check "count == -1" is
> never true.

Only if size_t is a larger type than int (could be on x86-64 and alpha architectures). Other than that, this comparison would work. Which does not mean that this does not warrant fixing, but it is not necessarily the cause of this problem.

Show 14 quoted lines
>
> while (1) {
> 		size_t cnt = iconv(conv, &cp, &insz, &outpos, &outsz);
>
> 		if (cnt == -1) {
> 			size_t sofar;
> 			if (errno != E2BIG) {
> 				free(out);
> 				iconv_close(conv);
> 				return NULL;
> 			}
>
>
> Please someone could fixes this bad use of size_t?..
-- 
David Kastrup
Paolo Teti· May 18, 2007, 11:29 UTC · re: David Kastrup · lore

Re: git-rebase (1.5.0.6) errors

2007/5/18, David Kastrup <dak@gnu.org>:
Show 24 quoted lines
> "Paolo Teti" <paolo.teti@gmail.com> writes:
>
> > 2007/5/18, Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>:
> >> Hi,
> >>
> >>
> >> ijjarvin@kivilampi-30:~/work/src/submit$ git-rebase net-2.6.22-origin
> >> First, rewinding head to replay your work on top of it...
> >> HEAD is now at d739437... [IPV4]: Correct rp_filter help text.
> >> fatal: cannot convert from utf-8 to utf-8
> >
> >
> > Now I can't test or try to reproduce your error,
> > but looking at the source code (only with gitweb)
> > I have found another bad use of size_t instead of ssize_t
> > in the reencode_string(..) that take part at the conversion process.
> >
> > Using size_t in the next portion of code the check "count == -1" is
> > never true.
>
> Only if size_t is a larger type than int (could be on x86-64 and alpha
> architectures).  Other than that, this comparison would work.  Which
> does not mean that this does not warrant fixing, but it is not
> necessarily the cause of this problem.
1. Yes this is not necessarily the cause.. I agree.
2. size_t as I know is unsigned and ssize_t is the signed version of
size_t.. so to
    compare with -1 we want ssize_t.
Ilpo Järvinen· May 18, 2007, 14:02 UTC · re: Paolo Teti · lore

Re: git-rebase (1.5.0.6) errors

David Kastrup <dak@gnu.org> wrote:
> Only if size_t is a larger type than int (could be on x86-64 and alpha
> architectures).  Other than that, this comparison would work.  Which
> does not mean that this does not warrant fixing, but it is not
> necessarily the cause of this problem.
...sizeof(size_t) == sizeof(int) should hold...

Anyway, if this has any relevance: I'm using non-utf system, and (as you see) my surname has ä... The system was recently upgraded to git 1.5+ which started to complain also about a missing i18n.commitencoding, figured out that when I set it to utf8 (empty => defaults to it) and have signed-off line (with native non-utf ä), I get that error...

...and please, do not drop me from cc since I'm not subscribed...
-- 
 i.
Paolo Teti· May 18, 2007, 14:39 UTC · re: Ilpo Järvinen · lore

Re: git-rebase (1.5.0.6) errors

2007/5/18, Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>:
> ...sizeof(size_t) == sizeof(int) should hold...
what I have reported is not necessarily the cause of your error. Yes
BUT size_t is UNSIGNED and ssize_t is SIGNED.

The problem is that We store a signed return value into a unsigned variable. So the check against -1 has no sense.

and please note that also sizeof(int) == sizeof(unsigned int), but -1 is a signed int !!

I repeat: this is not necessarily the cause of your error.
Jan Hudec· May 20, 2007, 12:43 UTC · re: Ilpo Järvinen · lore

Re: git-rebase (1.5.0.6) errors

On Fri, May 18, 2007 at 17:02:56 +0300, Ilpo Järvinen wrote:
Show 8 quoted lines
> David Kastrup <dak@gnu.org> wrote:
> 
> > Only if size_t is a larger type than int (could be on x86-64 and alpha
> > architectures).  Other than that, this comparison would work.  Which
> > does not mean that this does not warrant fixing, but it is not
> > necessarily the cause of this problem.
> 
> ...sizeof(size_t) == sizeof(int) should hold...
Really?
$ cat test.c
#include <stdio.h>
int main(void)
{
    printf("sizeof(int) = %i\n", sizeof(int));
    printf("sizeof(long) = %i\n", sizeof(long));
    printf("sizeof(size_t) = %i\n", sizeof(size_t));
    return 0;
}
$ gcc -otest test.c
$ ./test
sizeof(int) = 4
sizeof(long) = 8
sizeof(size_t) = 8
Hm, it does not seem that sizeof(size_t) == sizeof(int).

$ uname -m x86_64

Yes, this is a 64-bit system.
Anyway, comparing it with -1 is ALWAYS OK in spite of this!
$ cat test2.c
#include <stdio.h>
int main(void)
{
    size_t x = 0;
    --x;
    printf("x = 0x%lx\n", x);
    printf("(x == -1) = %i\n", (x == -1));
    return 0;
}
$ gcc -otest2 test2.c
$ ./test2
x = 0xffffffffffffffff
(x == -1) = 1

So at least with gcc that comparison is OK anyway. There has to be something else that causes that problem.

Show 10 quoted lines
> Anyway, if this has any relevance: I'm using non-utf system, and (as you 
> see) my surname has ä... The system was recently upgraded to git 1.5+ 
> which started to complain also about a missing i18n.commitencoding, 
> figured out that when I set it to utf8 (empty => defaults to it) and have 
> signed-off line (with native non-utf ä), I get that error...
> 
> ...and please, do not drop me from cc since I'm not subscribed...
> 
> -- 
>  i.
-- 
						 Jan 'Bulb' Hudec <bulb@ucw.cz>
Ilpo Järvinen· May 20, 2007, 19:02 UTC · re: Jan Hudec · lore

Re: git-rebase (1.5.0.6) errors

On Sun, 20 May 2007, Jan Hudec wrote:
Show 28 quoted lines
> On Fri, May 18, 2007 at 17:02:56 +0300, Ilpo Järvinen wrote:
> > David Kastrup <dak@gnu.org> wrote:
> > 
> > > Only if size_t is a larger type than int (could be on x86-64 and alpha
> > > architectures).  Other than that, this comparison would work.  Which
> > > does not mean that this does not warrant fixing, but it is not
> > > necessarily the cause of this problem.
> > 
> > ...sizeof(size_t) == sizeof(int) should hold...
> 
> Really?
> 
> $ cat test.c
> #include <stdio.h>
> int main(void)
> {
>     printf("sizeof(int) = %i\n", sizeof(int));
>     printf("sizeof(long) = %i\n", sizeof(long));
>     printf("sizeof(size_t) = %i\n", sizeof(size_t));
>     return 0;
> }
> $ gcc -otest test.c
> $ ./test
> sizeof(int) = 4
> sizeof(long) = 8
> sizeof(size_t) = 8
> 
> Hm, it does not seem that sizeof(size_t) == sizeof(int).

...On 64-bit perhaps but mine isn't one of them... I'm sorry if my wording was misleading, I meant to say that on my system the equality of sizeof()s should hold... :-)

> $ uname -m
> x86_64
> 
> Yes, this is a 64-bit system.

ijjarvin@kivilampi-30:~/src/testsize$ ./main sizeof(int) = 4 sizeof(long) = 4 sizeof(size_t) = 4

$ uname -m i686

-- 
 i.
Paolo Teti· May 18, 2007, 15:08 UTC · lore

Re: git-rebase (1.5.0.6) errors

2007/5/18, David Kastrup <dak@gnu.org>:
Show 31 quoted lines
> "Paolo Teti" <paolo.teti@gmail.com> writes:
>
> > 2007/5/18, Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>:
> >
> >> ...sizeof(size_t) == sizeof(int) should hold...
> >
> > what I have reported is not necessarily the cause of your error. Yes
> >
> > BUT size_t is UNSIGNED and ssize_t is SIGNED.
> >
> > The problem is that We store a signed return value into a unsigned variable.
> > So the check against -1 has no sense.
>
> When comparing signed with unsigned types, the signed values are first
> converted to unsigned, then possibly zero-extended.
>
> So
>
> (unsigned)-1 == (int)-1
>
> but
>
> (unsigned long)-1 == (long)-1
>
> only when sizeof(long)==size(int)
>
> > and please note that also sizeof(int) == sizeof(unsigned int), but
> > -1 is a signed int !!
>
> So?
>
Stupid me.. OK is == -1 and not < 0..
Probably today  I'm drunk without drink ..
Enjoy

← back to recent threads