Re: [PATCH] 64bit issue in test-parse-options.c

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

 



On Wed, Jul 30, 2008 at 12:44:52PM +0000, H.Merijn Brand wrote:
> On Wed, 30 Jul 2008 14:37:13 +0200, Pierre Habouzit
> <madcoder@xxxxxxxxxx> wrote:
> 
> > On Wed, Jul 30, 2008 at 12:16:56PM +0000, H.Merijn Brand wrote:
> > > 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;
> > 
> >   long is wrong in the first place, parse-opt only uses ints.
> 
> If I change it to int, the date parsing goes bogus.

That is because OPT_DATE indeed expect a long (why not a time_t I don't
know btw... but time_t is a long on linux so it doesn't change things a
lot).

The proper fix is to let integer be an *INT* (long integer is bogus
anyways) and to put the date in a long using static unsigned long date,
and make OPT_DATE use this long.

-- 
·O·  Pierre Habouzit
··O                                                madcoder@xxxxxxxxxx
OOO                                                http://www.madism.org

Attachment: pgpRsYqoRy6aj.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