ctdb-scripts: Avoid shellcheck warning SC2039 (test -nt operator)
authorMartin Schwenke <martin@meltin.net>
Tue, 12 Jul 2016 01:57:55 +0000 (11:57 +1000)
committerAmitay Isaacs <amitay@samba.org>
Thu, 21 Jul 2016 00:24:26 +0000 (02:24 +0200)
SC2039: In POSIX sh, -nt is not supported.

This script is specific to the Linux NFS implementation.  The -nt
operator is well supported in Linux shells (e.g. dash, bash, ksh).
The alternatives (e.g. using stat(1)) would result in less readable
code.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/config/nfs-linux-kernel-callout

index 9424d9a96cf9249c228b73d238fd570bd35b68d7..9b72446b44e7951ddd05d88e25d0e7a224ddf7c2 100755 (executable)
@@ -184,6 +184,8 @@ nfs_check_thread_count ()
 nfs_monitor_list_shares ()
 {
     _cache_file="${CTDB_NFS_CALLOUT_STATE_DIR}/list_shares_cache"
+    # -nt operator is well supported in Linux: dash, bash, ksh, ...
+    # shellcheck disable=SC2039
     if  [ ! -r "$nfs_exports_file" ] || [ ! -r "$_cache_file" ] || \
            [ "$nfs_exports_file" -nt "$_cache_file" ] ; then
        mkdir -p "$CTDB_NFS_CALLOUT_STATE_DIR"