From 4af4c1236d030222bb7275caaf4c7adc59d25920 Mon Sep 17 00:00:00 2001 From: Dhia Ayachi Date: Wed, 5 Feb 2025 13:29:26 -0500 Subject: [PATCH 1/4] fix logging time arch and os --- logging/logfile_bsd.go | 4 ++-- logging/logfile_darwin.go | 19 +++++++++++++++++++ logging/logfile_linux.go | 2 +- 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 logging/logfile_darwin.go diff --git a/logging/logfile_bsd.go b/logging/logfile_bsd.go index 21e579424563..b97fd1dabc00 100644 --- a/logging/logfile_bsd.go +++ b/logging/logfile_bsd.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: BUSL-1.1 -//go:build darwin || freebsd || netbsd || openbsd +//go:build freebsd || netbsd || openbsd package logging @@ -13,6 +13,6 @@ import ( func (l *LogFile) createTime(stat os.FileInfo) time.Time { stat_t := stat.Sys().(*syscall.Stat_t) - createTime := stat_t.Ctimespec + createTime := stat_t.Ctim return time.Unix(int64(createTime.Sec), int64(createTime.Nsec)) //nolint:unconvert } diff --git a/logging/logfile_darwin.go b/logging/logfile_darwin.go new file mode 100644 index 000000000000..fc4a185f13d8 --- /dev/null +++ b/logging/logfile_darwin.go @@ -0,0 +1,19 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +//go:build darwin + +package logging + +import ( + "os" + "syscall" + "time" +) + +func (l *LogFile) createTime(stat os.FileInfo) time.Time { + stat_t := stat.Sys().(*syscall.Stat_t) + createTime := stat_t.Ctimespec + // Sec and Nsec are int32 in 32-bit architectures. + return time.Unix(int64(createTime.Sec), int64(createTime.Nsec)) //nolint:unconvert +} diff --git a/logging/logfile_linux.go b/logging/logfile_linux.go index 1e8f19b1da72..d841539e0d78 100644 --- a/logging/logfile_linux.go +++ b/logging/logfile_linux.go @@ -1,7 +1,7 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: BUSL-1.1 -//go:build dragonfly || linux +//go:build dragonfly || linux || darwin package logging From 5484f3815d018a77d3e36ed19fd6971c7c4e03c5 Mon Sep 17 00:00:00 2001 From: Dhia Ayachi Date: Tue, 11 Feb 2025 09:49:15 -0500 Subject: [PATCH 2/4] fix logging time for bsd --- logging/logfile_bsd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logging/logfile_bsd.go b/logging/logfile_bsd.go index b97fd1dabc00..6f767214d0dd 100644 --- a/logging/logfile_bsd.go +++ b/logging/logfile_bsd.go @@ -13,6 +13,6 @@ import ( func (l *LogFile) createTime(stat os.FileInfo) time.Time { stat_t := stat.Sys().(*syscall.Stat_t) - createTime := stat_t.Ctim + createTime := stat_t.Ctimespec return time.Unix(int64(createTime.Sec), int64(createTime.Nsec)) //nolint:unconvert } From 4f804d978b84ad9e78e1ccd848a673a6dd881ee9 Mon Sep 17 00:00:00 2001 From: "nitin.sachdev" Date: Wed, 12 Feb 2025 12:47:14 +0530 Subject: [PATCH 3/4] added changelog entry --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 015774e57fd1..440c563907a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.20.3 (February 12, 2025) +BUG FIXES: + +* Fixed logging error while building for OpenBSD OS [[GH-22120](https://github.com/hashicorp/consul/pull/22120)] + ## 1.15.18 Enterprise (February 07, 2025) Enterprise LTS: Consul Enterprise 1.15 is a Long-Term Support (LTS) release. From b93ffba4dffae2c206ca476695936914a6ae4b6b Mon Sep 17 00:00:00 2001 From: "nitin.sachdev" Date: Wed, 12 Feb 2025 13:09:10 +0530 Subject: [PATCH 4/4] added changelog file --- .changelog/22120.txt | 3 +++ CHANGELOG.md | 5 ----- 2 files changed, 3 insertions(+), 5 deletions(-) create mode 100644 .changelog/22120.txt diff --git a/.changelog/22120.txt b/.changelog/22120.txt new file mode 100644 index 000000000000..e3eb4e23be61 --- /dev/null +++ b/.changelog/22120.txt @@ -0,0 +1,3 @@ +```release-note:bug +Fixed logging error while building for OpenBSD OS [[GH-22120](https://github.com/hashicorp/consul/pull/22120)] +``` diff --git a/CHANGELOG.md b/CHANGELOG.md index 440c563907a2..015774e57fd1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,3 @@ -## 1.20.3 (February 12, 2025) -BUG FIXES: - -* Fixed logging error while building for OpenBSD OS [[GH-22120](https://github.com/hashicorp/consul/pull/22120)] - ## 1.15.18 Enterprise (February 07, 2025) Enterprise LTS: Consul Enterprise 1.15 is a Long-Term Support (LTS) release.