common: properly quote strings tested with -n
authorEric Sandeen <sandeen@sandeen.net>
Mon, 2 Nov 2015 00:00:09 +0000 (11:00 +1100)
committerDave Chinner <david@fromorbit.com>
Mon, 2 Nov 2015 00:00:09 +0000 (11:00 +1100)
commita71e9bbd51cd1ac9725c9d6f58350a1d2dd37652
treea21155ba9f00a487854b7a8c76d2043e0a5e5bf9
parent64bd48f676ce673521cb408cb610dcc230a36d92
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>
common/attr
common/quota