On Wed, Mar 18, 2026 at 05:41:27PM +0200, Atanas Vladimirov wrote:
> On 2026-03-18 15:50, Claudio Jeker wrote:
> > On Sat, Mar 07, 2026 at 06:04:27PM +0200, Atanas Vladimirov wrote:
> >> Hi ports,
> >>
> >> This is a patch to update the Prometheus to the latest 2.x LTS version
> >> 2.53.5
> >> I'm testing it the last few days and so far so good.
> >>
> >> Please add me in CC because I'm not subscribed to the ports list.
> >>
> >> Best wishes,
> >> Atanas
> >
> > The patch does not apply. It seems your mail client tried to be helpful
> > and reformatted long lines like the SHA256 lines in distinfo.
> >
>
> Sorry for that. I'm sending the patch as attachment now.
> Also, I'm trying to send it as plain text below:
>
Thanks. I had a look at this and lifted prometheus to 3.5.1 (should be the
latest LTS) which was easier since the mmap_openbsd branch could be merged
right onto that without much conflicts.
I did not stress test any of it yet. It starts and works. Will try this
out now on my main prometheus box.
--
:wq Claudio
Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/prometheus/Makefile,v
diff -u -p -r1.23 Makefile
--- Makefile 25 Sep 2023 17:07:36 -0000 1.23
+++ Makefile 18 Mar 2026 15:48:22 -0000
@@ -1,6 +1,6 @@
COMMENT = systems monitoring and alerting toolkit
-V = 2.37.9
+V = 3.5.1
GH_ACCOUNT = prometheus
GH_PROJECT = prometheus
GH_TAGNAME = v${V}
@@ -30,7 +30,7 @@ MODULES = lang/go
MODGO_GOPATH = ${MODGO_WORKSPACE}
post-extract:
- mv ${WRKDIR}/static/react ${WRKDIST}/web/ui/static/
+ mv ${WRKDIR}/static ${WRKDIST}/web/ui/static
# promu doesn't like the default PREFIX
do-build:
@@ -42,14 +42,9 @@ do-install:
${INSTALL_DATA_DIR} ${WRKINST}/${SYSCONFDIR}/prometheus
${INSTALL_DATA_DIR} ${WRKINST}/${LOCALSTATEDIR}/prometheus
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/prometheus
- ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/prometheus/consoles
- ${INSTALL_DATA_DIR}
${PREFIX}/share/examples/prometheus/console_libraries
+ ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/prometheus
${INSTALL_PROGRAM} ${WRKSRC}/prometheus ${PREFIX}/bin
${INSTALL_PROGRAM} ${WRKSRC}/promtool ${PREFIX}/bin
- ${INSTALL_DATA} ${WRKSRC}/consoles/* \
- ${PREFIX}/share/examples/prometheus/consoles/
- ${INSTALL_DATA} ${WRKSRC}/console_libraries/{menu.lib,prom.lib} \
- ${PREFIX}/share/examples/prometheus/console_libraries
${INSTALL_DATA} ${WRKSRC}/documentation/examples/prometheus.yml \
${PREFIX}/share/examples/prometheus/prometheus.yml
${INSTALL_DATA} ${WRKSRC}/LICENSE ${PREFIX}/share/doc/prometheus/
Index: distinfo
===================================================================
RCS file: /cvs/ports/sysutils/prometheus/distinfo,v
diff -u -p -r1.12 distinfo
--- distinfo 6 Sep 2023 10:28:49 -0000 1.12
+++ distinfo 18 Mar 2026 15:30:30 -0000
@@ -1,6 +1,6 @@
-SHA256 (prometheus-2.37.9.tar.gz) =
gSoQplOidWqzAzS9TPBmH5TepeWUw3LTPRNwQHRgpGo=
-SHA256 (prometheus-vendor-2.37.9.tar.gz) =
ea+tEdN2yBEMBYY78U6tPOLI7uorbEhNL3o5/JTxaPI=
-SHA256 (prometheus-web-ui-2.37.9.tar.gz) =
2z6Ohg/dUEwQ5NxTn1wfxwVrKOPJGAWgSXNxb2lX4MA=
-SIZE (prometheus-2.37.9.tar.gz) = 6048911
-SIZE (prometheus-vendor-2.37.9.tar.gz) = 11758451
-SIZE (prometheus-web-ui-2.37.9.tar.gz) = 2390133
+SHA256 (prometheus-3.5.1.tar.gz) = rdZ3162GT87UPBS6CNooIT7+ibHje6WSnu9D1bgvaS8=
+SHA256 (prometheus-vendor-3.5.1.tar.gz) =
SfhHWwxq4/bzMvTfN9dn9IgxqNpXpzkL+0YczqKvp0E=
+SHA256 (prometheus-web-ui-3.5.1.tar.gz) =
1Cvm4TYLCadGMAKBj6uviDRzawIm6S7guO0SUQwIsgY=
+SIZE (prometheus-3.5.1.tar.gz) = 5129927
+SIZE (prometheus-vendor-3.5.1.tar.gz) = 16523299
+SIZE (prometheus-web-ui-3.5.1.tar.gz) = 3487629
Index: patches/patch-Makefile
===================================================================
RCS file: /cvs/ports/sysutils/prometheus/patches/patch-Makefile,v
diff -u -p -r1.7 patch-Makefile
--- patches/patch-Makefile 28 Feb 2023 17:54:21 -0000 1.7
+++ patches/patch-Makefile 18 Mar 2026 15:27:52 -0000
@@ -3,21 +3,21 @@ The react build is provided via extra di
Index: Makefile
--- Makefile.orig
+++ Makefile
-@@ -83,7 +83,7 @@ ui-lint:
- cd $(UI_PATH) && npm run lint
+@@ -81,7 +81,7 @@ ui-lint:
.PHONY: assets
+ ifndef SKIP_UI_BUILD
-assets: ui-install ui-build
+assets:
- .PHONY: assets-compress
- assets-compress: assets
-@@ -124,7 +124,7 @@ plugins/plugins.go: plugins.yml plugins/generate.go
+ .PHONY: npm_licenses
+ npm_licenses: ui-install
+@@ -160,7 +160,7 @@ plugins/plugins.go: plugins.yml plugins/generate.go
plugins: plugins/plugins.go
.PHONY: build
--build: assets npm_licenses assets-compress common-build plugins
-+build: assets-compress common-build plugins
+-build: assets npm_licenses assets-compress plugins common-build
++build: assets assets-compress plugins common-build
.PHONY: bench_tsdb
bench_tsdb: $(PROMU)
Index: patches/patch-Makefile_common
===================================================================
RCS file: /cvs/ports/sysutils/prometheus/patches/patch-Makefile_common,v
diff -u -p -r1.7 patch-Makefile_common
--- patches/patch-Makefile_common 28 Feb 2023 17:54:21 -0000 1.7
+++ patches/patch-Makefile_common 18 Mar 2026 15:27:52 -0000
@@ -3,7 +3,7 @@ Don't fetch promu form internet. This is
Index: Makefile.common
--- Makefile.common.orig
+++ Makefile.common
-@@ -232,11 +232,7 @@ common-docker-manifest:
+@@ -247,11 +247,7 @@ common-docker-manifest:
promu: $(PROMU)
$(PROMU):
@@ -14,5 +14,5 @@ Index: Makefile.common
- rm -r $(PROMU_TMP)
+ @true
- .PHONY: proto
- proto:
+ .PHONY: common-proto
+ common-proto:
Index: patches/patch-_promu_yml
===================================================================
RCS file: /cvs/ports/sysutils/prometheus/patches/patch-_promu_yml,v
diff -u -p -r1.6 patch-_promu_yml
--- patches/patch-_promu_yml 6 Sep 2023 10:28:49 -0000 1.6
+++ patches/patch-_promu_yml 18 Mar 2026 15:52:51 -0000
@@ -3,12 +3,11 @@ Don't include user and hostname into bui
Index: .promu.yml
--- .promu.yml.orig
+++ .promu.yml
-@@ -16,13 +16,13 @@ build:
+@@ -16,12 +16,13 @@ build:
- builtinassets
windows:
- builtinassets
-- flags: -a
-+ flags: -v -a
++ flags: -v
ldflags: |
- -X github.com/prometheus/common/version.Version={{.Version}}
- -X github.com/prometheus/common/version.Revision={{.Revision}}
Index: patches/patch-mmap_openbsd
===================================================================
RCS file: /cvs/ports/sysutils/prometheus/patches/patch-mmap_openbsd,v
diff -u -p -r1.3 patch-mmap_openbsd
--- patches/patch-mmap_openbsd 15 Jun 2023 08:52:07 -0000 1.3
+++ patches/patch-mmap_openbsd 18 Mar 2026 15:31:20 -0000
@@ -1,89 +1,131 @@
-Diff from https://github.com/prometheus/prometheus/issues/8799
-and https://github.com/prometheus/prometheus/pull/9085
-to make tsdb only use mmap and work around missing UBC support.
+commit 3b06998c0de93a710d262c70edbc5dad99d369cb
+Author: ston1th <[email protected]>
+Date: Jul 7 2021
+
+ tsdb: index write via mmap
+
+ This is a possible fix for the issues #8799 and #8877.
+
+ Changes made:
+
+ * introduce two mmaps:
+ * mmapRw: to read and write an mmaped region
+ * mmapRo: to read from an mmaped region
+ * implement a Writer interface for the RW mmap: `MmapWriter`
+ * this is used to write the index data instead of using the
+ underlying file descriptor
+ * the promql `ActiveQueryTracker` has been rewritten to also use
+ the `MmapWriter`
+ * the dependency `github.com/edsrzf/mmap-go` has been removed
+ * the test `TestDBReadOnly` is still broken on OpenBSD. This is caused
+ by the early call to `dbWritable.Close()`. This closes mmaps in
+ the background which are accessed later here which causes a segfault:
+ `require.Equal(t, expChunks, readOnlySeries, ...`
+
+ I ran the promql, tsdb and web tests with these changes on OpenBSD
+ (amd64), Linux (amd64) and Windows (amd64).
+ All tests (except TestDBReadOnly on OpenBSD) pass successfully.
+
+ Signed-off-by: ston1th <[email protected]>
diff --git go.mod go.mod
-index 39c3fcb5b..760b39a8b 100644
+index 7a27951ac..eee4405dd 100644
--- go.mod
+++ go.mod
-@@ -13,7 +13,6 @@ require (
- github.com/dgryski/go-sip13 v0.0.0-20200911182023-62edffca9245
- github.com/digitalocean/godo v1.81.0
- github.com/docker/docker v20.10.24+incompatible
-- github.com/edsrzf/mmap-go v1.1.0
- github.com/envoyproxy/go-control-plane v0.10.3
- github.com/envoyproxy/protoc-gen-validate v0.6.7
- github.com/fsnotify/fsnotify v1.5.4
+@@ -17,7 +17,6 @@ require (
+ github.com/dennwc/varint v1.0.0
+ github.com/digitalocean/godo v1.152.0
+ github.com/docker/docker v28.5.2+incompatible
+- github.com/edsrzf/mmap-go v1.2.0
+ github.com/envoyproxy/go-control-plane/envoy v1.32.4
+ github.com/envoyproxy/protoc-gen-validate v1.2.1
+ github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb
diff --git go.sum go.sum
-index e7aee4a9b..6b323945d 100644
+index 8ed834bcf..00ff455ac 100644
--- go.sum
+++ go.sum
-@@ -202,8 +202,6 @@ github.com/eapache/go-resiliency v1.1.0/go.mod
h1:kFI+JgMyC7bLPUVY133qvEBtVayf5m
- github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod
h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
- github.com/eapache/queue v1.1.0/go.mod
h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
- github.com/edsrzf/mmap-go v1.0.0/go.mod
h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
--github.com/edsrzf/mmap-go v1.1.0
h1:6EUwBLQ/Mcr1EYLE4Tn1VdW1A4ckqCQWZBw8Hr0kjpQ=
--github.com/edsrzf/mmap-go v1.1.0/go.mod
h1:19H/e8pUPLicwkyNgOykDXkJ9F0MHE+Z52B8EIth78Q=
- github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod
h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
- github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod
h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
- github.com/emicklei/go-restful v2.9.5+incompatible/go.mod
h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
+@@ -122,8 +122,6 @@ github.com/docker/go-connections v0.4.0
h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKoh
+ github.com/docker/go-connections v0.4.0/go.mod
h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
+ github.com/docker/go-units v0.5.0
h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
+ github.com/docker/go-units v0.5.0/go.mod
h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
+-github.com/edsrzf/mmap-go v1.2.0
h1:hXLYlkbaPzt1SaQk+anYwKSRNhufIDCchSPkUD6dD84=
+-github.com/edsrzf/mmap-go v1.2.0/go.mod
h1:19H/e8pUPLicwkyNgOykDXkJ9F0MHE+Z52B8EIth78Q=
+ github.com/emicklei/go-restful/v3 v3.11.0
h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g=
+ github.com/emicklei/go-restful/v3 v3.11.0/go.mod
h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
+ github.com/envoyproxy/go-control-plane/envoy v1.32.4
h1:jb83lalDRZSpPWW2Z7Mck/8kXZ5CQAFYVjQcdVIr83A=
diff --git promql/query_logger.go promql/query_logger.go
-index 716e7749b..8eb1afce0 100644
+index c0a70b66d..8aac517e2 100644
--- promql/query_logger.go
+++ promql/query_logger.go
-@@ -22,13 +22,13 @@ import (
+@@ -26,11 +26,11 @@ import (
"time"
"unicode/utf8"
- "github.com/edsrzf/mmap-go"
- "github.com/go-kit/log"
- "github.com/go-kit/log/level"
+ "github.com/prometheus/prometheus/tsdb/fileutil"
)
type ActiveQueryTracker struct {
-- mmapedFile []byte
+- mmappedFile []byte
+ mw *fileutil.MmapWriter
getNextIndex chan int
- logger log.Logger
- maxConcurrent int
-@@ -81,7 +81,7 @@ func logUnfinishedQueries(filename string, filesize int,
logger log.Logger) {
+ logger *slog.Logger
+ closer io.Closer
+@@ -87,12 +87,12 @@ func logUnfinishedQueries(filename string, filesize int,
logger *slog.Logger) {
+ }
+
+ type mmappedFile struct {
+- f io.Closer
+- m mmap.MMap
++ f io.Closer
++ mw *fileutil.MmapWriter
+ }
+
+ func (f *mmappedFile) Close() error {
+- err := f.m.Unmap()
++ err := f.mw.Close()
+ if err != nil {
+ err = fmt.Errorf("mmappedFile: unmapping: %w", err)
}
+@@ -103,7 +103,7 @@ func (f *mmappedFile) Close() error {
+ return err
}
--func getMMapedFile(filename string, filesize int, logger log.Logger) ([]byte,
error) {
-+func getMMapedFile(filename string, filesize int, logger log.Logger)
(*fileutil.MmapWriter, error) {
+-func getMMappedFile(filename string, filesize int, logger *slog.Logger)
([]byte, io.Closer, error) {
++func getMMappedFile(filename string, filesize int, logger *slog.Logger)
(*fileutil.MmapWriter, io.Closer, error) {
file, err := os.OpenFile(filename, os.O_CREATE|os.O_RDWR|os.O_TRUNC,
0o666)
if err != nil {
absPath, pathErr := filepath.Abs(filename)
-@@ -92,19 +92,13 @@ func getMMapedFile(filename string, filesize int, logger
log.Logger) ([]byte, er
- return nil, err
+@@ -114,21 +114,14 @@ func getMMappedFile(filename string, filesize int,
logger *slog.Logger) ([]byte,
+ return nil, nil, err
}
- err = file.Truncate(int64(filesize))
- if err != nil {
-- level.Error(logger).Log("msg", "Error setting filesize.",
"filesize", filesize, "err", err)
-- return nil, err
+- file.Close()
+- logger.Error("Error setting filesize.", "filesize", filesize,
"err", err)
+- return nil, nil, err
- }
-
- fileAsBytes, err := mmap.Map(file, mmap.RDWR, 0)
+ mw, err := fileutil.NewMmapWriterWithSize(file, filesize)
if err != nil {
- level.Error(logger).Log("msg", "Failed to mmap", "file",
filename, "Attempted size", filesize, "err", err)
- return nil, err
+ file.Close()
+ logger.Error("Failed to mmap", "file", filename, "Attempted
size", filesize, "err", err)
+ return nil, nil, err
}
-- return fileAsBytes, err
-+ return mw, err
+- return fileAsBytes, &mmappedFile{f: file, m: fileAsBytes}, err
++ return mw, &mmappedFile{f: file, mw: mw}, err
}
- func NewActiveQueryTracker(localStoragePath string, maxConcurrent int, logger
log.Logger) *ActiveQueryTracker {
-@@ -116,14 +110,17 @@ func NewActiveQueryTracker(localStoragePath string,
maxConcurrent int, logger lo
+ func NewActiveQueryTracker(localStoragePath string, maxConcurrent int, logger
*slog.Logger) *ActiveQueryTracker {
+@@ -140,15 +133,18 @@ func NewActiveQueryTracker(localStoragePath string,
maxConcurrent int, logger *s
filename, filesize := filepath.Join(localStoragePath,
"queries.active"), 1+maxConcurrent*entrySize
logUnfinishedQueries(filename, filesize, logger)
-- fileAsBytes, err := getMMapedFile(filename, filesize, logger)
-+ mw, err := getMMapedFile(filename, filesize, logger)
+- fileAsBytes, closer, err := getMMappedFile(filename, filesize, logger)
++ mw, closer, err := getMMappedFile(filename, filesize, logger)
if err != nil {
panic("Unable to create mmap-ed active query log")
}
@@ -94,16 +136,19 @@ index 716e7749b..8eb1afce0 100644
+ panic("Unable to write mmap-ed active query log")
+ }
activeQueryTracker := ActiveQueryTracker{
-- mmapedFile: fileAsBytes,
+- mmappedFile: fileAsBytes,
+ closer: closer,
+ mw: mw,
getNextIndex: make(chan int, maxConcurrent),
logger: logger,
maxConcurrent: maxConcurrent,
-@@ -180,19 +177,27 @@ func (tracker ActiveQueryTracker) GetMaxConcurrent() int
{
+@@ -205,19 +201,29 @@ func (tracker ActiveQueryTracker) GetMaxConcurrent() int
{
}
func (tracker ActiveQueryTracker) Delete(insertIndex int) {
-- copy(tracker.mmapedFile[insertIndex:], strings.Repeat("\x00",
entrySize))
+- copy(tracker.mmappedFile[insertIndex:], strings.Repeat("\x00",
entrySize))
++ buf := tracker.mw.Bytes()
++ copy(buf[insertIndex:], strings.Repeat("\x00", entrySize))
+ _, err := tracker.mw.WriteAt([]byte(strings.Repeat("\x00", entrySize)),
int64(insertIndex))
+ if err != nil {
+ panic("Unable to write mmap-ed active query log")
@@ -114,7 +159,7 @@ index 716e7749b..8eb1afce0 100644
func (tracker ActiveQueryTracker) Insert(ctx context.Context, query string)
(int, error) {
select {
case i := <-tracker.getNextIndex:
-- fileBytes := tracker.mmapedFile
+- fileBytes := tracker.mmappedFile
entry := newJSONEntry(query, tracker.logger)
start, end := i, i+entrySize
@@ -132,20 +177,20 @@ index 716e7749b..8eb1afce0 100644
case <-ctx.Done():
return 0, ctx.Err()
diff --git promql/query_logger_test.go promql/query_logger_test.go
-index ad76fb992..bd92b81af 100644
+index eb06e513e..ef2f85cfd 100644
--- promql/query_logger_test.go
+++ promql/query_logger_test.go
-@@ -19,13 +19,22 @@ import (
- "testing"
+@@ -21,12 +21,22 @@ import (
"github.com/grafana/regexp"
-+ "github.com/prometheus/prometheus/tsdb/fileutil"
"github.com/stretchr/testify/require"
++
++ "github.com/prometheus/prometheus/tsdb/fileutil"
)
func TestQueryLogging(t *testing.T) {
- fileAsBytes := make([]byte, 4096)
-+ file, err := ioutil.TempFile("", "mmapedFile")
++ file, err := os.CreateTemp("", "mmapedFile")
+ require.NoError(t, err)
+
+ filename := file.Name()
@@ -155,12 +200,12 @@ index ad76fb992..bd92b81af 100644
+ require.NoError(t, err)
+
queryLogger := ActiveQueryTracker{
-- mmapedFile: fileAsBytes,
+- mmappedFile: fileAsBytes,
+ mw: mw,
logger: nil,
getNextIndex: make(chan int, 4),
}
-@@ -45,6 +54,7 @@ func TestQueryLogging(t *testing.T) {
+@@ -46,6 +56,7 @@ func TestQueryLogging(t *testing.T) {
`^{"query":"","timestamp_sec":\d+}\x00*,$`,
`^{"query":"SpecialCharQuery{host=\\"2132132\\",
id=123123}","timestamp_sec":\d+}\x00*,$`,
}
@@ -168,12 +213,12 @@ index ad76fb992..bd92b81af 100644
// Check for inserts of queries.
for i := 0; i < 4; i++ {
-@@ -67,9 +77,17 @@ func TestQueryLogging(t *testing.T) {
+@@ -68,9 +79,17 @@ func TestQueryLogging(t *testing.T) {
}
func TestIndexReuse(t *testing.T) {
- queryBytes := make([]byte, 1+3*entrySize)
-+ file, err := ioutil.TempFile("", "mmapedFile")
++ file, err := os.CreateTemp("", "mmapedFile")
+ require.NoError(t, err)
+
+ filename := file.Name()
@@ -183,12 +228,12 @@ index ad76fb992..bd92b81af 100644
+ require.NoError(t, err)
+
queryLogger := ActiveQueryTracker{
-- mmapedFile: queryBytes,
+- mmappedFile: queryBytes,
+ mw: mw,
logger: nil,
getNextIndex: make(chan int, 3),
}
-@@ -91,6 +109,7 @@ func TestIndexReuse(t *testing.T) {
+@@ -92,6 +111,7 @@ func TestIndexReuse(t *testing.T) {
`^{"query":"ThisShouldBeInsertedAtIndex2","timestamp_sec":\d+}\x00*,$`,
`^{"query":"TestQuery3","timestamp_sec":\d+}\x00*,$`,
}
@@ -196,26 +241,24 @@ index ad76fb992..bd92b81af 100644
// Check all bytes and verify new query was inserted at index 2
for i := 0; i < 3; i++ {
-@@ -110,10 +129,12 @@ func TestMMapFile(t *testing.T) {
- filename := file.Name()
- defer os.Remove(filename)
+@@ -109,9 +129,10 @@ func TestMMapFile(t *testing.T) {
+ fpath := filepath.Join(dir, "mmappedFile")
+ const data = "ab"
-- fileAsBytes, err := getMMapedFile(filename, 2, nil)
-+ mw, err := getMMapedFile(filename, 2, nil)
-+ require.NoError(t, err)
-
-+ fileAsBytes := mw.Bytes()
-+ _, err = mw.Write([]byte("ab"))
+- fileAsBytes, closer, err := getMMappedFile(fpath, 2, nil)
++ mw, closer, err := getMMappedFile(fpath, 2, nil)
require.NoError(t, err)
-- copy(fileAsBytes, "ab")
+- copy(fileAsBytes, data)
++ buf := mw.Bytes()
++ copy(buf, data)
+ require.NoError(t, closer.Close())
- f, err := os.Open(filename)
- require.NoError(t, err)
+ f, err := os.Open(fpath)
diff --git tsdb/fileutil/mmap.go tsdb/fileutil/mmap.go
-index 4dbca4f97..e1c522472 100644
+index 782ff27ec..d6b9a681b 100644
--- tsdb/fileutil/mmap.go
+++ tsdb/fileutil/mmap.go
-@@ -20,8 +20,31 @@ import (
+@@ -19,8 +19,31 @@ import (
)
type MmapFile struct {
@@ -236,27 +279,27 @@ index 4dbca4f97..e1c522472 100644
+ if size <= 0 {
+ info, err := f.Stat()
+ if err != nil {
-+ return nil, errors.Wrap(err, "stat")
++ return nil, fmt.Errorf("stat: %w", err)
+ }
+ size = int(info.Size())
+ }
+
+ b, err := mmapRw(f, size)
+ if err != nil {
-+ return nil, errors.Wrapf(err, "mmap, size %d", size)
++ return nil, fmt.Errorf("mmap, size %d: %w", size, err)
+ }
+ return &MmapFile{f: f, b: b, rw: true}, nil
}
func OpenMmapFile(path string) (*MmapFile, error) {
-@@ -46,22 +69,53 @@ func OpenMmapFileWithSize(path string, size int) (mf
*MmapFile, retErr error) {
+@@ -45,22 +68,53 @@ func OpenMmapFileWithSize(path string, size int) (mf
*MmapFile, retErr error) {
size = int(info.Size())
}
- b, err := mmap(f, size)
+ b, err := mmapRo(f, size)
if err != nil {
- return nil, errors.Wrapf(err, "mmap, size %d", size)
+ return nil, fmt.Errorf("mmap, size %d: %w", size, err)
}
+ return &MmapFile{f: f, b: b, closeFile: true}, nil
+}
@@ -265,11 +308,11 @@ index 4dbca4f97..e1c522472 100644
+func (f *MmapFile) resize(size int) error {
+ err := f.Sync()
+ if err != nil {
-+ return errors.Wrap(err, "resize sync")
++ return fmt.Errorf("resize sync: %w", err)
+ }
+ err = munmap(f.b)
+ if err != nil {
-+ return errors.Wrap(err, "resize munmap")
++ return fmt.Errorf("resize munmap: %w", err)
+ }
+ var b []byte
+ if f.rw {
@@ -278,7 +321,7 @@ index 4dbca4f97..e1c522472 100644
+ b, err = mmapRo(f.f, size)
+ }
+ if err != nil {
-+ return errors.Wrap(err, "resize mmap")
++ return fmt.Errorf("resize mmap: %w", err)
+ }
+ f.b = b
+ return nil
@@ -296,13 +339,13 @@ index 4dbca4f97..e1c522472 100644
if err0 != nil {
- return err0
-+ return errors.Wrap(err0, "close sync")
++ return fmt.Errorf("close sync: %w", err0)
+ }
+ if err1 != nil {
-+ return errors.Wrap(err1, "close munmap")
++ return fmt.Errorf("close munmap: %w", err1)
+ }
+ if err2 != nil {
-+ return errors.Wrap(err2, "close file")
++ return fmt.Errorf("close file: %w", err2)
}
- return err1
+ return nil
@@ -368,10 +411,10 @@ index 000000000..31fd98e6d
+ return nil
+}
diff --git tsdb/fileutil/mmap_unix.go tsdb/fileutil/mmap_unix.go
-index 1fd7f48ff..c83a32011 100644
+index 3d15e1a8c..9a7c62816 100644
--- tsdb/fileutil/mmap_unix.go
+++ tsdb/fileutil/mmap_unix.go
-@@ -22,10 +22,14 @@ import (
+@@ -21,10 +21,14 @@ import (
"golang.org/x/sys/unix"
)
@@ -582,10 +625,10 @@ index 000000000..86c1504e4
+ return
+}
diff --git tsdb/index/index.go tsdb/index/index.go
-index 29295c45f..451c80582 100644
+index edcb92a71..36ba9d291 100644
--- tsdb/index/index.go
+++ tsdb/index/index.go
-@@ -257,6 +257,7 @@ func (w *Writer) addPadding(size int) error {
+@@ -272,6 +272,7 @@ func (w *Writer) addPadding(size int) error {
type FileWriter struct {
f *os.File
fbuf *bufio.Writer
@@ -593,7 +636,7 @@ index 29295c45f..451c80582 100644
pos uint64
name string
}
-@@ -266,14 +267,20 @@ func NewFileWriter(name string) (*FileWriter, error) {
+@@ -281,14 +282,20 @@ func NewFileWriter(name string) (*FileWriter, error) {
if err != nil {
return nil, err
}
@@ -615,7 +658,7 @@ index 29295c45f..451c80582 100644
func (fw *FileWriter) Pos() uint64 {
return fw.pos
}
-@@ -304,7 +311,7 @@ func (fw *FileWriter) WriteAt(buf []byte, pos uint64)
error {
+@@ -319,7 +326,7 @@ func (fw *FileWriter) WriteAt(buf []byte, pos uint64)
error {
if err := fw.Flush(); err != nil {
return err
}
@@ -624,7 +667,7 @@ index 29295c45f..451c80582 100644
return err
}
-@@ -326,7 +333,7 @@ func (fw *FileWriter) Close() error {
+@@ -341,7 +348,7 @@ func (fw *FileWriter) Close() error {
if err := fw.Flush(); err != nil {
return err
}
@@ -633,7 +676,7 @@ index 29295c45f..451c80582 100644
return err
}
return fw.f.Close()
-@@ -987,11 +994,11 @@ func (w *Writer) writePostings() error {
+@@ -1026,11 +1033,11 @@ func (w *Writer) writePostings() error {
if err := w.fP.Flush(); err != nil {
return err
}
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/sysutils/prometheus/pkg/PLIST,v
diff -u -p -r1.7 PLIST
--- pkg/PLIST 8 Nov 2022 11:17:11 -0000 1.7
+++ pkg/PLIST 18 Mar 2026 15:48:34 -0000
@@ -8,17 +8,6 @@ share/doc/prometheus/
share/doc/prometheus/LICENSE
share/doc/prometheus/NOTICE
share/examples/prometheus/
-share/examples/prometheus/console_libraries/
-share/examples/prometheus/console_libraries/menu.lib
-share/examples/prometheus/console_libraries/prom.lib
-share/examples/prometheus/consoles/
-share/examples/prometheus/consoles/index.html.example
-share/examples/prometheus/consoles/node-cpu.html
-share/examples/prometheus/consoles/node-disk.html
-share/examples/prometheus/consoles/node-overview.html
-share/examples/prometheus/consoles/node.html
-share/examples/prometheus/consoles/prometheus-overview.html
-share/examples/prometheus/consoles/prometheus.html
share/examples/prometheus/prometheus.yml
@sample ${SYSCONFDIR}/prometheus/prometheus.yml
@mode 0755