common/xfs: work around a hang-on-stdin bug in xfs_admin 5.11
[xfstests-dev.git] / common / xfs
index 6e1e661aef150f80e591390be431855e6826be25..887bd00198f5022530c01116c6acba6dc6195fb6 100644 (file)
@@ -277,7 +277,13 @@ _scratch_xfs_admin()
                        _notrun 'xfs_admin does not support rt devices'
                rt_opts+=(-r "$SCRATCH_RTDEV")
        fi
-       $XFS_ADMIN_PROG "${rt_opts[@]}" "$@" "${options[@]}"
+
+       # xfs_admin in xfsprogs 5.11 has a bug where an external log device
+       # forces xfs_db to be invoked, potentially with zero command arguments.
+       # When this happens, xfs_db will wait for input on stdin, which causes
+       # fstests to hang.  Since xfs_admin is not an interactive tool, we
+       # can redirect stdin from /dev/null to prevent this issue.
+       $XFS_ADMIN_PROG "${rt_opts[@]}" "$@" "${options[@]}" < /dev/null
 }
 
 _scratch_xfs_logprint()