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

Fix OS handling of version string #232

Merged
merged 1 commit into from
Mar 27, 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
10 changes: 1 addition & 9 deletions trusted_os/ctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,11 @@ type controlInterface struct {
}

func getStatus() (s *api.Status) {
version, err := parseVersion(Version)
versionString := "unknown"
if err != nil {
log.Printf("failed to get version: %v", err)
} else {
versionString = version.String()
}

s = &api.Status{
SRKHash: SRKHash,
Revision: Revision,
Build: Build,
Version: versionString,
Version: osVersion.String(),
Runtime: fmt.Sprintf("%s %s/%s", runtime.Version(), runtime.GOOS, runtime.GOARCH),
// TODO(jayhou): set IdentityCounter here.
}
Expand Down
4 changes: 3 additions & 1 deletion trusted_os/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ func main() {
if imx6ul.Native && imx6ul.OCOTP != nil {
imx6ul.OCOTP.Timeout = 100 * time.Millisecond
}
// Strip off v from GitTag so we can semver parse it.
Version = strings.TrimPrefix(Version, "v")

var err error

Expand Down Expand Up @@ -195,7 +197,7 @@ func main() {
log.Fatalf("SM failed to create OS bundle verifier: %v", err)
}

if v, err := semver.NewVersion(strings.TrimPrefix(Version, "v")); err != nil {
if v, err := semver.NewVersion(Version); err != nil {
log.Printf("Failed to parse OS version %q: %v", Version, err)
} else {
osVersion = *v
Expand Down