Test failures in BundleTester if TZ=UTC

John Arbash Meinel john at arbash-meinel.com
Wed Aug 9 14:54:31 BST 2006


Adeodato Simó wrote:
> Hi.
> 
> While building a Debian package for 0.9-rc1, I got some test failures.
> After a bit of digging, it all came to the build environment having an
> UTC timezone.
> 
> You should get 6 failures with this:
> 
>   % TZ=UTC bzr selftest bzrlib.tests.test_bundle.BundleTester
> 
> There were no more failures than those.
> 
> Cheers,
> 

Thanks for the report.

It turns out that the current bzr xml serializer does this:
if rev.timezone:
  root.set('timezone', str(rev.timezone))

Which means that if your timezone == UTC (thus offset == 0), then it
*doesn't* set a timezone property in the XML.
And when read back in, that leaves the timezone property == None rather
than == 0.

However, the bundle reader reads it in and sets rev.timezone = 0. Hence
what has been stored disagrees with what has just been read in.

So what is the best bugfixes? I think there are a few things:

1) Change xml5._pack_revision to use:
   if rev.timezone is not None:
     root.set('timezone', str(rev.timezone))
2) We can't change the read side, because that would mean reading a
revision, and writing it back out again would have different text.
Otherwise we could change these lines:

OLD
  v = elt.get('timezone')
  rev.timezone = v and int(v)
NEW
  v = elt.get('timezone')
  if v is None:
    rev.timezone = 0
  else:
    rev.timezone = int(v)

3) we could just change the tests so that they handle timezone==None for
timezone == 0. I don't really like that one.

So really old revisions would have timezone == None, because when Martin
first wrote bzr, he didn't set timezone.

However, testaments already do:
self.timezone = rev.timezone or 0

Since we don't really assert that Revision XML text doesn't change (that
is what testaments are for), I propose we do both (1) and (2) and write
tests for these cases.

I submitted:
https://launchpad.net/products/bzr/+bug/55783

So we don't forget about it. I'd like others to comment, and then I'll
write the fix.

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060809/f090a3c5/attachment.pgp 


More information about the bazaar mailing list