MDEV-40786 make mariadb-plugin great - #5597
Draft
MooSayed1 wants to merge 1 commit into
Draft
Conversation
gkodinov
requested changes
Aug 26, 2026
gkodinov
left a comment
Member
There was a problem hiding this comment.
Thanks for looking into this. This is nowhere near close to being ready for review. Converting to draft until it's actually delivering towards the specification in the jira.
gkodinov
marked this pull request as draft
August 26, 2026 08:20
MooSayed1
force-pushed
the
MDEV-40786
branch
3 times, most recently
from
August 29, 2026 14:41
92be898 to
ab1e6a9
Compare
Add search, install, and uninstall subcommands to mariadb-plugin with input validation and case normalization, while keeping legacy ENABLE and DISABLE syntax functional for backward compatibility. Bake the installation layout into the binary at compile time (RPM, DEB, or tarball), as it cannot be derived from the path alone since RPM and DEB use the same directory, and verify the executable path at runtime via argv[0] and mysys path helpers to ensure package managers and tarball directories target the correct installation. Delegate install and uninstall to the system package manager on RPM and DEB installations, so that plugin files stay owned by it. The plugin name maps to the uniform package name mariadb-plugin-<name>. Commands run through fork and execvp with an argument vector, never a shell, and inherit the standard streams, so the package manager prompts the user itself and its exit code is passed through. RPM packages are named differently, so they get the uniform name as a Provides, derived from the plugin component in cmake/plugin.cmake. DEB packages already carry it. On RPM, uninstall resolves the real package name with rpm --whatprovides, because dnf 5 does not accept Provides names for removal.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Jira issue number for this PR is: MDEV-40786
Description
First step of turning the
mariadb-plugintool into a plugin packagemanager, as described in the MDEV. New CLI surface:
The legacy
<plugin> ENABLE|DISABLEsyntax is kept for backwardcompatibility: it is detected on the raw arguments (
is_legacy_syntax()),before any option parsing, and continues through the original code path
completely unchanged. The usage text marks it as deprecated.
Plugin names are normalized to lower case and validated against
[a-z0-9_-](max 64 chars), since they are used to construct packagenames (
mariadb-plugin-<name>).Install-method detection. The install layout (RPM, DEB, tarball) is
compiled in from
INSTALL_LAYOUT, as it cannot be derived from the path:RPM and DEB share the same directories. At runtime the tool locates
itself through
argv[0](my_path()+my_realpath(), which alsoresolves the legacy
mysql_pluginsymlink) and verifies it belongs tothat installation: on RPM/DEB the binary must sit in the compiled-in
bindir, on a tarball the plugin directory must exist under the basedir.
A build tree is therefore not accepted.
Package-manager delegation. On RPM and DEB installations
installand
uninstalldelegate to the system package manager, so plugin filesstay owned by it and dependency resolution, signature checks and upgrades
keep working.
apt-getis used on DEB; on RPMdnfis preferred andzypperis used whendnfis absent. Commands run throughfork()/execvp()with an argument vector, never a shell, and inheritthe standard streams, so the package manager prompts the user itself and
its exit code is passed through unchanged. Non-root invocations are
rejected before anything is spawned.
uninstallon RPM first resolves the real package name withrpm -q --whatprovides, because dnf 5 does not acceptProvidesnamesfor removal (dnf 4 and zypper do); this also produces a clear message
when the plugin is not installed.
Still to come on this PR:
Provides: mariadb-plugin-<X>on the RPMpackages (so the uniform name resolves against mariadb.org packages),
search, and tarball support.Release Notes
mariadb-plugingainssearch,installanduninstallsubcommands(work in progress). On RPM and DEB installations
installanduninstalldelegate to the system package manager. The legacyENABLE|DISABLEsyntax still works and is now marked deprecated.How can this PR be tested?
Manual for now (mtr and autopkgtest coverage planned in a follow-up
commit).
CLI surface, any build:
Delegation needs a binary built with the matching layout, installed in
the real bindir. Tested in containers:
-DINSTALL_LAYOUT=DEB:mariadb-plugin install rocksdband
uninstall rocksdbinstall and remove the realmariadb-plugin-rocksdbpackage; an unknown plugin returns apt's ownerror and exit code.
-DINSTALL_LAYOUT=RPM, with a local repository providing a packagewith
Provides: mariadb-plugin-test: install resolves the alias,uninstall resolves the real name and removes it, and uninstalling a
plugin that is not installed reports it plainly.
directory, both produce a single clear error.
Basing the PR against the correct MariaDB version
This is a new feature, so this PR targets
main.PR quality check