[SCM] Samba Shared Repository - branch master updated
Martin Schwenke
martins at samba.org
Thu Apr 18 09:09:02 UTC 2024
The branch, master has been updated
via 0159c48e897 ctdb-scripts: Do not de-duplicate the interfaces list
from 7a5e7b82125 python: Fix NtVer check for site_dn_for_machine()
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 0159c48e897a7c07c399767f5ffddbb11d80ab5d
Author: Martin Schwenke <mschwenke at ddn.com>
Date: Thu Apr 18 14:13:11 2024 +1000
ctdb-scripts: Do not de-duplicate the interfaces list
Using xargs with sort -u to de-duplicate this list was my idea and
causes a couple of things to go wrong. The use of xargs causes
double-quotes to be lost. The resulting $public_ifaces value also
contains newlines. The newlines could be removed with an additional
xargs at the end of the pipeline... but that would add an extra level
of quote stripping.
I have unsuccessfully tried to find an alternative, but still elegant,
command pipeline that de-duplicates the list, while maintaining
quoting.
So, just drop the de-duplication.
This might make interface_ifindex_exists_with_options() slightly less
efficient. However, that function walks the whole list, only
terminating early when a match is found on both interface and options,
so at least it will be correct.
Include an extra testcase.
Signed-off-by: Martin Schwenke <mschwenke at ddn.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Autobuild-User(master): Martin Schwenke <martins at samba.org>
Autobuild-Date(master): Thu Apr 18 09:08:34 UTC 2024 on atb-devel-224
-----------------------------------------------------------------------
Summary of changes:
ctdb/config/events/legacy/50.samba.script | 1 -
.../UNIT/eventscripts/50.samba.startup.012.sh | 25 ++++++++++++++++++++++
2 files changed, 25 insertions(+), 1 deletion(-)
create mode 100755 ctdb/tests/UNIT/eventscripts/50.samba.startup.012.sh
Changeset truncated at 500 lines:
diff --git a/ctdb/config/events/legacy/50.samba.script b/ctdb/config/events/legacy/50.samba.script
index 90de6a3f31b..c9d34cd2245 100755
--- a/ctdb/config/events/legacy/50.samba.script
+++ b/ctdb/config/events/legacy/50.samba.script
@@ -40,7 +40,6 @@ generate_smb_interfaces_config()
if [ -n "$CTDB_SAMBA_INTERFACES_EXTRA" ]; then
public_ifaces="$public_ifaces $CTDB_SAMBA_INTERFACES_EXTRA"
fi
- public_ifaces=$(echo "$public_ifaces" | xargs -n 1 | sort -u)
cat <<EOT > "$CTDB_SAMBA_INTERFACES_FILE"
bind interfaces only = yes
diff --git a/ctdb/tests/UNIT/eventscripts/50.samba.startup.012.sh b/ctdb/tests/UNIT/eventscripts/50.samba.startup.012.sh
new file mode 100755
index 00000000000..fb7627c5898
--- /dev/null
+++ b/ctdb/tests/UNIT/eventscripts/50.samba.startup.012.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "startup, with interfaces list generation"
+
+setup
+
+interfaces_file="${CTDB_TEST_TMP_DIR}/interfaces.conf"
+
+setup_script_options <<EOF
+CTDB_SAMBA_INTERFACES_FILE=${interfaces_file}
+CTDB_SAMBA_INTERFACES_EXTRA='"devX123;options=nodynamic" "devX456;options=dynamic"'
+EOF
+
+ok <<EOF
+Starting smb: OK
+EOF
+simple_test
+
+ok <<EOF
+ bind interfaces only = yes
+ interfaces = lo "dev123;options=dynamic" "dev456;options=dynamic" "devX123;options=nodynamic" "devX456;options=dynamic"
+EOF
+simple_test_command cat "$interfaces_file"
--
Samba Shared Repository
More information about the samba-cvs
mailing list