Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-13946

Server RPMs have dependency on "which"

    Details

    • Sprint:
      10.2.10

      Description

      Our Server RPMs have a dependency on "which" if they're build with wsrep support:

      cmake/cpack_rpm.cmake:170:

      IF(WITH_WSREP)
      SETA(CPACK_RPM_server_PACKAGE_REQUIRES
        "galera" "rsync" "lsof" "grep" "gawk" "iproute"
        "coreutils" "findutils" "tar" "which")
      ENDIF()
      

      This breaks installations on SLES11, because SLES11 does not have any package that provides the "which" capability. (The which(1) tool itself is included in some other package.) It's also worth noting that many Docker containers and other very lightweight environments may not include which(1), either.

      This is because which(1) is used in a large number of galera shell scripts (as well as other shell scripts):

      server $ grep -r -c which scripts/
      scripts/.wsrep_sst_mariabackup.sh.swp:2
      scripts/CMakeLists.txt:0
      scripts/comp_sql.c:1
      scripts/convert-debug-for-diff.sh:0
      scripts/dheadgen.pl:0
      scripts/fill_help_tables.sql:90
      scripts/galera_new_cluster.sh:0
      scripts/galera_recovery.sh:0
      scripts/make_win_bin_dist:0
      scripts/maria_add_gis_sp.sql.in:0
      scripts/mariadb-service-convert:0
      scripts/msql2mysql.sh:0
      scripts/mysql_config.pl.in:3
      scripts/mysql_config.sh:3
      scripts/mysql_convert_table_format.sh:0
      scripts/mysql_find_rows.sh:0
      scripts/mysql_fix_extensions.sh:0
      scripts/mysql_install_db.pl.in:6
      scripts/mysql_install_db.sh:6
      scripts/mysql_performance_tables.sql:0
      scripts/mysql_secure_installation.pl.in:0
      scripts/mysql_secure_installation.sh:2
      scripts/mysql_setpermission.sh:11
      scripts/mysql_system_tables.sql:2
      scripts/mysql_system_tables_data.sql:1
      scripts/mysql_system_tables_fix.sql:0
      scripts/mysql_test_data_timezone.sql:0
      scripts/mysql_to_mariadb.sql:0
      scripts/mysqlaccess.conf:0
      scripts/mysqlaccess.sh:31
      scripts/mysqld_multi.sh:10
      scripts/mysqld_safe.sh:12
      scripts/mysqldumpslow.sh:0
      scripts/mysqlhotcopy.sh:7
      scripts/mytop.sh:17
      scripts/wsrep_sst_common.sh:4
      scripts/wsrep_sst_mariabackup.sh:8
      scripts/wsrep_sst_mysqldump.sh:0
      scripts/wsrep_sst_rsync.sh:3
      scripts/wsrep_sst_xtrabackup-v2.sh:8
      scripts/wsrep_sst_xtrabackup.sh:5
      

      For example:

      scripts/wsrep_sst_xtrabackup.sh:        if [[ ! -x `which nc` ]];then
      scripts/wsrep_sst_xtrabackup.sh:        if [[ ! -x `which socat` ]];then
      scripts/wsrep_sst_xtrabackup.sh:if [[ ! -x `which innobackupex` ]];then
      scripts/wsrep_sst_xtrabackup.sh:            if [[ ! -x `which qpress` ]];then
      

      This is a very poor way to perform this kind of check. It unnecessarily requires an external tool, which makes it fragile and error-prone. The POSIX way to perform this same check would be to do, for example,

      if ! command -v nc  >/dev/null;then

      .

      This change should be made across all shell scripts shipped by MariaDB Server, and the dependency on which(1) should be removed.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                serg Sergei Golubchik
                Reporter:
                kolbe Kolbe Kegel (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: