grubby-8.40-83.fc43

List of Findings

Error: SHELLCHECK_WARNING (CWE-140): [#def1]
/usr/bin/grubby:88:12: warning[SC2207]: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
#   86|       local -a files
#   87|       local IFS=$'\n'
#   88|->     files=($(for bls in ${blsdir}/*.conf ; do
#   89|           if ! [[ -e "${bls}" ]] ; then
#   90|               continue

Error: SHELLCHECK_WARNING (CWE-563): [#def2]
/usr/bin/grubby:101:9: warning[SC2034]: bls_version appears unused. Verify use (or export if used externally).
#   99|           bls_file[$count]="${blspath}"
#  100|           bls_title[$count]="$(get_bls_value ${blspath} title)"
#  101|->         bls_version[$count]="$(get_bls_value ${blspath} version)"
#  102|           bls_linux[$count]="$(get_bls_value ${blspath} linux)"
#  103|           bls_initrd[$count]="$(get_bls_value ${blspath} initrd)"

Error: SHELLCHECK_WARNING (CWE-563): [#def3]
/usr/bin/grubby:115:11: warning[SC2034]: version appears unused. Verify use (or export if used externally).
#  113|       local index="-1"
#  114|       local title=""
#  115|->     local version=""
#  116|       if [[ $bootloader = "grub2" ]]; then
#  117|   	default="$(grep '^saved_entry=' ${env} | sed -e 's/^saved_entry=//')"

Error: SHELLCHECK_WARNING (CWE-88): [#def4]
/usr/bin/grubby:128:14: error[SC2068]: Double quote array expansions to avoid re-splitting elements.
#  126|       fi
#  127|   
#  128|->     for i in ${!bls_file[@]}; do
#  129|           if [[ $i -eq $index ]]; then
#  130|               echo $i

Error: SHELLCHECK_WARNING (CWE-153): [#def5]
/usr/bin/grubby:134:26: warning[SC2053]: Quote the right-hand side of = in [[ ]] to prevent glob matching.
#  132|           fi
#  133|   
#  134|->         if [[ $default = ${bls_id[$i]} || $default = ${bls_title[$i]} ]]; then
#  135|               echo $i
#  136|               return

Error: SHELLCHECK_WARNING (CWE-153): [#def6]
/usr/bin/grubby:134:54: warning[SC2053]: Quote the right-hand side of = in [[ ]] to prevent glob matching.
#  132|           fi
#  133|   
#  134|->         if [[ $default = ${bls_id[$i]} || $default = ${bls_title[$i]} ]]; then
#  135|               echo $i
#  136|               return

Error: SHELLCHECK_WARNING (CWE-571): [#def7]
/usr/bin/grubby:142:11: warning[SC2155]: Declare and assign separately to avoid masking return values.
#  140|   
#  141|   display_default_value() {
#  142|->     local prefix=$(get_prefix)
#  143|   
#  144|       case "$display_default" in

Error: SHELLCHECK_WARNING (CWE-88): [#def8]
/usr/bin/grubby:165:18: error[SC2068]: Double quote array expansions to avoid re-splitting elements.
#  163|   
#  164|       if [[ $param = "ALL" ]]; then
#  165|->         for i in ${!bls_file[@]}; do
#  166|               indexes="$indexes $i"
#  167|           done

Error: SHELLCHECK_WARNING (CWE-88): [#def9]
/usr/bin/grubby:177:14: error[SC2068]: Double quote array expansions to avoid re-splitting elements.
#  175|       fi
#  176|   
#  177|->     for i in ${!bls_file[@]}; do
#  178|           if [[ $param = "${bls_linux[$i]}" || "/${param##*/}" = "${bls_linux[$i]}" ]]; then
#  179|               indexes="$indexes $i"

Error: SHELLCHECK_WARNING (CWE-153): [#def10]
/usr/bin/grubby:186:17: warning[SC2053]: Quote the right-hand side of = in [[ ]] to prevent glob matching.
#  184|           fi
#  185|   
#  186|-> 	if [[ $param = $i ]]; then
#  187|   	    indexes="$indexes $i"
#  188|   	fi

Error: SHELLCHECK_WARNING (CWE-571): [#def11]
/usr/bin/grubby:211:15: warning[SC2155]: Declare and assign separately to avoid masking return values.
#  209|   
#  210|       if [[ $bootloader == "grub2" ]]; then
#  211|->         local value="$(grub2-editenv "${env}" list | grep ${var##$} | sed -e "s/${var##$}=//")"
#  212|           value="$(echo ${value} | sed -e 's/\//\\\//g')"
#  213|           if [[ -n $value ]]; then

Error: SHELLCHECK_WARNING (CWE-140): [#def12]
/usr/bin/grubby:224:17: warning[SC2206]: Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a.
#  222|   {
#  223|       local args=${bls_options[$1]}
#  224|->     local opts=(${args})
#  225|   
#  226|       for opt in ${opts[*]}; do

Error: SHELLCHECK_WARNING (CWE-569): [#def13]
/usr/bin/grubby:226:16: warning[SC2048]: Use "${array[@]}" (with quotes) to prevent whitespace problems.
#  224|       local opts=(${args})
#  225|   
#  226|->     for opt in ${opts[*]}; do
#  227|           [[ $opt = "\$kernelopts" ]] && echo "true"
#  228|       done

Error: SHELLCHECK_WARNING (CWE-140): [#def14]
/usr/bin/grubby:235:17: warning[SC2206]: Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a.
#  233|   get_bls_args() {
#  234|       local args=${bls_options[$1]}
#  235|->     local opts=(${args})
#  236|   
#  237|       for opt in ${opts[*]}; do

Error: SHELLCHECK_WARNING (CWE-569): [#def15]
/usr/bin/grubby:237:16: warning[SC2048]: Use "${array[@]}" (with quotes) to prevent whitespace problems.
#  235|       local opts=(${args})
#  236|   
#  237|->     for opt in ${opts[*]}; do
#  238|           if [[ $opt = "\$kernelopts" ]]; then
#  239|               value="$(expand_var $opt)"

Error: SHELLCHECK_WARNING (CWE-140): [#def16]
/usr/bin/grubby:248:20: warning[SC2207]: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
#  246|   
#  247|   display_info_values() {
#  248|->     local indexes=($(param_to_indexes "$1"))
#  249|       local prefix=$(get_prefix)
#  250|   

Error: SHELLCHECK_WARNING (CWE-571): [#def17]
/usr/bin/grubby:249:11: warning[SC2155]: Declare and assign separately to avoid masking return values.
#  247|   display_info_values() {
#  248|       local indexes=($(param_to_indexes "$1"))
#  249|->     local prefix=$(get_prefix)
#  250|   
#  251|       if [[ $indexes = "-1" ]]; then

Error: SHELLCHECK_WARNING (CWE-670): [#def18]
/usr/bin/grubby:251:11: warning[SC2128]: Expanding an array without an index only gives the first element.
#  249|       local prefix=$(get_prefix)
#  250|   
#  251|->     if [[ $indexes = "-1" ]]; then
#  252|           print_error "The param $1 is incorrect"
#  253|       fi

Error: SHELLCHECK_WARNING (CWE-569): [#def19]
/usr/bin/grubby:255:14: warning[SC2048]: Use "${array[@]}" (with quotes) to prevent whitespace problems.
#  253|       fi
#  254|   
#  255|->     for i in ${indexes[*]}; do
#  256|           local root=""
#  257|           local value=""

Error: SHELLCHECK_WARNING (CWE-571): [#def20]
/usr/bin/grubby:258:15: warning[SC2155]: Declare and assign separately to avoid masking return values.
#  256|           local root=""
#  257|           local value=""
#  258|->         local args="$(get_bls_args "$i")"
#  259|   
#  260|           local opts=(${args})

Error: SHELLCHECK_WARNING (CWE-140): [#def21]
/usr/bin/grubby:260:21: warning[SC2206]: Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a.
#  258|           local args="$(get_bls_args "$i")"
#  259|   
#  260|->         local opts=(${args})
#  261|   
#  262|           for opt in ${opts[*]}; do

Error: SHELLCHECK_WARNING (CWE-569): [#def22]
/usr/bin/grubby:262:20: warning[SC2048]: Use "${array[@]}" (with quotes) to prevent whitespace problems.
#  260|           local opts=(${args})
#  261|   
#  262|->         for opt in ${opts[*]}; do
#  263|               if echo $opt | grep -q "^root="; then
#  264|                   root="$(echo $opt | sed -e 's/root=//')"

Error: SHELLCHECK_WARNING (CWE-140): [#def23]
/usr/bin/grubby:330:20: warning[SC2207]: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
#  328|   
#  329|   remove_bls_fragment() {
#  330|->     local indexes=($(param_to_indexes "$1"))
#  331|   
#  332|       if [[ $indexes = "-1" ]]; then

Error: SHELLCHECK_WARNING (CWE-670): [#def24]
/usr/bin/grubby:332:11: warning[SC2128]: Expanding an array without an index only gives the first element.
#  330|       local indexes=($(param_to_indexes "$1"))
#  331|   
#  332|->     if [[ $indexes = "-1" ]]; then
#  333|   	print_error "The param $(get_prefix)$1 is incorrect"
#  334|       fi

Error: SHELLCHECK_WARNING (CWE-153): [#def25]
/usr/bin/grubby:337:32: warning[SC2053]: Quote the right-hand side of = in [[ ]] to prevent glob matching.
#  335|   
#  336|       for i in "${indexes[@]}"; do
#  337|->         if [[ $default_index = $i ]]; then
#  338|               unset_default_bls
#  339|           fi

Error: SHELLCHECK_WARNING (CWE-140): [#def26]
/usr/bin/grubby:462:24: warning[SC2206]: Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a.
#  460|   update_args() {
#  461|       local args=$1 && shift
#  462|->     local remove_args=($1) && shift
#  463|       local add_args=($1) && shift
#  464|   

Error: SHELLCHECK_WARNING (CWE-140): [#def27]
/usr/bin/grubby:463:21: warning[SC2206]: Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a.
#  461|       local args=$1 && shift
#  462|       local remove_args=($1) && shift
#  463|->     local add_args=($1) && shift
#  464|   
#  465|       for arg in ${remove_args[*]}; do

Error: SHELLCHECK_WARNING (CWE-569): [#def28]
/usr/bin/grubby:465:16: warning[SC2048]: Use "${array[@]}" (with quotes) to prevent whitespace problems.
#  463|       local add_args=($1) && shift
#  464|   
#  465|->     for arg in ${remove_args[*]}; do
#  466|           arg="$(echo $arg | sed -e 's/\//\\\//g')"
#  467|           if [[ $arg = *"="* ]]; then

Error: SHELLCHECK_WARNING (CWE-569): [#def29]
/usr/bin/grubby:474:16: warning[SC2048]: Use "${array[@]}" (with quotes) to prevent whitespace problems.
#  472|       done
#  473|   
#  474|->     for arg in ${add_args[*]}; do
#  475|           arg="${arg%%=*}"
#  476|           arg="$(echo $arg | sed -e 's/\//\\\//g')"

Error: SHELLCHECK_WARNING (CWE-569): [#def30]
/usr/bin/grubby:480:16: warning[SC2048]: Use "${array[@]}" (with quotes) to prevent whitespace problems.
#  478|       done
#  479|   
#  480|->     for arg in ${add_args[*]}; do
#  481|           args="$args $arg"
#  482|       done

Error: SHELLCHECK_WARNING (CWE-140): [#def31]
/usr/bin/grubby:489:20: warning[SC2207]: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
#  487|   update_bls_fragment() {
#  488|       local param="$1"
#  489|->     local indexes=($(param_to_indexes "$1")) && shift
#  490|       local remove_args=$1 && shift
#  491|       local add_args=$1 && shift

Error: SHELLCHECK_WARNING (CWE-398): [#def32]
/usr/bin/grubby:490:11: warning[SC2178]: Variable was used as an array but is now assigned a string.
#  488|       local param="$1"
#  489|       local indexes=($(param_to_indexes "$1")) && shift
#  490|->     local remove_args=$1 && shift
#  491|       local add_args=$1 && shift
#  492|       local initrd=$1 && shift

Error: SHELLCHECK_WARNING (CWE-398): [#def33]
/usr/bin/grubby:491:11: warning[SC2178]: Variable was used as an array but is now assigned a string.
#  489|       local indexes=($(param_to_indexes "$1")) && shift
#  490|       local remove_args=$1 && shift
#  491|->     local add_args=$1 && shift
#  492|       local initrd=$1 && shift
#  493|       local opts

Error: SHELLCHECK_WARNING (CWE-670): [#def34]
/usr/bin/grubby:495:11: warning[SC2128]: Expanding an array without an index only gives the first element.
#  493|       local opts
#  494|   
#  495|->     if [[ $indexes = "-1" ]]; then
#  496|           print_error "The param $(get_prefix)${param} is incorrect"
#  497|       fi

Error: SHELLCHECK_WARNING (CWE-670): [#def35]
/usr/bin/grubby:499:61: warning[SC2128]: Expanding an array without an index only gives the first element.
#  497|       fi
#  498|   
#  499|->     if [[ $param = "ALL" && $bootloader = grub2 ]] && [[ -n $remove_args || -n $add_args ]]; then
#  500|           local old_args=""
#  501|   

Error: SHELLCHECK_WARNING (CWE-670): [#def36]
/usr/bin/grubby:499:80: warning[SC2128]: Expanding an array without an index only gives the first element.
#  497|       fi
#  498|   
#  499|->     if [[ $param = "ALL" && $bootloader = grub2 ]] && [[ -n $remove_args || -n $add_args ]]; then
#  500|           local old_args=""
#  501|   

Error: SHELLCHECK_WARNING (CWE-569): [#def37]
/usr/bin/grubby:520:14: warning[SC2048]: Use "${array[@]}" (with quotes) to prevent whitespace problems.
#  518|       fi
#  519|   
#  520|->     for i in ${indexes[*]}; do
#  521|   	if [[ -n $remove_args || -n $add_args ]]; then
#  522|               local old_args="$(get_bls_args "$i")"

Error: SHELLCHECK_WARNING (CWE-571): [#def38]
/usr/bin/grubby:522:19: warning[SC2155]: Declare and assign separately to avoid masking return values.
#  520|       for i in ${indexes[*]}; do
#  521|   	if [[ -n $remove_args || -n $add_args ]]; then
#  522|->             local old_args="$(get_bls_args "$i")"
#  523|               local new_args="$(update_args "${old_args}" "${remove_args}" "${add_args}")"
#  524|   

Error: SHELLCHECK_WARNING (CWE-571): [#def39]
/usr/bin/grubby:523:19: warning[SC2155]: Declare and assign separately to avoid masking return values.
#  521|   	if [[ -n $remove_args || -n $add_args ]]; then
#  522|               local old_args="$(get_bls_args "$i")"
#  523|->             local new_args="$(update_args "${old_args}" "${remove_args}" "${add_args}")"
#  524|   
#  525|               if [[ $param != "ALL" || "$(has_kernelopts "$i")" = "false" ]]; then

Error: SHELLCHECK_WARNING (CWE-571): [#def40]
/usr/bin/grubby:545:8: warning[SC2155]: Declare and assign separately to avoid masking return values.
#  543|   
#  544|   	read old_args < /etc/kernel/cmdline
#  545|-> 	local new_args="$(update_args "${old_args}" "${remove_args}" "${add_args}")"
#  546|   	echo "$new_args" > /etc/kernel/cmdline
#  547|       fi

Error: SHELLCHECK_WARNING (CWE-140): [#def41]
/usr/bin/grubby:553:18: warning[SC2207]: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
#  551|   
#  552|   set_default_bls() {
#  553|->     local index=($(param_to_indexes "$1"))
#  554|   
#  555|       if [[ $index = "-1" ]]; then

Error: SHELLCHECK_WARNING (CWE-670): [#def42]
/usr/bin/grubby:555:11: warning[SC2128]: Expanding an array without an index only gives the first element.
#  553|       local index=($(param_to_indexes "$1"))
#  554|   
#  555|->     if [[ $index = "-1" ]]; then
#  556|           print_error "The param $1 is incorrect"
#  557|       fi

Error: SHELLCHECK_WARNING (CWE-670): [#def43]
/usr/bin/grubby:560:58: warning[SC2128]: Expanding an array without an index only gives the first element.
#  558|   
#  559|       if [[ $bootloader = grub2 ]]; then
#  560|->         grub2-editenv "${env}" set saved_entry="${bls_id[$index]}"
#  561|       else
#  562|           local default="${bls_title[$index]}"

Error: SHELLCHECK_WARNING (CWE-670): [#def44]
/usr/bin/grubby:562:36: warning[SC2128]: Expanding an array without an index only gives the first element.
#  560|           grub2-editenv "${env}" set saved_entry="${bls_id[$index]}"
#  561|       else
#  562|->         local default="${bls_title[$index]}"
#  563|           local current="$(grep '^default=' ${zipl_config} | sed -e 's/^default=//')"
#  564|           if [[ -n $current ]]; then

Error: SHELLCHECK_WARNING (CWE-571): [#def45]
/usr/bin/grubby:563:15: warning[SC2155]: Declare and assign separately to avoid masking return values.
#  561|       else
#  562|           local default="${bls_title[$index]}"
#  563|->         local current="$(grep '^default=' ${zipl_config} | sed -e 's/^default=//')"
#  564|           if [[ -n $current ]]; then
#  565|               sed -i -e "s,^default=.*,default=${default}," "${zipl_config}"

Error: SHELLCHECK_WARNING (CWE-670): [#def46]
/usr/bin/grubby:571:43: warning[SC2128]: Expanding an array without an index only gives the first element.
#  569|       fi
#  570|   
#  571|->     print_info "The default is ${bls_file[$index]} with index $index and kernel $(get_prefix)${bls_linux[$index]}"
#  572|   }
#  573|   

Error: SHELLCHECK_WARNING (CWE-670): [#def47]
/usr/bin/grubby:571:63: warning[SC2128]: Expanding an array without an index only gives the first element.
#  569|       fi
#  570|   
#  571|->     print_info "The default is ${bls_file[$index]} with index $index and kernel $(get_prefix)${bls_linux[$index]}"
#  572|   }
#  573|   

Error: SHELLCHECK_WARNING (CWE-670): [#def48]
/usr/bin/grubby:571:106: warning[SC2128]: Expanding an array without an index only gives the first element.
#  569|       fi
#  570|   
#  571|->     print_info "The default is ${bls_file[$index]} with index $index and kernel $(get_prefix)${bls_linux[$index]}"
#  572|   }
#  573|   

Error: SHELLCHECK_WARNING (CWE-457): [#def49]
/usr/bin/grubby:837:15: warning[SC2154]: kernelopts is referenced but not assigned.
#  835|       else
#  836|   	opts="${opts} ${args}"
#  837|-> 	remove_args="$kernelopts"
#  838|   	update_args "${opts}" "${remove_args}" ""
#  839|       fi

Scan Properties

analyzer-version-clippy1.86.0
analyzer-version-cppcheck2.17.1
analyzer-version-gcc15.0.1
analyzer-version-gcc-analyzer15.0.1
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-37.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250425.124705.g1c7c448.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-namegrubby-8.40-83.fc43
store-results-to/tmp/tmp25f1cxf4/grubby-8.40-83.fc43.tar.xz
time-created2025-04-25 12:49:26
time-finished2025-04-25 12:50:31
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'unicontrol,cppcheck,gcc,clippy,shellcheck' '-o' '/tmp/tmp25f1cxf4/grubby-8.40-83.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmp25f1cxf4/grubby-8.40-83.fc43.src.rpm'
tool-versioncsmock-3.8.1.20250422.172604.g26bc3d6-1.el9