ctdb-scripts: Do not de-duplicate the interfaces list
authorMartin Schwenke <mschwenke@ddn.com>
Thu, 18 Apr 2024 04:13:11 +0000 (14:13 +1000)
committerMartin Schwenke <martins@samba.org>
Thu, 18 Apr 2024 09:08:34 +0000 (09:08 +0000)
commit0159c48e897a7c07c399767f5ffddbb11d80ab5d
tree3b258115154d0d559db312abfd5157a022c0589a
parent7a5e7b821259890dd2978e6f113f4a3dad110ea4
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@ddn.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Thu Apr 18 09:08:34 UTC 2024 on atb-devel-224
ctdb/config/events/legacy/50.samba.script
ctdb/tests/UNIT/eventscripts/50.samba.startup.012.sh [new file with mode: 0755]