Bug 296530 - databases/lmdb: please revert to 0.9 for now and properly plan 1.0 migration
Summary: databases/lmdb: please revert to 0.9 for now and properly plan 1.0 migration
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Xin LI
URL: https://github.com/LMDB/lmdb/blob/mdb...
Keywords: regression
Depends on:
Blocks: 296519 296529 296531
  Show dependency treegraph
 
Reported: 2026-07-05 10:25 UTC by Matthias Andree
Modified: 2026-07-19 08:11 UTC (History)
11 users (show)

See Also:
bugzilla: maintainer-feedback? (delphij)


Attachments
Proposed change (56.31 KB, patch)
2026-07-05 17:00 UTC, Xin LI
no flags Details | Diff
fixes for devel/appstream and databases/ldb29 (1.10 KB, patch)
2026-07-06 17:11 UTC, Craig Leres
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Andree freebsd_committer freebsd_triage 2026-07-05 10:25:29 UTC
LMDB 0.9 and 1.0 have different and incompatible on-disk formats, and some semi-hidden breakage in the API, in that applications that used to work with 0.9 happily compile with 1.0 but fail at run-time.

Known breakage has been reported against dns/knot3, mail/bogofilter, and upstream for mail/postfix, see https://www.mail-archive.com/postfix-users@postfix.org/msg108079.html and https://www.mail-archive.com/postfix-users@postfix.org/msg108091.html

Daniel researched similar issues in Linux upstreams, f.i. Arch Linux here, https://gitlab.archlinux.org/archlinux/packaging/packages/lmdb/-/work_items/5#note_508323 he claims that Samba can also be affected in certain configurations for some use cases.

NOTE: AN -exp RUN IS INSUFFICIENT! Package X/Y "builds" does not imply "works".
The Postfix failure won't appear in an -exp run, but at run-time only.

The bogofilter failure is only apparent in fallout because I enforced the self-test from post-build, which annoyed some people but is a lucky situation now because we don't have a bogofilter package with LMDB so we don't break users.


I propose the following: Please

1. repocopy the existing 1.0.0 databases/lmdb to databases/lmdb1,
2. revert databases/lmdb to the latest 0.9.X version, remember to add a PORTEPOCH,
3 let's use this as a meta-bug to coordinate required user instructions and application upgrades.
4. let's call in all maintainers of ports using LMDB for their assistance and checking with upstreams.

