From: Brian Warner Date: Fri, 10 Oct 2008 01:34:22 +0000 (-0700) Subject: scripts/debug.py: emit the immutable-share version number, tolerate v2 X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/uri/frontends/%22doc.html/?a=commitdiff_plain;h=fd32d72b20972023c5db6ef7ef6dc015efc4ed9c;p=tahoe-lafs%2Ftahoe-lafs.git scripts/debug.py: emit the immutable-share version number, tolerate v2 --- diff --git a/src/allmydata/scripts/debug.py b/src/allmydata/scripts/debug.py index 728d7527..eac5ea1d 100644 --- a/src/allmydata/scripts/debug.py +++ b/src/allmydata/scripts/debug.py @@ -53,10 +53,12 @@ def dump_immutable_share(options): f = storage.ShareFile(options['filename']) # use a ReadBucketProxy to parse the bucket and find the uri extension bp = ReadBucketProxy(None) - offsets = bp._parse_offsets(f.read_share_data(0, 0x24)) + offsets = bp._parse_offsets(f.read_share_data(0, 0x44)) + print >>out, "%20s: %d" % ("version", bp._version) seek = offsets['uri_extension'] - length = struct.unpack(">L", f.read_share_data(seek, 4))[0] - seek += 4 + length = struct.unpack(bp._fieldstruct, + f.read_share_data(seek, bp._fieldsize))[0] + seek += bp._fieldsize UEB_data = f.read_share_data(seek, length) unpacked = uri.unpack_extension_readable(UEB_data)