{"action":"created","issue":{"url":"https://api.github.com/repos/letscontrolit/ESPEasy/issues/1292","repository_url":"https://api.github.com/repos/letscontrolit/ESPEasy","labels_url":"https://api.github.com/repos/letscontrolit/ESPEasy/issues/1292/labels{/name}","comments_url":"https://api.github.com/repos/letscontrolit/ESPEasy/issues/1292/comments","events_url":"https://api.github.com/repos/letscontrolit/ESPEasy/issues/1292/events","html_url":"https://github.com/letscontrolit/ESPEasy/issues/1292","id":316521204,"number":1292,"title":"Change how settings are saved (alignment and padding)","user":{"login":"TD-er","id":3751318,"avatar_url":"https://avatars3.githubusercontent.com/u/3751318?v=4","gravatar_id":"","url":"https://api.github.com/users/TD-er","html_url":"https://github.com/TD-er","followers_url":"https://api.github.com/users/TD-er/followers","following_url":"https://api.github.com/users/TD-er/following{/other_user}","gists_url":"https://api.github.com/users/TD-er/gists{/gist_id}","starred_url":"https://api.github.com/users/TD-er/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TD-er/subscriptions","organizations_url":"https://api.github.com/users/TD-er/orgs","repos_url":"https://api.github.com/users/TD-er/repos","events_url":"https://api.github.com/users/TD-er/events{/privacy}","received_events_url":"https://api.github.com/users/TD-er/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":14,"created_at":"2018-04-21T20:03:46Z","updated_at":"2018-04-21T22:05:14Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"The last few builds, there were lots of issues related to crashes, freezes, and other kinds of mayhem in ESPeasy-world.\r\n\r\nA first indication is the report of CRC errors while reading the settings file, but also loading previously saved settings will fail.\r\n\r\nThe storage of settings is just a very basic binary dump of memory starting at the address of the Settings object.\r\nThat should be fine, as long as all items in that struct are the same size.\r\nHowever, they are not. It is ranging from booleans(1 bit) to unsigned long (32 bit) to arrays of bytes/chars and 2-dimensional arrays of unsigned int.\r\nTo complicate stuff even more, are there compilers which do apply [padding and make objects align at addresses multiple of 4](https://en.wikipedia.org/wiki/Data_structure_alignment). \r\nThis means that storing a struct with:\r\n\r\n1. int\r\n2. byte\r\n3. byte\r\n4. bool\r\n5. bool\r\n\r\nMay (or may not) use less bytes than:\r\n\r\n1. bool\r\n2. int\r\n3. byte\r\n4. bool\r\n5. byte\r\n\r\nAnd then there are differences in compilers and optimization flags.\r\nSimply stated, the current way of storing data is fine as long as you're always using the same compiler with the same compiler settings and the same struct.\r\n\r\nNow back to reality....\r\nPeople will be using pre-built versions and every now and then build their own.\r\nWe're adding members to the settings struct.\r\n\r\nSo in other words, for now, please use clean settings when upgrading to another version.\r\nAnd we should add a proper import/export option for settings to make sure the updates are as smooth as can be.\r\nAt this moment, it looks like we have to consider all settings possibly tainted, due to the reasons mentioned earlier.\r\n\r\nI could try for now, as a quick work-around, make the settings appear stable again and refuse to read previously stored settings. (simply refusing to read when CRC fails)\r\n\r\nPlease comment on the offered ideas, or offer some new suggestions."},"comment":{"url":"https://api.github.com/repos/letscontrolit/ESPEasy/issues/comments/383335368","html_url":"https://github.com/letscontrolit/ESPEasy/issues/1292#issuecomment-383335368","issue_url":"https://api.github.com/repos/letscontrolit/ESPEasy/issues/1292","id":383335368,"user":{"login":"TD-er","id":3751318,"avatar_url":"https://avatars3.githubusercontent.com/u/3751318?v=4","gravatar_id":"","url":"https://api.github.com/users/TD-er","html_url":"https://github.com/TD-er","followers_url":"https://api.github.com/users/TD-er/followers","following_url":"https://api.github.com/users/TD-er/following{/other_user}","gists_url":"https://api.github.com/users/TD-er/gists{/gist_id}","starred_url":"https://api.github.com/users/TD-er/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TD-er/subscriptions","organizations_url":"https://api.github.com/users/TD-er/orgs","repos_url":"https://api.github.com/users/TD-er/repos","events_url":"https://api.github.com/users/TD-er/events{/privacy}","received_events_url":"https://api.github.com/users/TD-er/received_events","type":"User","site_admin":false},"created_at":"2018-04-21T22:05:14Z","updated_at":"2018-04-21T22:05:14Z","author_association":"CONTRIBUTOR","body":"Currently the CRC for the security settings is also not causing any issues, because that struct has not been extended for a while"}}
{"actor":{"display_login":"TD-er"}}