Tools:
a. will require Perl and list all ports depending on databases/lmdb in default configuration (-l = shallow, only direct dependencies: -n = dry-run, only watch, don't touch)
b. rg -l databases/lmdb /usr/ports   OR   grep -rl databases/lmdb /usr/ports
will bluntly figure out all ports that refer to databases/lmdb somehow (rg is textproc/ripgrep); best combined with grep / (to skip UPDATING) and cut -f1-2 -d/ 

c. manually consolidated list at the very end of this description

a. [/usr/ports]$ Tools/scripts/bump_revision.pl -ln databases/lmdb
Reading /usr/ports/INDEX-15
- Processed 37665 entries.
Found databases/lmdb as lmdb-1.0.0,1.
Searching for ports depending on lmdb-1.0.0,1
- Found 308 ports depending on lmdb-1.0.0,1.
- Found 50 ports depending directly on either of lmdb-1.0.0,1.
Updating Makefiles
- Updating Makefile of net/389-ds-base
...
- Updating Makefile of archivers/urbackup-server

b. output not shown.

c. consolidated output, combined from the two above and fed through sort -u:

     1	archivers/urbackup-server
     2	biology/ncbi-blast+
     3	biology/ncbi-cxx-toolkit
     4	databases/ldb25
     5	databases/ldb28
     6	databases/ldb29
     7	databases/p5-LMDB_File
     8	databases/py-lmdb
     9	databases/rubygem-lmdb
    10	databases/tcl-lmdb
    11	devel/appstream
    12	devel/ice37
    13	devel/tcl-thread
    14	dns/bind9-devel
    15	dns/bind920
    16	dns/dnsdist
    17	dns/dnsjit
    18	dns/knot-resolver
    19	dns/knot-resolver6
    20	dns/knot3
    21	dns/powerdns
    22	lang/php82
    23	lang/php83
    24	lang/php84
    25	lang/php85
    26	lang/php86
    27	mail/bogofilter
    28	mail/cyrus-imapd30
    29	mail/exim
    30	mail/libetpan
    31	mail/mutt
    32	mail/neomutt
    33	mail/opendkim
    34	mail/opendkim-devel
    35	mail/postfix
    36	mail/postfix-current
    37	misc/caffe
    38	net-im/nheko
    39	net-p2p/cardano-node
    40	net-p2p/ogmios
    41	net/389-ds-base
    42	net/samba416
    43	net/samba419
    44	net/samba420
    45	net/samba422
    46	net/samba423
    47	ports-mgmt/appstream-generator
    48	security/cyrus-sasl2
    49	security/cyrus-sasl2-saslauthd
    50	security/heimdal
    51	security/krb5-122
    52	security/krb5-devel
    53	sysutils/cardano-cli
    54	sysutils/cfengine
    55	sysutils/cfengine-devel
    56	sysutils/cfengine-lts
    57	sysutils/cfengine324
    58	sysutils/cfengine325
    59	sysutils/cfengine326
    60	sysutils/cfengine327
    61	sysutils/kf5-baloo
    62	sysutils/kf6-baloo
    63	www/ot-recorder
    64	x11/cde
    65	x11/cde-devel
Comment 1 Xin LI freebsd_committer freebsd_triage 2026-07-05 17:00:55 UTC
Created attachment 272515 [details]
Proposed change

Traditionally, old or legacy ports have been branched from an older revision with a '0' / '1' suffix, so here is a slightly different approach: create a new port and make the existing ports depend on it, with a PORTREVISION bump. With this, the tree would be restored to its previous state, where all ports depend on the old LMDB version, and we can then gradually move the tree to the new version.

In case it is not obvious, the only difference between the lmdb0 port and databases/lmdb as of 95f53074ed3f083ffa092fca041c5f046b15b70e was:

```
diff -u -r -N databases/lmdb databases/lmdb0
diff --color -u -r -N databases/lmdb/Makefile databases/lmdb0/Makefile
--- databases/lmdb/Makefile     2026-07-05 09:57:03.871777882 -0700
+++ databases/lmdb0/Makefile    2026-07-05 09:35:20.527071622 -0700
@@ -1,17 +1,21 @@
 PORTNAME=      lmdb
 PORTVERSION=   0.9.35
 DISTVERSIONPREFIX=     ${PORTNAME:tu}_
-PORTEPOCH=     1
+PKGNAMESUFFIX= 0
 CATEGORIES=    databases
 
 MAINTAINER=    delphij@FreeBSD.org
-COMMENT=       OpenLDAP Lightning Memory-Mapped Database
+COMMENT=       OpenLDAP Lightning Memory-Mapped Database (legacy)
 WWW=           https://symas.com/lmdb/
 
 LICENSE=       OPENLDAP
 LICENSE_NAME=  OpenLDAP Public License
 LICENSE_FILE=  ${WRKSRC}/LICENSE
 LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
+
+CONFLICTS_INSTALL=     lmdb # include/lmdb.h bin/mdb_stat
+
+PORTSCOUT=     limit:^0\.
 
 WRKSRC_SUBDIR=         libraries/liblmdb
 MAKE_ARGS+=    CC="${CC}"
```
Comment 2 Lexi Winter freebsd_committer freebsd_triage 2026-07-05 20:08:08 UTC
this requires an epoch increment for people who already updated, right?
Comment 3 Daniel Engberg freebsd_committer freebsd_triage 2026-07-05 20:10:34 UTC
Not if 0.9 is moved to a new port but I'm not sure what the benefit is as you can't have both installed at the same time.
Comment 4 Peter van Dijk 2026-07-06 14:42:23 UTC
A dns/powerdns user also just ran into this. I told him the bump from 0.9 to 1.0 in ports sounds like a mistake - and then I found this ticket. I encourage the lmdb vs. lmdb1 split as described.
Comment 5 commit-hook freebsd_committer freebsd_triage 2026-07-06 15:58:43 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5f9d389f299ac8124a5114c2f014984390b6fd1e

commit 5f9d389f299ac8124a5114c2f014984390b6fd1e
Author:     Xin LI <delphij@FreeBSD.org>
AuthorDate: 2026-07-05 16:47:09 +0000
Commit:     Xin LI <delphij@FreeBSD.org>
CommitDate: 2026-07-06 15:57:32 +0000

    databases/lmdb0: Add port for LMDB 0.9.x legacy ABI

    LMDB 1.0 introduced an incompatible on-disk format change and subtle
    API breakage: applications that compiled cleanly against 1.0 headers
    could fail silently at run time. Known affected ports include dns/knot3,
    mail/bogofilter, and mail/postfix; the postfix issue has been confirmed
    upstream. Linux distributions such as Arch Linux have observed the same
    breakage. Samba can also be affected in certain configurations.

    Because the regression is not detectable in an -exp build run -- the
    postfix failure only manifests at run time, and bogofilter was caught
    only because post-build self-tests happen to exercise this path -- we
    cannot rely on package builds to validate the 1.0 upgrade.

    This commit introduces databases/lmdb0 as a holding port for the 0.9.35
    release, pinned to the 0.x branch with PORTSCOUT=limit:^0. and mutually
    conflicting with databases/lmdb, which retains 1.0. The two packages
    cannot be installed simultaneously, but having lmdb0 available means:

    * Ports known to require the 0.9 ABI can declare an explicit dependency
      on databases/lmdb0 until they are validated against 1.0.
    * Users with existing databases in the 0.9 format can still access the
      mdb_dump and mdb_load utilities to migrate data before upgrading.
    * The package conflict prevents accidental mixing.

    All 50 direct dependents of databases/lmdb are redirected to
    databases/lmdb0 for now with a PORTREVISION bump, effectively restoring
    the tree to the state prior to the LMDB 1.0 update. Once all dependent
    ports are validated against LMDB 1.0, they will be moved back to
    databases/lmdb and databases/lmdb0 will be removed.

    PR:             ports/296530

 archivers/urbackup-server/Makefile         |  3 +-
 biology/ncbi-blast+/Makefile               |  3 +-
 biology/ncbi-cxx-toolkit/Makefile          |  3 +-
 databases/Makefile                         |  1 +
 databases/ldb25/Makefile                   |  4 +-
 databases/ldb28/Makefile                   |  4 +-
 databases/ldb29/Makefile                   |  4 +-
 databases/lmdb/Makefile                    |  2 +
 databases/lmdb0/Makefile (new)             | 42 ++++++++++++++++
 databases/lmdb0/distinfo (new)             |  3 ++
 databases/lmdb0/files/lmdb.pc.in (new)     | 11 ++++
 databases/lmdb0/files/patch-Makefile (new) | 80 ++++++++++++++++++++++++++++++
 databases/lmdb0/pkg-descr (new)            | 11 ++++
 databases/lmdb0/pkg-plist (new)            | 13 +++++
 databases/p5-LMDB_File/Makefile            |  3 +-
 databases/py-lmdb/Makefile                 |  3 +-
 databases/rubygem-lmdb/Makefile            |  3 +-
 databases/tcl-lmdb/Makefile                |  3 +-
 devel/appstream/Makefile                   |  3 +-
 devel/ice37/Makefile                       |  3 +-
 devel/tcl-thread/Makefile                  |  3 +-
 dns/bind9-devel/Makefile                   |  6 +--
 dns/bind920/Makefile                       |  6 +--
 dns/dnsdist/Makefile                       |  3 +-
 dns/dnsjit/Makefile                        |  4 +-
 dns/knot-resolver/Makefile                 |  4 +-
 dns/knot-resolver6/Makefile                |  4 +-
 dns/knot3/Makefile                         |  5 +-
 dns/powerdns/Makefile                      |  3 +-
 lang/php82/Makefile                        |  4 +-
 lang/php83/Makefile                        |  4 +-
 lang/php84/Makefile                        |  4 +-
 lang/php85/Makefile                        |  4 +-
 lang/php86/Makefile                        |  4 +-
 mail/bogofilter/Makefile                   |  4 +-
 mail/cyrus-imapd30/Makefile                |  4 +-
 mail/exim/Makefile                         |  4 +-
 mail/libetpan/Makefile                     |  4 +-
 mail/mutt/Makefile                         |  3 +-
 mail/neomutt/Makefile                      |  3 +-
 mail/opendkim-devel/Makefile               |  3 +-
 mail/opendkim/Makefile                     |  4 +-
 mail/postfix-current/Makefile              |  4 +-
 mail/postfix/Makefile                      |  4 +-
 misc/caffe/Makefile                        |  4 +-
 net-im/nheko/Makefile                      |  4 +-
 net-p2p/cardano-node/Makefile              |  4 +-
 net-p2p/ogmios/Makefile                    |  3 +-
 net/389-ds-base/Makefile                   |  4 +-
 net/samba416/Makefile                      |  4 +-
 net/samba419/Makefile                      |  4 +-
 net/samba420/Makefile                      |  4 +-
 net/samba422/Makefile                      |  3 +-
 net/samba423/Makefile                      |  3 +-
 ports-mgmt/appstream-generator/Makefile    |  4 +-
 security/cyrus-sasl2-saslauthd/Makefile    |  4 +-
 security/cyrus-sasl2/Makefile              |  4 +-
 security/heimdal/Makefile                  |  4 +-
 security/krb5-122/Makefile                 |  4 +-
 security/krb5-devel/Makefile               |  3 +-
 sysutils/cardano-cli/Makefile              |  3 +-
 sysutils/cfengine-devel/Makefile           |  3 +-
 sysutils/cfengine324/Makefile              |  4 +-
 sysutils/cfengine325/Makefile              |  4 +-
 sysutils/cfengine326/Makefile              |  4 +-
 sysutils/cfengine327/Makefile              |  3 +-
 sysutils/kf5-baloo/Makefile                |  4 +-
 sysutils/kf6-baloo/Makefile                |  3 +-
 www/ot-recorder/Makefile                   |  5 +-
 x11/cde-devel/Makefile                     |  4 +-
 x11/cde/Makefile                           |  4 +-
 71 files changed, 293 insertions(+), 105 deletions(-)
Comment 6 Juraj Lutter freebsd_committer freebsd_triage 2026-07-06 16:16:31 UTC
(In reply to commit-hook from comment #5)
Thank you for taking care of this. Much appreciated.
Comment 7 Craig Leres freebsd_committer freebsd_triage 2026-07-06 17:11:47 UTC
Created attachment 272546 [details]
fixes for devel/appstream and databases/ldb29

(In reply to commit-hook from comment #5)
Thanks for the fix!

Unfortunately a couple of ports don't build for me: devel/appstream and databases/ldb29. The fix looks the same for each (lmdb>=0.9.23 -> lmdb0>=0.9.23).
Comment 8 chris.torek 2026-07-06 17:23:45 UTC
(In reply to Craig Leres from comment #7)

I found the same thing. I'm not sure if tweaking each Makefile as Craig suggested is the right path (other Makefiles depend on an installed .so file and don't need to s/lmdb/lmdb0/) but they're not checking versions either, who knows why.

Anyway I stuck a temporary commit with:

-SAMBA4_LMDB_DEPENDS=           lmdb>=0.9.16:databases/lmdb0
+SAMBA4_LMDB_DEPENDS=           lmdb0>=0.9.16:databases/lmdb0

in my net/samba416/Makefile, and was able to build. "git grep lmdb>=0" suffices to find all the applicable Makefiles.
Comment 9 Michael Grimm 2026-07-06 17:53:20 UTC
(In reply to commit-hook from comment #5)

Thanks to all involved in solving this issue.
Comment 10 Michael Grimm 2026-07-06 18:05:39 UTC
(In reply to Michael Grimm from comment #9)

Ups, dns/knot3 fails with:
===>   knot3-3.5.5_1 depends on package: lmdb>=0.9.15 - not found

But the following patch solves this glitch:

diff --git a/dns/knot3/Makefile b/dns/knot3/Makefile
index b8df4efa5871..f774a9141632 100644
--- a/dns/knot3/Makefile
+++ b/dns/knot3/Makefile
@@ -14,7 +14,7 @@ LICENSE=      GPLv3
 LICENSE_FILE=  ${WRKSRC}/COPYING

 BUILD_DEPENDS= gsed:textproc/gsed \
-               lmdb>=0.9.15:databases/lmdb0
+               lmdb0>=0.9.15:databases/lmdb0
 LIB_DEPENDS=   libgnutls.so:security/gnutls \
                liblmdb.so:databases/lmdb0

HTH
Comment 11 commit-hook freebsd_committer freebsd_triage 2026-07-06 18:39:07 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=205c8a2db8a6dc41f395773490e62c90c208717c

commit 205c8a2db8a6dc41f395773490e62c90c208717c
Author:     Gleb Popov <arrowd@FreeBSD.org>
AuthorDate: 2026-07-06 18:37:14 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2026-07-06 18:37:14 +0000

    devel/appstream: Fix dependency on lmdb0

    PR:             296530 296560

 devel/appstream/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 12 commit-hook freebsd_committer freebsd_triage 2026-07-06 18:39:11 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=fd4f4e6472fb92590ecf21c0c0fd1d5087be2265

commit fd4f4e6472fb92590ecf21c0c0fd1d5087be2265
Author:     Gleb Popov <arrowd@FreeBSD.org>
AuthorDate: 2026-07-06 18:36:27 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2026-07-06 18:36:27 +0000

    www/ot-recorder: Fix dependency on lmdb0

    PR:             296530

 www/ot-recorder/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 13 Xin LI freebsd_committer freebsd_triage 2026-07-06 18:40:41 UTC
(In reply to Craig Leres from comment #7)
ouch, my bad.  Thanks for the fix, could you please push it?  (These are large scale build fix style changes and generally do not require maintainer approval).
Comment 14 Craig Leres freebsd_committer freebsd_triage 2026-07-06 20:35:46 UTC
(In reply to Xin LI from comment #13)
Sorry, I stepped out for lunch. But others stepped up and everything my build server builds builds again.
Comment 15 Peter van Dijk 2026-07-06 20:51:25 UTC
> Users with existing databases in the 0.9 format can still access the mdb_dump and mdb_load utilities to migrate data before upgrading.

I understand that the openbsd lmdb port's bump to 1.0 (which is pending) includes a statically built mdb_dump-0.9, which I think is quite clever.

Thread: https://marc.info/?t=178309227900002&r=1&w=2

Thank you for the quick fix!
Comment 16 Derek Schrock 2026-07-09 00:54:11 UTC
> Once all dependent ports are validated against LMDB 1.0, 
> they will be moved back databases/lmdb and databases/lmdb0 
> will be removed.

Who/how are the dependent ports being tracked to validate compatibility?
Here? If so mail/mutt doesn't have an issue with lmdb 1.0.
Comment 17 Matthias Andree freebsd_committer freebsd_triage 2026-07-09 22:22:15 UTC
As of now, the list is not complete and requires support by the port maintainers and possibly upstream maintainers (of the applications).

Apparently bugfix suggestions for the mdb drop stuff that affects postfix are under testing... https://git.openldap.org/openldap/openldap/-/merge_requests/900/diffs?commit_id=39c4ed31e934c557f11a404f2ef543ec4d61e5b5

Also posted to the postfix mailing list, but hadn't hit the archives a few minutes ago.
Comment 18 Matthias Andree freebsd_committer freebsd_triage 2026-07-10 08:15:49 UTC
Relevant LMDB 1.0.1 patches and discussed on the postfix-devel mailing list fix Postfix's LMDB 1.0.0 regression -> https://marc.info/?t=178363071700003&r=1&w=2

Alternative archive: https://www.mail-archive.com/postfix-devel@postfix.org/msg01339.html
Comment 19 Mark Linimon freebsd_committer freebsd_triage 2026-07-19 08:11:13 UTC
^Triage: I have not checked every single one, but at least the following
have been fixed:

  archivers/urbackup-server (from first patch)
  databases/ldb29 (from second patch)
  devel/appstream (from second patch)