argbash icon indicating copy to clipboard operation
argbash copied to clipboard

Missing double quotes on DEFINE_LOAD_LIBRARY

Open felipecrs opened this issue 4 years ago • 0 comments

This is the current generated function:

load_lib_relativepath() {
	local lib_filename="$script_dir/$1"
	. $lib_filename || die "Not able to load library file '$lib_filename'"
}

Two issues raised by shellcheck:

load_lib_relativepath() {
	local lib_filename="$script_dir/$1"
	# Can't follow non-constant source. Use a directive to specify location.shellcheck(SC1090)
        # Double quote to prevent globbing and word splitting.shellcheck(SC2086)
	. $lib_filename || die "Not able to load library file '$lib_filename'"
}

They could be fixed with:

load_lib_relativepath() {
	local lib_filename="$script_dir/$1"
	# shellcheck disable=SC1090
	. "$lib_filename" || die "Not able to load library file '$lib_filename'"
}

References https://github.com/koalaman/shellcheck/issues/2038.

felipecrs avatar Feb 03 '21 14:02 felipecrs