Newly introduced findings

List of Findings

Error: SHELLCHECK_WARNING (CWE-457): [#def1]
/usr/bin/dracut:2028:56: warning[SC2154]: systemdnetworkconfdir is referenced but not assigned.
# 2026|                   printf "%s\n" "systemdsystemunitdir=\"$systemdsystemunitdir\""
# 2027|                   printf "%s\n" "systemdsystemconfdir=\"$systemdsystemconfdir\""
# 2028|->                 printf "%s\n" "systemdnetworkconfdir=\"$systemdnetworkconfdir\""
# 2029|               } > "${initdir}"/etc/conf.d/systemd.conf
# 2030|           fi

Error: SHELLCHECK_WARNING (CWE-457): [#def2]
/usr/lib/dracut/dracut-init.sh:714:23: warning[SC2154]: sysusers is referenced but not assigned.
#  712|   # install sysusers files
#  713|   inst_sysusers() {
#  714|->     inst_multiple -o "$sysusers/$*"
#  715|   
#  716|       if [[ $hostonly ]]; then

Error: SHELLCHECK_WARNING (CWE-457): [#def3]
/usr/lib/dracut/dracut-init.sh:717:30: warning[SC2154]: sysusersconfdir is referenced but not assigned.
#  715|   
#  716|       if [[ $hostonly ]]; then
#  717|->         inst_multiple -H -o "$sysusersconfdir/$*"
#  718|       fi
#  719|   }

Error: SHELLCHECK_WARNING (CWE-758): [#def4]
/usr/lib/dracut/dracut-version.sh:1:1: error[SC2148]: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
#    1|-> DRACUT_VERSION=103-1.fc42

Error: SHELLCHECK_WARNING (CWE-563): [#def5]
/usr/lib/dracut/dracut-version.sh:1:1: warning[SC2034]: DRACUT_VERSION appears unused. Verify use (or export if used externally).
#    1|-> DRACUT_VERSION=103-1.fc42

Error: SHELLCHECK_WARNING (CWE-457): [#def6]
/usr/lib/dracut/modules.d/01fips-crypto-policies/module-setup.sh:6:11: warning[SC2154]: dracutsysrootdir is referenced but not assigned.
#    4|   check() {
#    5|       # only enable on systems that use crypto-policies
#    6|->     [ -d "$dracutsysrootdir/etc/crypto-policies" ] && return 0
#    7|   
#    8|       # include when something else depends on it or it is explicitly requested

Error: SHELLCHECK_WARNING (CWE-457): [#def7]
/usr/lib/dracut/modules.d/01fips-crypto-policies/module-setup.sh:25:29: warning[SC2154]: moddir is referenced but not assigned.
#   23|   # called by dracut
#   24|   install() {
#   25|->     inst_hook pre-pivot 01 "$moddir/fips-crypto-policies.sh"
#   26|   
#   27|       inst_multiple mount

Error: SHELLCHECK_WARNING (CWE-457): [#def8]
/usr/lib/dracut/modules.d/01systemd-networkd/module-setup.sh:62:18: warning[SC2154]: moddir is referenced but not assigned.
#   60|           ip sed grep
#   61|   
#   62|->     inst_simple "$moddir"/99-wait-online-dracut.conf \
#   63|           "$systemdsystemunitdir"/systemd-networkd-wait-online.service.d/99-dracut.conf
#   64|   

Error: SHELLCHECK_WARNING (CWE-457): [#def9]
/usr/lib/dracut/modules.d/01systemd-networkd/module-setup.sh:66:10: warning[SC2154]: systemdnetworkconfdir is referenced but not assigned.
#   64|   
#   65|       inst_simple "$moddir"/99-default.network \
#   66|->         "$systemdnetworkconfdir"/99-dracut-default.network
#   67|   
#   68|       inst_hook cmdline 99 "$moddir"/networkd-config.sh

Error: SHELLCHECK_WARNING (CWE-457): [#def10]
/usr/lib/dracut/modules.d/01systemd-networkd/networkd-config.sh:23:12: warning[SC2154]: systemdnetworkconfdir is referenced but not assigned.
#   21|   
#   22|       # Remove the default network if at least one was generated
#   23|->     rm -f "$systemdnetworkconfdir"/99-dracut-default.network
#   24|   done
#   25|   

Error: SHELLCHECK_WARNING (CWE-457): [#def11]
/usr/lib/dracut/modules.d/01systemd-udevd/module-setup.sh:33:10: warning[SC2154]: udevrulesdir is referenced but not assigned.
#   31|   
#   32|       inst_multiple -o \
#   33|->         "$udevrulesdir"/99-systemd.rules \
#   34|           "$systemdutildir"/systemd-udevd \
#   35|           "$systemdsystemunitdir"/systemd-udevd.service \

Error: SHELLCHECK_WARNING (CWE-457): [#def12]
/usr/lib/dracut/modules.d/01systemd-udevd/module-setup.sh:68:18: warning[SC2154]: systemdutilconfdir is referenced but not assigned.
#   66|           if dracut_module_included "hwdb"; then
#   67|               inst_multiple -H -o \
#   68|->                 "$systemdutilconfdir"/hwdb/hwdb.bin
#   69|           fi
#   70|       fi

Error: SHELLCHECK_WARNING: [#def13]
/usr/lib/dracut/modules.d/90mdraid/mdraid_start.sh:35:5: warning[SC3043]: In POSIX sh, 'local' is undefined.
#   33|       local _UUID
#   34|       local _MD_UUID
#   35|->     local _LEFT_UUID
#   36|       local _uuid
#   37|   

Error: SHELLCHECK_WARNING: [#def14]
/usr/lib/dracut/modules.d/90mdraid/mdraid_start.sh:36:5: warning[SC3043]: In POSIX sh, 'local' is undefined.
#   34|       local _MD_UUID
#   35|       local _LEFT_UUID
#   36|->     local _uuid
#   37|   
#   38|       _MD_UUID=$(getargs rd.md.uuid -d rd_MD_UUID=)

Error: SHELLCHECK_WARNING (CWE-457): [#def15]
/usr/lib/dracut/modules.d/95hwdb/module-setup.sh:13:20: warning[SC2154]: udevconfdir is referenced but not assigned.
#   11|       # Follow the same priority as `systemd-hwdb`; `/etc` is the default
#   12|       # and `/usr/lib` an alternative location.
#   13|->     inst_multiple "${udevconfdir}"/hwdb.bin
#   14|   
#   15|       if [[ $hostonly ]]; then

Error: SHELLCHECK_WARNING (CWE-457): [#def16]
/usr/lib/dracut/modules.d/95hwdb/module-setup.sh:16:30: warning[SC2154]: udevdir is referenced but not assigned.
#   14|   
#   15|       if [[ $hostonly ]]; then
#   16|->         inst_multiple -H -o "${udevdir}"/hwdb.bin
#   17|       fi
#   18|   }

Error: SHELLCHECK_WARNING (CWE-457): [#def17]
/usr/lib/dracut/modules.d/95nbd/nbdroot.sh:99:7: warning[SC2154]: root is referenced but not assigned (did you mean 'nroot'?).
#   97|   # If we didn't get a root= on the command line, then we need to
#   98|   # add the udev rules for mounting the nbd0 device
#   99|-> if [ "$root" = "block:/dev/root" ] || [ "$root" = "dhcp" ]; then
#  100|       printf 'KERNEL=="nbd0", ENV{DEVTYPE}!="partition", ENV{ID_FS_TYPE}=="?*", SYMLINK+="root"\n' > /etc/udev/rules.d/99-nbd-root.rules
#  101|       udevadm control --reload

Error: SHELLCHECK_WARNING (CWE-277): [#def18]
/usr/lib/dracut/modules.d/95nfs/nfsroot-cleanup.sh:20:18: warning[SC2174]: When used with -p, -m only applies to the deepest directory.
#   18|       # try to create the destination directory
#   19|       [ -d "$NEWROOT/$rpcpipefspath" ] \
#   20|->         || mkdir -m 0755 -p "$NEWROOT/$rpcpipefspath" 2> /dev/null
#   21|   
#   22|       if [ -d "$NEWROOT/$rpcpipefspath" ]; then

Error: SHELLCHECK_WARNING (CWE-457): [#def19]
/usr/lib/dracut/modules.d/95resume/resume.sh:5:26: warning[SC2154]: resume is referenced but not assigned.
#    3|   PATH=/usr/sbin:/usr/bin:/sbin:/bin
#    4|   
#    5|-> [ -s /.resume ] && [ -b "$resume" ] && {
#    6|       # First try user level resume; it offers splash etc
#    7|       case "$splash" in

Error: SHELLCHECK_WARNING (CWE-457): [#def20]
/usr/lib/dracut/modules.d/95udev-rules/module-setup.sh:103:14: warning[SC2154]: udevrulesconfdir is referenced but not assigned.
#  101|           inst_multiple -H -o \
#  102|               /etc/udev/udev.conf \
#  103|->             "$udevrulesconfdir/*.rules"
#  104|       fi
#  105|   }

Error: SHELLCHECK_WARNING (CWE-457): [#def21]
/usr/lib/dracut/modules.d/95virtiofs/mount-virtiofs.sh:5:7: warning[SC2154]: fstype is referenced but not assigned.
#    3|   type ismounted > /dev/null 2>&1 || . /lib/dracut-lib.sh
#    4|   
#    5|-> if [ "${fstype}" = "virtiofs" ] || [ "${root%%:*}" = "virtiofs" ]; then
#    6|       if ! load_fstype virtiofs; then
#    7|           die "virtiofs is required but not available."

Error: SHELLCHECK_WARNING (CWE-457): [#def22]
/usr/lib/dracut/modules.d/95virtiofs/mount-virtiofs.sh:5:39: warning[SC2154]: root is referenced but not assigned.
#    3|   type ismounted > /dev/null 2>&1 || . /lib/dracut-lib.sh
#    4|   
#    5|-> if [ "${fstype}" = "virtiofs" ] || [ "${root%%:*}" = "virtiofs" ]; then
#    6|       if ! load_fstype virtiofs; then
#    7|           die "virtiofs is required but not available."

Error: SHELLCHECK_WARNING (CWE-457): [#def23]
/usr/lib/dracut/modules.d/95virtiofs/parse-virtiofs.sh:6:7: warning[SC2154]: fstype is referenced but not assigned.
#    4|   # 	root=virtiofs:<tag>
#    5|   
#    6|-> if [ "${fstype}" = "virtiofs" ] || [ "${root%%:*}" = "virtiofs" ]; then
#    7|       # shellcheck disable=SC2034
#    8|       rootok=1

Error: SHELLCHECK_WARNING (CWE-457): [#def24]
/usr/lib/dracut/modules.d/95virtiofs/parse-virtiofs.sh:6:39: warning[SC2154]: root is referenced but not assigned.
#    4|   # 	root=virtiofs:<tag>
#    5|   
#    6|-> if [ "${fstype}" = "virtiofs" ] || [ "${root%%:*}" = "virtiofs" ]; then
#    7|       # shellcheck disable=SC2034
#    8|       rootok=1

Error: CLIPPY_WARNING: [#def25]
dracut-103-build/src/main.rs:134:21: warning: redundant field names in struct initialization
#      |
#  134 |                     dev: dev,
#      |                     ^^^^^^^^ help: replace it with: `dev`
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names
#      = note: `#[warn(clippy::redundant_field_names)]` on by default

Error: CLIPPY_WARNING: [#def26]
dracut-103-build/src/main.rs:149:5: warning: this function has too many arguments (10/7)
#      |
#  149 | /     pub fn hardlink_seen<W: Write + Seek>(
#  150 | |         &mut self,
#  151 | |         props: &ArchiveProperties,
#  152 | |         mut writer: W,
#  ...   |
#  159 | |         mapped_nlink: &mut Option<u32>,
#  160 | |     ) -> std::io::Result<bool> {
#      | |______________________________^
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
#      = note: `#[warn(clippy::too_many_arguments)]` on by default

Error: CLIPPY_WARNING: [#def27]
dracut-103-build/src/main.rs:188:12: warning: deref which would be done by auto-deref
#      |
#  188 |         if (*hl).names.iter().any(|n| n.infile == inpath) {
#      |            ^^^^^ help: try: `hl`
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
#      = note: `#[warn(clippy::explicit_auto_deref)]` on by default

Error: CLIPPY_WARNING: [#def28]
dracut-103-build/src/main.rs:200:9: warning: deref which would be done by auto-deref
#      |
#  200 |         (*hl).seen += 1;
#      |         ^^^^^ help: try: `hl`
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref

Error: CLIPPY_WARNING: [#def29]
dracut-103-build/src/main.rs:201:12: warning: deref which would be done by auto-deref
#      |
#  201 |         if (*hl).seen > (*hl).nlink {
#      |            ^^^^^ help: try: `hl`
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref

Error: CLIPPY_WARNING: [#def30]
dracut-103-build/src/main.rs:201:25: warning: deref which would be done by auto-deref
#      |
#  201 |         if (*hl).seen > (*hl).nlink {
#      |                         ^^^^^ help: try: `hl`
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref

Error: CLIPPY_WARNING: [#def31]
dracut-103-build/src/main.rs:204:59: warning: deref which would be done by auto-deref
#      |
#  204 |             println!("hardlink seen {} exceeds nlink {}", (*hl).seen, (*hl).nlink);
#      |                                                           ^^^^^ help: try: `hl`
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref

Error: CLIPPY_WARNING: [#def32]
dracut-103-build/src/main.rs:204:71: warning: deref which would be done by auto-deref
#      |
#  204 |             println!("hardlink seen {} exceeds nlink {}", (*hl).seen, (*hl).nlink);
#      |                                                                       ^^^^^ help: try: `hl`
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref

Error: CLIPPY_WARNING: [#def33]
dracut-103-build/src/main.rs:207:12: warning: deref which would be done by auto-deref
#      |
#  207 |         if (*hl).seen < (*hl).nlink {
#      |            ^^^^^ help: try: `hl`
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref

Error: CLIPPY_WARNING: [#def34]
dracut-103-build/src/main.rs:207:25: warning: deref which would be done by auto-deref
#      |
#  207 |         if (*hl).seen < (*hl).nlink {
#      |                         ^^^^^ help: try: `hl`
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref

Error: CLIPPY_WARNING: [#def35]
dracut-103-build/src/main.rs:208:13: warning: deref which would be done by auto-deref
#      |
#  208 |             (*hl).names.push(HardlinkPath {
#      |             ^^^^^ help: try: `hl`
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref

Error: CLIPPY_WARNING: [#def36]
dracut-103-build/src/main.rs:218:21: warning: deref which would be done by auto-deref
#      |
#  218 |         for path in (*hl).names.iter().rev() {
#      |                     ^^^^^ help: try: `hl`
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref

Error: CLIPPY_WARNING: [#def37]
dracut-103-build/src/main.rs:227:23: warning: deref which would be done by auto-deref
#      |
#  227 |                 ino = (*hl).mapped_ino,
#      |                       ^^^^^ help: try: `hl`
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref

Error: CLIPPY_WARNING: [#def38]
dracut-103-build/src/main.rs:238:29: warning: deref which would be done by auto-deref
#      |
#  238 |                     true => (*hl).nlink,
#      |                             ^^^^^ help: try: `hl`
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref

Error: CLIPPY_WARNING: [#def39]
dracut-103-build/src/main.rs:264:28: warning: deref which would be done by auto-deref
#      |
#  264 |         *mapped_ino = Some((*hl).mapped_ino);
#      |                            ^^^^^ help: try: `hl`
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref

Error: CLIPPY_WARNING: [#def40]
dracut-103-build/src/main.rs:268:34: warning: deref which would be done by auto-deref
#      |
#  268 |             *mapped_nlink = Some((*hl).nlink);
#      |                                  ^^^^^ help: try: `hl`
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref

Error: CLIPPY_WARNING: [#def41]
dracut-103-build/src/main.rs:278:9: warning: unneeded `return` statement
#      |
#  278 |         return Ok(false);
#      |         ^^^^^^^^^^^^^^^^
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
#      = note: `#[warn(clippy::needless_return)]` on by default
#  help: remove `return`
#      |
#  278 -         return Ok(false);
#  278 +         Ok(false)
#      |

Error: CLIPPY_WARNING: [#def42]
dracut-103-build/src/main.rs:300:16: warning: length comparison to zero
#      |
#  300 |             if p.as_os_str().as_bytes().len() == 0 {
#      |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `p.as_os_str().as_bytes().is_empty()`
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
#      = note: `#[warn(clippy::len_zero)]` on by default

Error: CLIPPY_WARNING: [#def43]
dracut-103-build/src/main.rs:387:17: warning: this expression creates a reference which is immediately dereferenced by the compiler
#      |
#  387 |                 &props,
#      |                 ^^^^^^ help: change this to: `props`
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
#      = note: `#[warn(clippy::needless_borrow)]` on by default

Error: CLIPPY_WARNING: [#def44]
dracut-103-build/src/main.rs:392:17: warning: this expression creates a reference which is immediately dereferenced by the compiler
#      |
#  392 |                 &inpath,
#      |                 ^^^^^^^ help: change this to: `inpath`
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Error: CLIPPY_WARNING: [#def45]
dracut-103-build/src/main.rs:530:19: warning: length comparison to zero
#      |
#  530 |             while hl.names.len() > 0 {
#      |                   ^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!hl.names.is_empty()`
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero

Error: CLIPPY_WARNING: [#def46]
dracut-103-build/src/main.rs:541:8: warning: length comparison to zero
#      |
#  541 |     if deferred_inpaths.len() > 0 {
#      |        ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!deferred_inpaths.is_empty()`
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero

Error: CLIPPY_WARNING: [#def47]
dracut-103-build/src/main.rs:586:31: warning: casting to the same type is unnecessary (`u64` -> `u64`)
#      |
#  586 |     off += fname_len as u64 + padding_len as u64;
#      |                               ^^^^^^^^^^^^^^^^^^ help: try: `padding_len`
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
#      = note: `#[warn(clippy::unnecessary_cast)]` on by default

Error: CLIPPY_WARNING: [#def48]
dracut-103-build/src/main.rs:627:16: warning: length comparison to zero
#      |
#  627 |             if linebuf.len() == 0 {
#      |                ^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `linebuf.is_empty()`
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero

Scan Properties

analyzer-version-clippy1.82.0
analyzer-version-cppcheck2.16.0
analyzer-version-gcc14.2.1
analyzer-version-gcc-analyzer15.0.0
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.82.0
diffbase-analyzer-version-cppcheck2.16.0
diffbase-analyzer-version-gcc14.2.1
diffbase-analyzer-version-gcc-analyzer15.0.0
diffbase-analyzer-version-shellcheck0.10.0
diffbase-analyzer-version-unicontrol0.0.2
diffbase-enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
diffbase-exit-code0
diffbase-hostip-172-16-1-189.us-west-2.compute.internal
diffbase-mock-configfedora-rawhide-gcc-latest-x86_64
diffbase-project-namedracut-102-3.fc41
diffbase-store-results-to/tmp/tmp9zci55xy/dracut-102-3.fc41.tar.xz
diffbase-time-created2024-11-12 23:42:43
diffbase-time-finished2024-11-12 23:45:02
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmp9zci55xy/dracut-102-3.fc41.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmp9zci55xy/dracut-102-3.fc41.src.rpm'
diffbase-tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-189.us-west-2.compute.internal
mock-configfedora-rawhide-gcc-latest-x86_64
project-namedracut-103-1.fc42
store-results-to/tmp/tmpvfbncm_2/dracut-103-1.fc42.tar.xz
time-created2024-11-12 23:45:26
time-finished2024-11-12 23:47:23
titleNewly introduced findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmpvfbncm_2/dracut-103-1.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpvfbncm_2/dracut-103-1.fc42.src.rpm'
tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9