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

newt: Fix config check for entries with description #570

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test_ambiguous_cfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ jobs:
cp -r .github/targets/ambiguous_fail project/targets
cd project/
! newt build ambiguous_fail &> tmp.txt
grep "Error: Setting CONSOLE_IMPLEMENTATION collision - two conditions true:" tmp.txt -q
grep "Error: setting CONSOLE_IMPLEMENTATION collision - two conditions true:" tmp.txt -q
5 changes: 3 additions & 2 deletions newt/ycfg/ycfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package ycfg
import (
"fmt"
"mynewt.apache.org/newt/newt/cfgv"
"reflect"
"strings"

"github.com/spf13/cast"
Expand Down Expand Up @@ -470,8 +471,8 @@ func (yc *YCfg) GetStringMap(
}

if _, exists := result[k]; exists {
if (entry.Value != result[k].Value) && (result[k].Expr != nil) {
return nil, fmt.Errorf("Setting %s collision - two conditions true:\n[%s, %s]\n"+
if !reflect.DeepEqual(entry.Value, result[k].Value) && (result[k].Expr != nil) && (entry.Expr != nil) {
return nil, fmt.Errorf("setting %s collision - two conditions true:\n[%s, %s]\n"+
"Conflicting file: %s",
k, entry.Expr.String(), result[k].Expr.String(), yc.name)
}
Expand Down
Loading