Git development
 help / color / mirror / Atom feed
* 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

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