On PPC64, the parsing of integers on the commandline is bitshifted.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>

---
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@xxxxxxxxxx
GnuPG FP   : 11AC BA4F 4778 E3F6 E4ED  F38E B27B 944E 3488 4E85

Attachment: pgpIXt5reGcMQ.pgp
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux