]> www.infradead.org Git - users/hch/blktests.git/commitdiff
multipath: work around false shellcheck error
authorOmar Sandoval <osandov@fb.com>
Thu, 22 Apr 2021 17:25:47 +0000 (10:25 -0700)
committerOmar Sandoval <osandov@fb.com>
Thu, 22 Apr 2021 17:25:47 +0000 (10:25 -0700)
Shellcheck seems to think that [ -z "$debug" ] is setting the debug
variable and warns:

  common/multipath-over-rdma:190:11: note: Modification of debug is local (to subshell caused by pipeline). [SC2030]
  common/multipath-over-rdma:606:8: note: debug was modified in a subshell. That change might be lost. [SC2031]

Work around this by using test instead.

Signed-off-by: Omar Sandoval <osandov@fb.com>
common/multipath-over-rdma

index 9e68189b56fd1cfae02b786f0b9eb0995aa75bf4..cef05ec92d2959b1e26ca9583392c6b68b806750 100644 (file)
@@ -187,7 +187,7 @@ remove_stale_mpath_devs() {
                        echo -n "removing $mpdev: "
                        if ! remove_mpath_dev "$mpdev"; then
                                echo "failed"
-                               [ -z "$debug" ] || return 1
+                               test -z "$debug" || return 1
                        fi
                done
        echo "Finished examining multipaths"