git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Robin H. Johnson <robbat2@gentoo.org>
Date
Aug 7, 2008, 20:31 UTC
Message-ID
<20080807203122.GR22707@curie-int.orbis-terrarum.net>

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
Next: Brandon Casey
Message 1 of 5 in “On PPC64, the parsing of integers on the commandline is bitshifted.”
  1. Robin H. JohnsonAug 7, 2008
  2. Brandon CaseyAug 7, 2008
  3. Brandon CaseyAug 7, 2008
  4. Junio C HamanoAug 7, 2008
  5. Pierre HabouzitAug 8, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.