mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
common: properly quote strings tested with -n
Per the Advanced Bash Scripting Guide: "The -n test requires that the string be quoted within the test brackets. Using an unquoted string with ! -z, or even just the unquoted string alone within test bracket normally works, however, this is an unsafe practice. Always quote a tested string." And indeed: $ unset FOOBAR $ [ -n $FOOBAR ] || echo nope $ [ -n "$FOOBAR" ] || echo nope nope Ran into this on a box w/o the attr program installed, and passed _require_attrs. Quoting the string fixes this; fix it there and other occurrences in common/* as well. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
committed by
Dave Chinner
parent
64bd48f676
commit
a71e9bbd51
+4
-4
@@ -165,7 +165,7 @@ _filter_aces_notypes()
|
||||
|
||||
_require_acls()
|
||||
{
|
||||
[ -n $CHACL_PROG ] || _notrun "chacl command not found"
|
||||
[ -n "$CHACL_PROG" ] || _notrun "chacl command not found"
|
||||
|
||||
#
|
||||
# Test if chacl is able to list ACLs on the target filesystems. On really
|
||||
@@ -196,9 +196,9 @@ _list_acl()
|
||||
|
||||
_require_attrs()
|
||||
{
|
||||
[ -n $ATTR_PROG ] || _notrun "attr command not found"
|
||||
[ -n $GETFATTR_PROG ] || _notrun "getfattr command not found"
|
||||
[ -n $SETFATTR_PROG ] || _notrun "setfattr command not found"
|
||||
[ -n "$ATTR_PROG" ] || _notrun "attr command not found"
|
||||
[ -n "$GETFATTR_PROG" ] || _notrun "getfattr command not found"
|
||||
[ -n "$SETFATTR_PROG" ] || _notrun "setfattr command not found"
|
||||
|
||||
#
|
||||
# Test if chacl is able to write an attribute on the target filesystems.
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@
|
||||
#
|
||||
_require_quota()
|
||||
{
|
||||
[ -n $QUOTA_PROG ] || _notrun "Quota user tools not installed"
|
||||
[ -n "$QUOTA_PROG" ] || _notrun "Quota user tools not installed"
|
||||
|
||||
case $FSTYP in
|
||||
ext2|ext3|ext4|ext4dev|reiserfs)
|
||||
@@ -74,7 +74,7 @@ _require_xfs_quota()
|
||||
if [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ]; then
|
||||
_notrun "Quotas not supported on realtime scratch device"
|
||||
fi
|
||||
[ -n $XFS_QUOTA_PROG ] || _notrun "XFS quota user tools not installed"
|
||||
[ -n "$XFS_QUOTA_PROG" ] || _notrun "XFS quota user tools not installed"
|
||||
}
|
||||
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user