Skip to content

MDEV-14296: Relocate wsrep_sst_common from /usr/bin to /usr/share/mariadb#4871

Open
FaramosCZ wants to merge 1 commit intoMariaDB:mainfrom
FaramosCZ:MDEV-14296
Open

MDEV-14296: Relocate wsrep_sst_common from /usr/bin to /usr/share/mariadb#4871
FaramosCZ wants to merge 1 commit intoMariaDB:mainfrom
FaramosCZ:MDEV-14296

Conversation

@FaramosCZ
Copy link
Copy Markdown
Contributor

wsrep_sst_common is a bash function library (no shebang, only function definitions and shared variables) that is sourced by other wsrep_sst_* scripts. Unlike those scripts, it is not an executable and should not reside in /usr/bin. This commit moves it to the shared data directory (INSTALL_MYSQLSHAREDIR, typically /usr/share/mariadb on RPM/DEB systems), which is the standard location for architecture-independent data files.

New install path: ${INSTALL_MYSQLSHAREDIR}/wsrep_sst_common

  • RPM layout: /usr/share/mariadb/wsrep_sst_common
  • DEB layout: /usr/share/mariadb/wsrep_sst_common
  • Standalone layout: /share/wsrep_sst_common

Files modified:

scripts/CMakeLists.txt
- Changed INSTALL(FILES ...) destination from ${INSTALL_BINDIR} to ${INSTALL_MYSQLSHAREDIR} for the WSREP_SOURCE (wsrep_sst_common).
- Updated comment to explain the rationale for the non-bindir location.

scripts/wsrep_sst_backup.sh
scripts/wsrep_sst_mariabackup.sh
scripts/wsrep_sst_mysqldump.sh
scripts/wsrep_sst_rsync.sh
- Updated the source command to locate wsrep_sst_common. The new logic first checks the script's own directory (for build-tree / MTR test compatibility, where all scripts are generated into the same build directory), and falls back to the CMake-substituted installed path (@INSTALL_MYSQLSHAREDIRABS@) when the file is not found alongside the calling script.

support-files/policy/apparmor/usr.sbin.mysqld
- Updated AppArmor read permission from /usr/bin/wsrep_sst_common to /usr/share/mariadb/wsrep_sst_common.

debian/mariadb-server.install
- Updated Debian package file list entry from usr/bin/wsrep_sst_common to usr/share/mariadb/wsrep_sst_common.

@gkodinov gkodinov added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Mar 27, 2026
@FaramosCZ FaramosCZ force-pushed the MDEV-14296 branch 4 times, most recently from 80b53f1 to 2a91016 Compare March 30, 2026 01:20
…iadb

wsrep_sst_common is a bash function library (no shebang, only function
definitions and shared variables) that is sourced by other wsrep_sst_*
scripts. Unlike those scripts, it is not an executable and should not
reside in /usr/bin. This commit moves it to the shared data directory
(INSTALL_MYSQLSHAREDIR, typically /usr/share/mariadb on RPM/DEB
systems), which is the standard location for architecture-independent
data files.

Prior attempts (PR MariaDB#603, PR MariaDB#2706) used a new INSTALL_LIBEXECDIR
CMake variable to move wsrep_sst_common to /usr/libexec. Both PRs
were closed without merge. The libexecdir approach had two problems:

1. The CMakeLists.txt change was too broad — it redirected all
   wsrep scripts to libexecdir, not just wsrep_sst_common. The
   other wsrep_sst_* scripts are user-facing executables and
   belong in /usr/bin. LinuxJedi identified this on PR MariaDB#2706:
   "user executable binaries such as mytop are going into libexec
   and some binaries that should be libexec going to bin."

2. FHS semantics: /usr/libexec is for executable helper programs
   not meant to be run directly by users. wsrep_sst_common is not
   executable at all — it is a sourced shell function library.
   /usr/share/<package> is the standard FHS location for
   architecture-independent data files, which is what a shell
   function library is. grooverdan confirmed on PR MariaDB#3335: "its
   sourced, its never directly executed."

This commit avoids the scope problem by reusing the existing
INSTALL_MYSQLSHAREDIR variable and only changing the destination
for wsrep_sst_common specifically, not all scripts.

New install path: ${INSTALL_MYSQLSHAREDIR}/wsrep_sst_common
  - RPM layout: /usr/share/mariadb/wsrep_sst_common
  - DEB layout: /usr/share/mariadb/wsrep_sst_common
  - Standalone layout: <prefix>/share/wsrep_sst_common

Files modified:

  scripts/CMakeLists.txt
    - Changed INSTALL(FILES ...) destination from ${INSTALL_BINDIR}
      to ${INSTALL_MYSQLSHAREDIR} for wsrep_sst_common.

  scripts/wsrep_sst_backup.sh
  scripts/wsrep_sst_mariabackup.sh
  scripts/wsrep_sst_mysqldump.sh
  scripts/wsrep_sst_rsync.sh
    - Updated the source command to locate wsrep_sst_common. The
      new logic first checks the script's own directory (for
      build-tree / MTR test compatibility), and falls back to the
      CMake-substituted installed path (@INSTALL_MYSQLSHAREDIRABS@)
      when the file is not found alongside the calling script.

  support-files/policy/apparmor/usr.sbin.mysqld
    - Updated AppArmor read permission from
      /usr/bin/wsrep_sst_common to
      /usr/share/mariadb/wsrep_sst_common.

  debian/mariadb-server.install
    - Updated Debian package file list entry from
      usr/bin/wsrep_sst_common to
      usr/share/mariadb/wsrep_sst_common.

Co-Authored-By: Claude AI <noreply@anthropic.com>
@FaramosCZ FaramosCZ marked this pull request as ready for review March 30, 2026 08:32
Copy link
Copy Markdown
Member

@gkodinov gkodinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution. This is a preliminary review.

LGTM.

Please stand by for the final review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements.

Development

Successfully merging this pull request may close these issues.

3 participants