unit test not passing on my computer

Jelmer Vernooij jelmer at samba.org
Tue Jun 22 16:30:54 MDT 2010


Hi Lukasz, Matthias,

On Tue, 2010-06-22 at 09:15 +0100, Lukasz Zalewski wrote:
> On 22/06/2010 07:26, Matthias Dieter Wallnöfer wrote:
> > Hi Lukasz,
> >
> > if grouptype is not None:
> >
> > - ldbmessage["groupType"] = "%d" % ((grouptype)-2**32)
> >
> > + ldbmessage["groupType"] = "%d" % ((grouptype + 2**31) % 2**32 - 2**31
> >
> > ^^^ isn't this "groupType" alignment easier to do? Shouldn't "groupType
> > % 2**32" alone fit ?
> just using
> "%d" % ((grouptype) % 2**32)
> seems to break on both 32 and 64bit:
> On 32:
> groupType= -2147483644
> groupType (grouptype % 2**32)= 2147483652
> 
> on 64bit:
> groupType= 2147483652
> groupType (grouptype % 2**32)= 2147483652
> 
> Note: on 32bit the value is correct to start with so no conversion would 
> be necessary
> 
> Maybe Jelmer can shed some light on this
This is definitely not the right fix, as the user in Python shouldn't
have to care about the endianness of the machine on which the code is
running. 

I don't really understand what the problem is that you're trying to
solve though - what test is failing and in what way ?

Cheers,

Jelmer

> > Matthias
> >
> > Lukasz Zalewski wrote:
> >> Matthieu,
> >> Attached is the patch that fixes the problems when assigning
> >> (converting) grouptype value on 64 and 32 bit architectures. I have
> >> tested this on both architectures and both produce exactly the same
> >> values. Please let me know if this works for you
> >>
> >> Luk
> >
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20100623/67d5661b/attachment.pgp>


More information about the samba-technical mailing list