* On PPC64, the parsing of integers on the commandline is bitshifted.
@ 2008-08-07 20:31 Robin H. Johnson
2008-08-07 21:26 ` Brandon Casey
0 siblings, 1 reply; 5+ messages in thread
From: Robin H. Johnson @ 2008-08-07 20:31 UTC (permalink / raw)
To: git, gitster
[-- Attachment #1: Type: text/plain, Size: 1070 bytes --]
In a 64-bit userland, big-endian environment, the parser gets integers
wrong.
# ./test-parse-options --set23 |grep integer
integer: 98784247808
# patch ...
# ./test-parse-options --set23 |grep integer
integer: 23
Full failures from the testcases
-integer: 1729
+integer: 7425998454784
-integer: 13
+integer: 55834574848
-integer: 2
+integer: 8589934592
-integer: 23
+integer: 98784247808
All the values are shifted up 32 bits.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
---
Please CC me in replies, I'm not on git@vger.
Fix against 1.5.6.4:
--- parse-options.c.orig 2008-08-07 14:51:17.000000000 -0500
+++ parse-options.c 2008-08-07 14:51:25.000000000 -0500
@@ -78,7 +78,7 @@
return 0;
case OPTION_SET_INT:
- *(int *)opt->value = unset ? 0 : opt->defval;
+ *(long int *)opt->value = unset ? 0 : opt->defval;
return 0;
case OPTION_SET_PTR:
--
Robin Hugh Johnson
Gentoo Linux Developer & Infra Guy
E-Mail : robbat2@gentoo.org
GnuPG FP : 11AC BA4F 4778 E3F6 E4ED F38E B27B 944E 3488 4E85
[-- Attachment #2: Type: application/pgp-signature, Size: 329 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: On PPC64, the parsing of integers on the commandline is bitshifted.
2008-08-07 20:31 On PPC64, the parsing of integers on the commandline is bitshifted Robin H. Johnson
@ 2008-08-07 21:26 ` Brandon Casey
2008-08-07 21:34 ` Brandon Casey
0 siblings, 1 reply; 5+ messages in thread
From: Brandon Casey @ 2008-08-07 21:26 UTC (permalink / raw)
To: Robin H. Johnson; +Cc: git, gitster
Robin H. Johnson wrote:
> In a 64-bit userland, big-endian environment, the parser gets integers
> wrong.
There is a fix on master. Can you try that out?
Unfortunately, looks like it did not make it into 1.5.6.5
-brandon
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: On PPC64, the parsing of integers on the commandline is bitshifted.
2008-08-07 21:26 ` Brandon Casey
@ 2008-08-07 21:34 ` Brandon Casey
2008-08-07 21:42 ` Junio C Hamano
0 siblings, 1 reply; 5+ messages in thread
From: Brandon Casey @ 2008-08-07 21:34 UTC (permalink / raw)
To: Robin H. Johnson; +Cc: git, gitster
Brandon Casey wrote:
> Robin H. Johnson wrote:
>> In a 64-bit userland, big-endian environment, the parser gets integers
>> wrong.
>
> There is a fix on master. Can you try that out?
> Unfortunately, looks like it did not make it into 1.5.6.5
Also, just so you know, it is test-parse-options.c that is broken, not
the parsing code. So, the rest of git should be using an int with
OPT_INTEGER() and should operate correctly.
-brandon
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: On PPC64, the parsing of integers on the commandline is bitshifted.
2008-08-07 21:34 ` Brandon Casey
@ 2008-08-07 21:42 ` Junio C Hamano
2008-08-08 8:38 ` Pierre Habouzit
0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2008-08-07 21:42 UTC (permalink / raw)
To: Brandon Casey; +Cc: Robin H. Johnson, git, gitster
Brandon Casey <casey@nrlssc.navy.mil> writes:
> Brandon Casey wrote:
>> Robin H. Johnson wrote:
>>> In a 64-bit userland, big-endian environment, the parser gets integers
>>> wrong.
>>
>> There is a fix on master. Can you try that out?
>> Unfortunately, looks like it did not make it into 1.5.6.5
>
> Also, just so you know, it is test-parse-options.c that is broken, not
> the parsing code. So, the rest of git should be using an int with
> OPT_INTEGER() and should operate correctly.
Yup, that is why it is not on 'maint' --- but somebody should audit the
parse_options() users in the real programs to make sure that there is no
similar breakages, namely, giving a pointer to long to OPT_INTEGER().
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: On PPC64, the parsing of integers on the commandline is bitshifted.
2008-08-07 21:42 ` Junio C Hamano
@ 2008-08-08 8:38 ` Pierre Habouzit
0 siblings, 0 replies; 5+ messages in thread
From: Pierre Habouzit @ 2008-08-08 8:38 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Brandon Casey, Robin H. Johnson, git
[-- Attachment #1: Type: text/plain, Size: 1194 bytes --]
On Thu, Aug 07, 2008 at 09:42:29PM +0000, Junio C Hamano wrote:
> Brandon Casey <casey@nrlssc.navy.mil> writes:
>
> > Brandon Casey wrote:
> >> Robin H. Johnson wrote:
> >>> In a 64-bit userland, big-endian environment, the parser gets integers
> >>> wrong.
> >>
> >> There is a fix on master. Can you try that out?
> >> Unfortunately, looks like it did not make it into 1.5.6.5
> >
> > Also, just so you know, it is test-parse-options.c that is broken, not
> > the parsing code. So, the rest of git should be using an int with
> > OPT_INTEGER() and should operate correctly.
>
> Yup, that is why it is not on 'maint' --- but somebody should audit the
> parse_options() users in the real programs to make sure that there is no
> similar breakages, namely, giving a pointer to long to OPT_INTEGER().
Well FWIW I'll probably write some __GNUC__ guarded glue using
__builtin_types_compatible and friends to ensure we're not passing crap
to the OPT_* macros. I just didn't have time to yet.
--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-08-08 8:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-07 20:31 On PPC64, the parsing of integers on the commandline is bitshifted Robin H. Johnson
2008-08-07 21:26 ` Brandon Casey
2008-08-07 21:34 ` Brandon Casey
2008-08-07 21:42 ` Junio C Hamano
2008-08-08 8:38 ` Pierre Habouzit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox