git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "H.Merijn Brand" <h.m.brand@xs4all.nl>
To: git@vger.kernel.org
Subject: [PATCH] 64bit issue in test-parse-options.c
Date: Wed, 30 Jul 2008 14:16:56 +0200	[thread overview]
Message-ID: <20080730141656.41ce02ec@pc09.procura.nl> (raw)

git-1.5.6.4 - HP-UX 11.23 64bit compile

* expecting success:
        test-parse-options -s123 -b -i 1729 -b -vv -n > output 2> output.err &&
        test_cmp expect output &&
        test ! -s output.err

--- expect      2008-07-30 11:52:05 +0000
+++ output      2008-07-30 11:52:05 +0000
@@ -1,5 +1,5 @@
 boolean: 2
-integer: 1729
+integer: 7425998454784
 string: 123
 abbrev: 7
 verbose: 2
* FAIL 2: short options

I'm sure you can come up with a more sensible change, but the current
code is definitely wrong


--8<---
--- test-parse-options.c.org    2008-07-30 11:57:16 +0000
+++ test-parse-options.c        2008-07-30 12:08:56 +0000
@@ -2,6 +2,7 @@
 #include "parse-options.h"

 static int boolean = 0;
+static unsigned int int_integer = 0;
 static unsigned long integer = 0;
 static int abbrev = 7;
 static int verbose = 0, dry_run = 0, quiet = 0;
@@ -29,9 +30,9 @@ int main(int argc, const char **argv)
                OPT_BIT('4', "or4", &boolean,
                        "bitwise-or boolean with ...0100", 4),
                OPT_GROUP(""),
-               OPT_INTEGER('i', "integer", &integer, "get a integer"),
-               OPT_INTEGER('j', NULL, &integer, "get a integer, too"),
-               OPT_SET_INT(0, "set23", &integer, "set integer to 23", 23),
+               OPT_INTEGER('i', "integer", &int_integer, "get a integer"),
+               OPT_INTEGER('j', NULL, &int_integer, "get a integer, too"),
+               OPT_SET_INT(0, "set23", &int_integer, "set integer to 23", 23),
                OPT_DATE('t', NULL, &integer, "get timestamp of <time>"),
                OPT_CALLBACK('L', "length", &integer, "str",
                        "get length of <str>", length_callback),
@@ -53,7 +54,9 @@ int main(int argc, const char **argv)
        };
        int i;

+       integer = 0x12345678;
        argc = parse_options(argc, argv, options, usage, 0);
+       if (integer == 0x12345678) integer = int_integer;

        printf("boolean: %d\n", boolean);
        printf("integer: %lu\n", integer);
-->8---

-- 
H.Merijn Brand          Amsterdam Perl Mongers  http://amsterdam.pm.org/
using & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,
11.11, 11.23, and 11.31, SuSE 10.1, 10.2, and 10.3, AIX 5.2, and Cygwin.
http://mirrors.develooper.com/hpux/           http://www.test-smoke.org/
http://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/

             reply	other threads:[~2008-07-30 12:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-30 12:16 H.Merijn Brand [this message]
2008-07-30 12:37 ` [PATCH] 64bit issue in test-parse-options.c Pierre Habouzit
2008-07-30 12:44   ` H.Merijn Brand
2008-07-30 14:05     ` Pierre Habouzit
2008-07-30 19:11       ` Junio C Hamano
2008-07-30 19:35         ` Pierre Habouzit
2008-07-30 19:55         ` H.Merijn Brand
2008-07-31 11:07       ` Petr Baudis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080730141656.41ce02ec@pc09.procura.nl \
    --to=h.m.brand@xs4all.nl \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).