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

State file: pickle to json #284

Closed
pchakraborty opened this issue May 2, 2024 · 3 comments
Closed

State file: pickle to json #284

pchakraborty opened this issue May 2, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@pchakraborty
Copy link
Collaborator

Consider switching to json serialization format for storing the state from the current pickle format. This would ensure that issues like #279 don't come up again. A json.dump without indentation should reduce the risk of hand editing of the state file.

For an older clone, made with mepo 1, a warning will be displayed, along with a solution of how to update to mepo 2 style state

Converting mepo1 state to mepo2 state
Run mepo update-state to permanently convert to mepo2 state

@pchakraborty pchakraborty added the enhancement New feature or request label May 2, 2024
@pchakraborty pchakraborty self-assigned this May 2, 2024
@mathomp4
Copy link
Member

mathomp4 commented May 8, 2024

Plus we'd be able to read the state file!

That said, could we somehow "write-protect" the file? That is, only "easily" allow changes via mepo? I'd be afraid someone would see a json file and think, oh, I can just edit this.

I mean, it's not hard to chmod +w but at if the script would be able to toggle the write bits, that might make things a bit safer

@pchakraborty
Copy link
Collaborator Author

@mathomp4 That, I think, can be easily done.

We can also consider taking the string generated by json.dumps and convert it to binary via ord or bytearray save that to file. I'll look into this.

@pchakraborty
Copy link
Collaborator Author

The state file is now in json format and is read-only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants