From 0382e0d4c286eb1741d821e54f38f47d1c8339d5 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Fri, 28 Oct 2022 02:55:28 +0200 Subject: [PATCH] OTM: Handle syntax errors at *both* stages when migrating defaults.persistent.lua We were pcall'ing the parsing, but not the execution... The funky Lua syntax quirks means that it is possible to pass the former but not the latter ;). Fix #9700, de-facto regression since #9546 --- frontend/ui/data/onetime_migration.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/ui/data/onetime_migration.lua b/frontend/ui/data/onetime_migration.lua index a6ef1b151..9ee12ce89 100644 --- a/frontend/ui/data/onetime_migration.lua +++ b/frontend/ui/data/onetime_migration.lua @@ -456,7 +456,14 @@ if last_migration_date < 20220930 then if not load_defaults then logger.warn("loadfile:", err) else - load_defaults() + -- User input, there may be syntax errors, go through pcall like we used to. + local ok, perr = pcall(load_defaults) + if not ok then + logger.warn("Failed to execute defaults.persistent.lua:", perr) + -- Don't keep *anything* around, to make it more obvious that something went screwy... + logger.warn("/!\\ YOU WILL HAVE TO MIGRATE YOUR CUSTOM defaults.lua SETTINGS MANUALLY /!\\") + defaults = {} + end end for k, v in pairs(defaults) do