You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2022/03/08 23:04:07 UTC

[mynewt-newt] branch master updated: Ignore non-existing value for defunct setting

This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git


The following commit(s) were added to refs/heads/master by this push:
     new 9ad5564  Ignore non-existing value for defunct setting
9ad5564 is described below

commit 9ad556437240999e872720b79a5c8f25f9bbeae6
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Sat Mar 5 17:55:22 2022 +0100

    Ignore non-existing value for defunct setting
    
    We only care if value was set somewhere, default value does not really
    matter.
---
 newt/syscfg/syscfg.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/newt/syscfg/syscfg.go b/newt/syscfg/syscfg.go
index cb76ae5..d23fa57 100644
--- a/newt/syscfg/syscfg.go
+++ b/newt/syscfg/syscfg.go
@@ -455,6 +455,10 @@ func readSetting(name string, lpkg *pkg.LocalPackage,
 	valueVal, valueExist := vals["value"]
 	if valueExist {
 		entry.Value = stringValue(valueVal)
+	} else if entry.State == CFG_SETTING_STATE_DEFUNCT {
+		// defunct settings do not need default value, we only care if
+		// value was set anywhere and emit an error then
+		entry.Value = ""
 	} else {
 		return entry, util.FmtNewtError(
 			"setting %s does not have required value field", name)