fix(mariadb plugin): wrap mysql/mariadb clients with project socket (#2522)#2930
Open
mikeland73 wants to merge 1 commit into
Open
fix(mariadb plugin): wrap mysql/mariadb clients with project socket (#2522)#2930mikeland73 wants to merge 1 commit into
mikeland73 wants to merge 1 commit into
Conversation
…2522) The MariaDB client does not honor the MYSQL_UNIX_PORT environment variable, so `devbox run mariadb` (or `mysql`) falls back to its compile-time default socket (e.g. /run/mysqld/mysqld.sock) instead of the project's socket at $MYSQL_UNIX_PORT. This differs from the MySQL plugin, whose client does honor the env var. Wrap the `mysql` and `mariadb` client binaries in the plugin's flake so they default to `--socket=$MYSQL_UNIX_PORT`, mirroring how the daemon binaries are already wrapped. Each wrap is guarded by an existence check since the available client names vary across MariaDB versions, and `--add-flags` still lets users override the socket explicitly. Fixes #2522 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D8QQU1dVaNycyxQWcRyBhs
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.
Summary
Fixes #2522.
The MariaDB client does not honor the
MYSQL_UNIX_PORTenvironment variable, so running the client inside a Devbox environment (devbox run mariadb/devbox run mysql) falls back to its compile-time default socket (e.g./run/mysqld/mysqld.sock) instead of the project's socket at$MYSQL_UNIX_PORT:This differs from the
mysqlplugin, whose (Oracle MySQL) client does honorMYSQL_UNIX_PORT, which is why the same steps work there.This change wraps the
mysqlandmariadbclient binaries in the mariadb plugin'sflake.nixso they default to--socket=$MYSQL_UNIX_PORT, mirroring how the daemon binaries (mysqld,mariadbd,mysqld_safe, ...) are already wrapped. It's the fix suggested by the reporter in the issue.Details:
[ -e ... ]) because the available client names vary across MariaDB versions (mysqlis typically a symlink tomariadb).--add-flagsprepends the socket flag, so users can still override it explicitly (e.g. connecting to a remote host over TCP is unaffected)..devbox/, which Devbox always regenerates, so existing projects pick up the fix on the next shell entry (the changed derivation rebuilds the wrapped package).cc @jefft (issue reporter)
How was it tested?
go build ./internal/plugin/... ./plugins/...passes; the plugin'sflake.nixis embedded via//go:embedinplugins/builtins.go.postBuildoutput for shell correctness (proper[ -e ... ]guards,''$MYSQL_UNIX_PORTescaping consistent with the surrounding wrappers).Note: I don't have a Nix-enabled environment here to run the full
devbox create --template mariadbreproduction end to end, so a maintainer verification ofdevbox run mariadbconnecting to$MYSQL_UNIX_PORTwould be appreciated.Community Contribution License
All community contributions in this pull request are licensed to the project
maintainers under the terms of the
Apache 2 License.
By creating this pull request, I represent that I have the right to license the
contributions to the project maintainers under the Apache 2 License as stated in
the
Community Contribution License.
Generated by Claude Code