Re: [OS-BUILD PATCH 2/20] mod-blacklist.sh: Fix syntax flagged by shellcheck

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

 



On Fri, 13 Nov 2020 21:12:19 -0000, GitLab Bridge on behalf of bcrocker wrote:
> -if [ -f $RpmDir/$ModDir/extra/drivers/block/floppy.ko* ]; then
> -	blacklist "floppy"
> -fi

Since the script is /bin/bash, just use [[ ]]. You will not have to
worry about the glob matching multiple files. You will also not have to
worry about quoting the variables. It's much simpler and easier to
understood than the for loop.

> +for f in "$RpmDir/$ModDir"/extra/drivers/block/floppy.ko*
> +do
> +    # This unnecessary if-stmt prevents an "unused variable"
> +    # warning from shellcheck:

But if you go with the for loop anyway, please fix this comment. The if
is fundamental, floppy would be unconditionally blacklisted otherwise.
If there's no floppy.ko, the loop will still execute with the glob
itself (unless nullglob is set but it's usually not).

> +    if [ -e "$f" ]
> +    then
> +        blacklist "floppy"
> +        break
> +    fi
> +done

 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