Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Jun 9, 2021
Merged

Conversation

MarshallOfSound
Copy link
Member

python2 and python3 have subtley different behavior when getting keys() from a JSON parsed dictionary. Forcing the dictionary to be an OrderedDict ensures the behavior is consistent (and what we have documented).

Notes: Electron Fuses are now in a consistent order across platforms

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Jun 9, 2021
@MarshallOfSound MarshallOfSound added fast-track 🚅 Indicates that this PR is intended to bypass the 24 hour rule. Needs approval from Releases and removed new-pr 🌱 PR opened in the last 24 hours labels Jun 9, 2021
@electron-cation electron-cation bot added new-pr 🌱 PR opened in the last 24 hours and removed new-pr 🌱 PR opened in the last 24 hours labels Jun 9, 2021
@MarshallOfSound MarshallOfSound added the semver/patch backwards-compatible bug fixes label Jun 9, 2021
@@ -50,7 +51,7 @@
"""

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will sort the keys alphabetically, right? Is that what we want?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this will keep keys in the order in which they are added.

dict subclass that remembers the order entries were added

And the JSON loader adds them in order of appearance.

@MarshallOfSound MarshallOfSound merged commit 73266f8 into main Jun 9, 2021
@MarshallOfSound MarshallOfSound deleted the fix-fuse-order branch June 9, 2021 15:30
@release-clerk
Copy link

release-clerk bot commented Jun 9, 2021

Release Notes Persisted

Electron Fuses are now in a consistent order across platforms

@trop
Copy link
Contributor

trop bot commented Jun 9, 2021

I have automatically backported this PR to "13-x-y", please check out #29615

@trop
Copy link
Contributor

trop bot commented Jun 9, 2021

I have automatically backported this PR to "14-x-y", please check out #29616

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fast-track 🚅 Indicates that this PR is intended to bypass the 24 hour rule. Needs approval from Releases semver/patch backwards-compatible bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants