Re: [OS-BUILD PATCH] process_configs.sh: Fix syntax flagged by shellcheck

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 11 Sep 2020 16:43:25 -0000, GitLab Bridge on behalf of bcrocker wrote:
> -		test -e $path/MAINTAINERS && \
> -			test -d $path/drivers && \
> +		test -e "$path"/MAINTAINERS && \
> +			test -d "$path"/drivers && \

Given this is a bash script and it uses the bash specific [[ ]] in
other places, why you don't instead convert this into [[ ]]? It's more
readable and you will not have to worry about quotes.

> -		path="$(dirname $path)"
> +		path="$(dirname "$path")"

Given that $path always starts with / here, you can use a faster,
simpler and no-quotes-needed command instead:

path=${path%/*}

> +	for f in "$tmpdir"/*; do
> +		[[ -e "$f" ]] || break
> +		cp "$f" "$SCRIPT_DIR"/pending"$FLAVOR"/generic/

This is unreadable. Please make it "$SCRIPT_DIR/pending$FLAVOR/generic/".
Or, if you prefer, "${SCRIPT_DIR}/pending${FLAVOR}/generic/".

Similarly in other places. Instead of having parts of a string quoted,
quote the whole string (except globs, of course). For example,

> +	for cfg in "$SCRIPT_DIR"/"${PACKAGE_NAME}""${KVERREL}""${SUBARCH}"*.config

"${SCRIPT_DIR}/${PACKAGE_NAME}${KVERREL}${SUBARCH}"*.config

> +	git add "$SCRIPT_DIR"/pending"$FLAVOR"

Or here. Etc, there are more places such as this.

> +SCRIPT="$(readlink -f "$0")"
> +SCRIPT_DIR="$(dirname "$SCRIPT")"

Readlink returns an absolute path, so similarly to above, there are no
exceptions to take care of (as dirname does) and it can be replaced by
the simple parameter expansion trick above.

Please at least fix the unreadable multiquotes. Politely requesting v2,

Nacked-by: Jiri Benc <jbenc@xxxxxxxxxx>

 Jiri
_______________________________________________
kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux