fix: ensure fuse order is read in a stable way (#29599)

This commit is contained in:
Samuel Attard 2021-06-09 08:30:02 -07:00 committed by GitHub
parent 5f2e25b0b2
commit 73266f8f3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from collections import OrderedDict
import json import json
import os import os
import sys import sys
@ -50,7 +51,7 @@ const volatile char kFuseWire[] = { /* sentinel */ {sentinel}, /* fuse_version *
""" """
with open(os.path.join(dir_path, "fuses.json5"), 'r') as f: with open(os.path.join(dir_path, "fuses.json5"), 'r') as f:
fuse_defaults = json.loads(''.join(line for line in f.readlines() if not line.strip()[0] == "/")) fuse_defaults = json.loads(''.join(line for line in f.readlines() if not line.strip()[0] == "/"), object_pairs_hook=OrderedDict)
fuse_version = fuse_defaults['_version'] fuse_version = fuse_defaults['_version']
del fuse_defaults['_version'] del fuse_defaults['_version']