Repository navigation
Start with config.plist.bak when config.plist can't be loaded - #3
Merged
Merged
Conversation
A power cut while the editor saved config.plist could leave it missing or cut short, and OpenCore stopped before the picker. It now loads the backup the editor wrote and checked just before, says so in the options editor, and Undo puts it back. While running from the backup the editor never writes it. TestPickerEditor cuts the power after every number of writes and deletes in a save and in the repair, and checks that the next start always finds a config.
Messages from before the log is set up are logged again once it is, with HaltLevel of the configuration loaded in the end. The error about a config.plist that could not be loaded, or a chosen configuration that could not be used, then stopped OpenCore with the usual HaltLevel (DEBUG_ERROR) right after it had started with the backup or the default. Only the last failure is an error now.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If
config.plistcan't be loaded (missing, or cut short because the power went out while the editor was saving it), OpenCore now starts withconfig.plist.bakinstead of hanging before the picker. The editor already writes that backup before every save, so it's the last config that worked. The options editor says it started from the backup, and "Undo the last save" puts it back asconfig.plist. With a vault the backup is never used.While running from the backup, the editor doesn't overwrite
config.plist.bak, so another cut can't take away the only good copy.Second commit fixes a hang I found testing this in QEMU. Log lines from before the log is set up get logged again once it is, using the
HaltLevelof the config that ended up loaded. The "failed to parse config.plist" error then tripped the usualHaltLevel(0x80000000) and stopped OpenCore right after it had loaded the backup. The same thing already happens on main when a config chosen from the editor can't be loaded: it hangs instead of falling back toconfig.plist, and withkeepit hangs on every boot. A failed file that gets replaced by another one is now a warning, and only the last failure is an error.Tested:
DrogaBox/run-tests.shpasses, also with SANITIZE. The power-cut test cuts at every step of a save and of the undo.Target67 andHaltLevel0x80000000:keep: falls back to the default;config.plistand the next boot loads it.Not tried on real hardware or with a real power cut.