)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":7233,"name":"Matthew Oliver","email":"matt@oliver.net.au","username":"mattoliverau"},"change_message_id":"54c1717ea5fb19dbbe64856b01a0f390809e078c","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":1,"id":"b94a86f5_df08cbbd","updated":"2025-03-11 06:07:24.000000000","message":"Because your changing the compression level before writing the magic, I needed to rebuild rings first but..\n\n```\nvagrant@saio9:~$ file /etc/swift/object.ring.gz \n/etc/swift/object.ring.gz: gzip compressed (was \"object.ring\") Swift ring, version 1\nvagrant@saio9:~$ swift-ring-builder /etc/swift/container.builder write_ring --format-version 2\nvagrant@saio9:~$ file /etc/swift/container.ring.gz \n/etc/swift/container.ring.gz: gzip compressed (was \"container.ring\") Swift ring, version 2\n```\n\nThat is really awesome! No `file -z /etc/swift/container.ring.gz`, loving this!\n\nOnly downside is this is a slight change to the ring v1 format (r!ng\u003cversion\u003e) is an uncompressed stream.. but it\u0027s still gzip so should still all work on old swift, pre this patch:\n\n```\nvagrant@saio9:~/swift$ git checkout HEAD~\nvagrant@saio9:~/swift$ swift-ring-builder /etc/swift/container.ring.gz version\n/etc/swift/container.ring.gz: Serialization version: 2, build version: 9\nvagrant@saio9:~/swift$ swift-ring-builder /etc/swift/object.ring.gz version\n/etc/swift/object.ring.gz: Serialization version: 1, build version: 9\n```\n\nIt\u0027s even working on a pre ringv2 code. So I think this is a winner Tim.\n\nAnd worst case and someone re-gzips a v1 or haven\u0027t rebuild the ring, they just can\u0027t run file and get the version.\n\nThe fact that we just need to place the magic file and then can run `file \u003cring\u003e` is a huge win and much better then the hacks I had to do to get it into the comment header field of the gzip file further up the ringv2 chain!","commit_id":"2def45952ed9dc832fce6bd0e54373b033b0a28b"},{"author":{"_account_id":7233,"name":"Matthew Oliver","email":"matt@oliver.net.au","username":"mattoliverau"},"change_message_id":"efbe5b9986dae2052152e6be5b31ae8952115319","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":1,"id":"76e20170_ae5d6c5d","in_reply_to":"2da58cac_48d0ecc6","updated":"2025-03-17 05:59:24.000000000","message":"Sorry no I meant I also built a new ring with the decompressed magic, then went back to old (pre-ringv2) code and can still load the ring and all that jazz. Not that I didn\u0027t expect too, just wanted to make sure.","commit_id":"2def45952ed9dc832fce6bd0e54373b033b0a28b"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"6788df513713561ec825f376165d4698f0ef5c7a","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":1,"id":"2da58cac_48d0ecc6","in_reply_to":"b94a86f5_df08cbbd","updated":"2025-03-11 16:01:03.000000000","message":"\u003e Because your changing the compression level before writing the magic, I needed to rebuild rings first\n\nYeah, once I realized that https://review.opendev.org/c/openstack/swift/+/940491 would be in a similar boat (newly written rings could be recognized, but old ones would not), this seemed like an obvious direction to take.\n\n\u003e It\u0027s even working on a pre ringv2 code.\n\nYou mean your `swift-ring-builder ... version` command, right? \u0027Cause there\u0027s no way `file` will get much out of old rings.","commit_id":"2def45952ed9dc832fce6bd0e54373b033b0a28b"}],"etc/magic":[{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"6788df513713561ec825f376165d4698f0ef5c7a","unresolved":true,"context_lines":[{"line_number":1,"context_line":"#-------------------------------------------------------------------------------"},{"line_number":2,"context_line":"# Openstack swift"},{"line_number":3,"context_line":"# Note: add this snippet to either /etc/magic or ~/.magic"},{"line_number":4,"context_line":"0 beshort 0x1f8b gzip compressed"},{"line_number":5,"context_line":"# compress method: deflate, flags: FNAME"},{"line_number":6,"context_line":"\u003e\u00260 beshort 0x0808"},{"line_number":7,"context_line":"# skip ahead another 6 (MTIME, XLF, OS); read FNAME"}],"source_content_type":"application/octet-stream","patch_set":1,"id":"30022efb_f5e87eca","line":4,"range":{"start_line":4,"start_character":17,"end_line":4,"end_character":32},"updated":"2025-03-11 16:01:03.000000000","message":"Actually, we probably want to drop the messages until we confirm `R1NG`, so we don\u0027t go stomping on default gzip handling. I want output like:\n```\n$ file *.gz\nfoo-1.ring.gz: Swift ring file, version 1\nfoo-2.ring.gz: Swift ring file, version 2\nfoo.ring.gz:   Swift ring file, version 2\ntox.ini.gz:    gzip compressed data, was \"tox.ini\", last modified: Fri Mar  7 03:01:17 2025, from Unix, original size modulo 2^32 4852\n```","commit_id":"2def45952ed9dc832fce6bd0e54373b033b0a28b"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"6788df513713561ec825f376165d4698f0ef5c7a","unresolved":true,"context_lines":[{"line_number":15,"context_line":"\u003e\u003e\u003e\u003e\u00260 beshort 0x1 version 1"},{"line_number":16,"context_line":"\u003e\u003e\u003e\u003e\u00260 beshort 0x2 version 2"},{"line_number":17,"context_line":"\u003e\u003e\u003e\u003e\u00260 default x"},{"line_number":18,"context_line":"\u003e\u003e\u003e\u003e\u003e\u00260 beshort x unknown version (0x%04x)"}],"source_content_type":"application/octet-stream","patch_set":1,"id":"35e3a97a_cbbb6b65","line":18,"updated":"2025-03-11 16:01:03.000000000","message":"I\u0027m torn about this switch/case-like style or something more like\n```\n\u003e\u003e\u003e\u003e\u00260 beshort \u003c3    version %d\n\u003e\u003e\u003e\u003e\u00260 beshort \u003e2    unknown version (0x%04x)\n```\nso if/when we feel the need to add another version, we can just increment the bounds.","commit_id":"2def45952ed9dc832fce6bd0e54373b033b0a28b"},{"author":{"_account_id":7233,"name":"Matthew Oliver","email":"matt@oliver.net.au","username":"mattoliverau"},"change_message_id":"efbe5b9986dae2052152e6be5b31ae8952115319","unresolved":true,"context_lines":[{"line_number":15,"context_line":"\u003e\u003e\u003e\u003e\u00260 beshort 0x1 version 1"},{"line_number":16,"context_line":"\u003e\u003e\u003e\u003e\u00260 beshort 0x2 version 2"},{"line_number":17,"context_line":"\u003e\u003e\u003e\u003e\u00260 default x"},{"line_number":18,"context_line":"\u003e\u003e\u003e\u003e\u003e\u00260 beshort x unknown version (0x%04x)"}],"source_content_type":"application/octet-stream","patch_set":1,"id":"47298803_4e0a62d3","line":18,"in_reply_to":"35e3a97a_cbbb6b65","updated":"2025-03-17 05:59:24.000000000","message":"yeah not against that option, I mean the version is right there in the magic 😊","commit_id":"2def45952ed9dc832fce6bd0e54373b033b0a28b"}],"swift/common/ring/io.py":[{"author":{"_account_id":7233,"name":"Matthew Oliver","email":"matt@oliver.net.au","username":"mattoliverau"},"change_message_id":"54c1717ea5fb19dbbe64856b01a0f390809e078c","unresolved":true,"context_lines":[{"line_number":559,"context_line":"        if self.pos !\u003d 0:"},{"line_number":560,"context_line":"            raise IOError(\"Magic must be written at the start of the file\")"},{"line_number":561,"context_line":"        # switch to uncompressed, so libmagic can know what to expect"},{"line_number":562,"context_line":"        self._set_compression_level(0)"},{"line_number":563,"context_line":"        self.write(struct.pack(\"!4sH\", b\"R1NG\", version))"},{"line_number":564,"context_line":"        self._set_compression_level(9)"},{"line_number":565,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"7cc01ea7_8e712c42","line":562,"updated":"2025-03-11 06:07:24.000000000","message":"I wonder if this could be turned in the contextmanger so we can just go:\n\n```\nwith self._write_compression_level(0):\n    self.write(struct.pack(\"!4sH\", b\"R1NG\", version))\n```\n\nAnd then turn itself back on a finally.","commit_id":"2def45952ed9dc832fce6bd0e54373b033b0a28b"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"6788df513713561ec825f376165d4698f0ef5c7a","unresolved":true,"context_lines":[{"line_number":559,"context_line":"        if self.pos !\u003d 0:"},{"line_number":560,"context_line":"            raise IOError(\"Magic must be written at the start of the file\")"},{"line_number":561,"context_line":"        # switch to uncompressed, so libmagic can know what to expect"},{"line_number":562,"context_line":"        self._set_compression_level(0)"},{"line_number":563,"context_line":"        self.write(struct.pack(\"!4sH\", b\"R1NG\", version))"},{"line_number":564,"context_line":"        self._set_compression_level(9)"},{"line_number":565,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"97260426_b74ba75b","line":562,"in_reply_to":"7cc01ea7_8e712c42","updated":"2025-03-11 16:01:03.000000000","message":"I debated about something like that (and then updating `write_index` to use it, too, since it seems silly to write a new context manager for a single caller). Ultimately, I decided to be explicit like this so there\u0027d be no question of whether changing the compression level again would impact the length of that tail after the index.","commit_id":"2def45952ed9dc832fce6bd0e54373b033b0a28b"},{"author":{"_account_id":7233,"name":"Matthew Oliver","email":"matt@oliver.net.au","username":"mattoliverau"},"change_message_id":"efbe5b9986dae2052152e6be5b31ae8952115319","unresolved":true,"context_lines":[{"line_number":559,"context_line":"        if self.pos !\u003d 0:"},{"line_number":560,"context_line":"            raise IOError(\"Magic must be written at the start of the file\")"},{"line_number":561,"context_line":"        # switch to uncompressed, so libmagic can know what to expect"},{"line_number":562,"context_line":"        self._set_compression_level(0)"},{"line_number":563,"context_line":"        self.write(struct.pack(\"!4sH\", b\"R1NG\", version))"},{"line_number":564,"context_line":"        self._set_compression_level(9)"},{"line_number":565,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"cc73985e_ea9d06ef","line":562,"in_reply_to":"97260426_b74ba75b","updated":"2025-03-17 05:59:24.000000000","message":"Explicit is fine","commit_id":"2def45952ed9dc832fce6bd0e54373b033b0a28b"}]}
