From 073a088f3190c6da63df979a154853d4b5309e50 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Tue, 17 Oct 2023 03:27:11 +0200 Subject: [PATCH] MDEV-31467: wsrep_sst_mariabackup not working on FreeBSD Due to the different command line format of the timeout utility on FreeBSD and Linux, SST scripts for mariabackup may not work on FreeBSD. This commit fixes this problem by adding a different command to test options on FreeBSD and adding proper formatting for the utility options. --- scripts/wsrep_sst_mariabackup.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index 981a042d506..84742defc16 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -798,10 +798,20 @@ recv_joiner() local ltcmd="$tcmd" if [ $tmt -gt 0 ]; then if [ -n "$(commandex timeout)" ]; then - if timeout --help | grep -qw -F -- '-k'; then + local koption=0 + if [ "$OS" = 'FreeBSD' ]; then + if timeout 2>&1 | grep -qw -F -- '-k'; then + koption=1 + fi + else + if timeout --help | grep -qw -F -- '-k'; then + koption=1 + fi + fi + if [ $koption -ne 0 ]; then ltcmd="timeout -k $(( tmt+10 )) $tmt $tcmd" else - ltcmd="timeout -s9 $tmt $tcmd" + ltcmd="timeout -s 9 $tmt $tcmd" fi fi fi