You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2026/10/23 13:17:56 UTC
(mynewt-newtmgr) branch master updated (85b0589 -> 9be2b10)
This is an automated email from the ASF dual-hosted git repository.
sjanc pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git
from 85b0589 nmxact/nmcoap: Do not panic on invalid CoAP-TCP packet
new bddb268 newtmgr/config: Fix formatting of connstring error messages
new 352f04d newtmgr/cli: Fix format strings in res command output
new 95d4e20 nmxact/nmble: Avoid non-constant format strings in debug logs
new 041045b nmxact/mtech_lora: Print port number in invalid port error
new 9be2b10 ci: Run unit tests
The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.github/workflows/build.yml | 8 ++++++++
newtmgr/cli/res.go | 4 ++--
newtmgr/config/ble_config.go | 2 +-
newtmgr/config/bll_config.go | 2 +-
newtmgr/config/bll_config_windows.go | 2 +-
newtmgr/config/serial_config.go | 2 +-
nmxact/mtech_lora/mtech_lora_sesn.go | 2 +-
nmxact/nmble/ble_act.go | 10 +++++-----
nmxact/nmble/conn.go | 4 ++--
9 files changed, 22 insertions(+), 14 deletions(-)
(mynewt-newtmgr) 03/05: nmxact/nmble: Avoid non-constant format strings in debug logs
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sjanc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git
commit 95d4e20bd742854ec6819a82e9624fcad3f2d7bb
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Thu Oct 22 00:14:10 2026 +0200
nmxact/nmble: Avoid non-constant format strings in debug logs
Pre-formatted messages were passed to log.Debugf() as the format
string. Pass them as an argument instead so that any '%' in the
message is not interpreted, and so that go vet's printf check (run
as part of go test) passes.
Assisted-by: Claude:claude-opus-5-5
---
nmxact/nmble/ble_act.go | 10 +++++-----
nmxact/nmble/conn.go | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/nmxact/nmble/ble_act.go b/nmxact/nmble/ble_act.go
index 4a398a4..19c7b04 100644
--- a/nmxact/nmble/ble_act.go
+++ b/nmxact/nmble/ble_act.go
@@ -61,7 +61,7 @@ func connect(x *BleXport, bl *Listener, r *BleConnectReq) (uint16, error) {
str := fmt.Sprintf("BLE connection attempt failed; "+
"status=%s (%d)",
ErrCodeToString(msg.Status), msg.Status)
- log.Debugf(str)
+ log.Debugf("%s", str)
return 0, nmxutil.NewBleHostError(msg.Status, str)
}
@@ -72,13 +72,13 @@ func connect(x *BleXport, bl *Listener, r *BleConnectReq) (uint16, error) {
str := fmt.Sprintf("BLE connection attempt failed; "+
"status=%s (%d)",
ErrCodeToString(msg.Status), msg.Status)
- log.Debugf(str)
+ log.Debugf("%s", str)
return 0, nmxutil.NewBleHostError(msg.Status, str)
}
case *BleConnCancelEvt:
str := "BLE connection attempt cancelled"
- log.Debugf(str)
+ log.Debugf("%s", str)
return 0, fmt.Errorf("%s", str)
default:
@@ -943,14 +943,14 @@ func advStart(x *BleXport, bl *Listener, stopChan chan struct{},
str := fmt.Sprintf("BLE peer failed to connect to us; "+
"status=%s (%d)",
ErrCodeToString(msg.Status), msg.Status)
- log.Debugf(str)
+ log.Debugf("%s", str)
return 0, nmxutil.NewBleHostError(msg.Status, str)
}
case *BleAdvCompleteEvt:
str := fmt.Sprintf("Advertising stopped; reason=%s (%d)",
ErrCodeToString(msg.Reason), msg.Reason)
- log.Debugf(str)
+ log.Debugf("%s", str)
return 0, nmxutil.NewBleHostError(msg.Reason, str)
default:
diff --git a/nmxact/nmble/conn.go b/nmxact/nmble/conn.go
index b4c25a1..dd35a9c 100644
--- a/nmxact/nmble/conn.go
+++ b/nmxact/nmble/conn.go
@@ -290,7 +290,7 @@ func (c *Conn) eventListen(bl *Listener) error {
err := StatusError(MSG_OP_EVT,
MSG_TYPE_MTU_CHANGE_EVT,
msg.Status)
- log.Debugf(err.Error())
+ log.Debugf("%s", err.Error())
} else {
log.Debugf("BLE ATT MTU updated; from=%d to=%d",
c.attMtu, msg.Mtu)
@@ -303,7 +303,7 @@ func (c *Conn) eventListen(bl *Listener) error {
err = StatusError(MSG_OP_EVT,
MSG_TYPE_ENC_CHANGE_EVT,
msg.Status)
- log.Debugf(err.Error())
+ log.Debugf("%s", err.Error())
} else {
log.Debugf("Connection encrypted; conn_handle=%d",
msg.ConnHandle)
(mynewt-newtmgr) 04/05: nmxact/mtech_lora: Print port number in invalid port error
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sjanc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git
commit 041045b60fe646dafae7f48695fe0285b85e1590
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Thu Oct 22 00:14:10 2026 +0200
nmxact/mtech_lora: Print port number in invalid port error
The invalid Lora port error printed the device address with a %d
verb instead of the offending port number.
Assisted-by: Claude:claude-opus-5-5
---
nmxact/mtech_lora/mtech_lora_sesn.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nmxact/mtech_lora/mtech_lora_sesn.go b/nmxact/mtech_lora/mtech_lora_sesn.go
index 8fdff49..a87150e 100644
--- a/nmxact/mtech_lora/mtech_lora_sesn.go
+++ b/nmxact/mtech_lora/mtech_lora_sesn.go
@@ -71,7 +71,7 @@ func NewLoraSesn(cfg sesn.SesnCfg, lx *LoraXport) (*LoraSesn, error) {
}
if cfg.Lora.Port < 1 || cfg.Lora.Port > 223 {
- return nil, fmt.Errorf("Invalid Lora Port %d\n", cfg.Lora.Addr)
+ return nil, fmt.Errorf("Invalid Lora Port %d\n", cfg.Lora.Port)
}
s := &LoraSesn{
cfg: cfg,
(mynewt-newtmgr) 02/05: newtmgr/cli: Fix format strings in res command output
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sjanc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git
commit 352f04d4e77a4791bd6c3fcf8cb30d5c0ec4982f
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Thu Oct 22 00:14:10 2026 +0200
newtmgr/cli: Fix format strings in res command output
The JSON marshal error was passed to fmt.Sprintf() without a verb and
printDetails() output was used as a format string. Both are reported
by go vet's printf check, which blocks unit tests in this package.
Assisted-by: Claude:claude-opus-5-5
---
newtmgr/cli/res.go | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/newtmgr/cli/res.go b/newtmgr/cli/res.go
index fc422f4..7205be3 100644
--- a/newtmgr/cli/res.go
+++ b/newtmgr/cli/res.go
@@ -173,7 +173,7 @@ func resResponseStr(path string, cbor []byte) string {
}
j, err := json.MarshalIndent(cleanUpMapValue(m), "", " ")
if err != nil {
- s += fmt.Sprintf("\nerror: ", err)
+ s += fmt.Sprintf("\nerror: %s", err)
}
s += fmt.Sprintf("\n%v", string(j))
} else {
@@ -401,7 +401,7 @@ func runResCmd(cmd *cobra.Command, args []string) {
}
if details {
- fmt.Printf(printDetails(sres.Rsp))
+ fmt.Print(printDetails(sres.Rsp))
}
}
(mynewt-newtmgr) 05/05: ci: Run unit tests
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sjanc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git
commit 9be2b107fcf2b0b33af10e2a8f74b8e80739d165
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Thu Oct 22 00:14:10 2026 +0200
ci: Run unit tests
Run go test for all packages on every OS in the build matrix. On
Linux run it with the race detector enabled.
Assisted-by: Claude:claude-opus-5-5
---
.github/workflows/build.yml | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index b7b4c07..55f23e8 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -47,3 +47,11 @@ jobs:
newtmgr
newtmgr help
newtmgr version
+ - name: Unit tests
+ shell: bash
+ run: |
+ if [ "$RUNNER_OS" = "Linux" ]; then
+ go test -race ./...
+ else
+ go test ./...
+ fi
(mynewt-newtmgr) 01/05: newtmgr/config: Fix formatting of connstring error messages
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sjanc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git
commit bddb2684dc840b94984d9c9b683124cc8aee4ba2
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Thu Oct 22 00:14:10 2026 +0200
newtmgr/config: Fix formatting of connstring error messages
The einval*ConnString() helpers forwarded their variadic arguments to
fmt.Sprintf() as a single slice instead of spreading them, so error
messages were printed as e.g. "Invalid baud: [abc]" or ended with
"%!s(MISSING)". This also makes go vet's printf check fail, which
prevents adding unit tests to this package.
Assisted-by: Claude:claude-opus-5-5
---
newtmgr/config/ble_config.go | 2 +-
newtmgr/config/bll_config.go | 2 +-
newtmgr/config/bll_config_windows.go | 2 +-
newtmgr/config/serial_config.go | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/newtmgr/config/ble_config.go b/newtmgr/config/ble_config.go
index 142b177..5ce0286 100644
--- a/newtmgr/config/ble_config.go
+++ b/newtmgr/config/ble_config.go
@@ -58,7 +58,7 @@ func NewBleConfig() *BleConfig {
}
func einvalBleConnString(f string, args ...interface{}) error {
- suffix := fmt.Sprintf(f, args)
+ suffix := fmt.Sprintf(f, args...)
return util.FmtNewtError("Invalid BLE connstring; %s", suffix)
}
diff --git a/newtmgr/config/bll_config.go b/newtmgr/config/bll_config.go
index ac94087..fe39a09 100644
--- a/newtmgr/config/bll_config.go
+++ b/newtmgr/config/bll_config.go
@@ -54,7 +54,7 @@ func NewBllConfig() *BllConfig {
}
func einvalBllConnString(f string, args ...interface{}) error {
- suffix := fmt.Sprintf(f, args)
+ suffix := fmt.Sprintf(f, args...)
return util.FmtNewtError("Invalid BLE connstring; %s", suffix)
}
diff --git a/newtmgr/config/bll_config_windows.go b/newtmgr/config/bll_config_windows.go
index 277bcc9..e5e0e9c 100644
--- a/newtmgr/config/bll_config_windows.go
+++ b/newtmgr/config/bll_config_windows.go
@@ -42,7 +42,7 @@ func NewBllConfig() *BllConfig {
}
func einvalBllConnString(f string, args ...interface{}) error {
- suffix := fmt.Sprintf(f, args)
+ suffix := fmt.Sprintf(f, args...)
return util.FmtNewtError("Invalid BLE connstring; %s", suffix)
}
diff --git a/newtmgr/config/serial_config.go b/newtmgr/config/serial_config.go
index 41b5af1..a5288ec 100644
--- a/newtmgr/config/serial_config.go
+++ b/newtmgr/config/serial_config.go
@@ -30,7 +30,7 @@ import (
)
func einvalSerialConnString(f string, args ...interface{}) error {
- suffix := fmt.Sprintf(f, args)
+ suffix := fmt.Sprintf(f, args...)
return util.FmtNewtError("Invalid serial connstring; %s", suffix)
}