main - fsadm: fix unbound variable usage
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=47608ff49b874f2a34b9d8644f53028d5ffa1fd3 Commit: 47608ff49b874f2a34b9d8644f53028d5ffa1fd3 Parent: 7691213a91ca7cc2d5518db31d04c8afa74622e7 Author: Zdenek Kabelac <[email protected]> AuthorDate: Mon Dec 7 16:16:55 2020 +0100 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Tue Dec 8 20:32:34 2020 +0100
fsadm: fix unbound variable usage
When 'fsadm resize vg/lv' is used without size, it should just resize filesystem to match device - but since we now check for unbound variable in bash - the previous usage no longer works and needs explicit check.
--- scripts/fsadm.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
scripts/fsadm.sh +6 -2
@@ -798,6 +798,7 @@ fi CHECK="" RESIZE="" +NEWSIZE="" while [ "$#" -ne 0 ] do
@@ -811,8 +812,11 @@ do "-y"|"--yes") YES="-y" ;; "-l"|"--lvresize") DO_LVRESIZE=1 ;; "-c"|"--cryptresize") DO_CRYPTRESIZE=1 ;; - "check") CHECK=$2 ; shift ;; - "resize") RESIZE=$2 ; NEWSIZE=$3 ; shift 2 ;; + "check") test -z "${2-}" && error "Missing <device>. (see: $TOOL --help)" + CHECK=$2 ; shift ;; + "resize") test -z "${2-}" && error "Missing <device>. (see: $TOOL --help)" + RESIZE=$2 ; shift + if test -n "${2-}" ; then NEWSIZE="${2-}" ; shift ; fi ;; *) error "Wrong argument \"$1\". (see: $TOOL --help)" esac shift