Skip to content

Clean up util directory#59

Merged
derobins merged 3 commits into
developfrom
derobins/shellcheck_fixes
Nov 18, 2025
Merged

Clean up util directory#59
derobins merged 3 commits into
developfrom
derobins/shellcheck_fixes

Conversation

@derobins
Copy link
Copy Markdown
Collaborator

@derobins derobins commented Nov 18, 2025

  • Run shellcheck over shell scripts
  • Run Ruff or similar over the Python script
  • Annotate script purpose in README.md and remove the [INTERNAL] tag
  • Remove unused scripts

Copilot AI review requested due to automatic review settings November 18, 2025 05:38
@derobins
Copy link
Copy Markdown
Collaborator Author

I'll hassle everyone tomorrow about the scripts in util. I want to document those in the directory's README.md file (or delete them if they are unused).

@derobins derobins marked this pull request as draft November 18, 2025 05:40
@derobins derobins changed the title Add quoting from shellcheck Clean up util directory Nov 18, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds proper variable quoting to shell scripts based on shellcheck recommendations, improving script reliability and preventing word splitting and globbing issues. The changes span four utility scripts that handle VFIO device binding, FIO benchmarking, clang formatting, and git file change detection.

Key changes:

  • Added quotes around all variable expansions in file paths and command arguments
  • Properly quoted command substitutions with nested variable expansions
  • Improved arithmetic expression formatting by removing unnecessary ${} syntax within $(())

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
util/vfio.sh Added quotes around $bdf, $vendor_id, $device_id, $iommu_group, and $driver variables in file paths and echo statements
util/iterate-fio-jobs.sh Added quotes around variables in eval commands, echo statements, and jq operations; improved arithmetic expression formatting
util/full-clang-lint.sh Added quotes around $WORKING_DIRECTORY and $file_to_lint in find and clang-format commands
util/files-changed.sh Added quotes around git command arguments and pattern matching variables

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread util/iterate-fio-jobs.sh Outdated
FIO_PID=$!
echo "FIO_PID: ${FIO_PID}"
pidstat_output=$(pidstat -u -p ${FIO_PID} 1 $((${fio_runtime}+${fio_ramptime})))
pidstat_output=$(pidstat -u -p ${FIO_PID} 1 $((fio_runtime + fio_ramptime)))
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable ${FIO_PID} should be quoted as \"${FIO_PID}\" to be consistent with the PR's shellcheck quoting improvements and prevent potential word splitting issues.

Suggested change
pidstat_output=$(pidstat -u -p ${FIO_PID} 1 $((fio_runtime + fio_ramptime)))
pidstat_output=$(pidstat -u -p "${FIO_PID}" 1 $((fio_runtime + fio_ramptime)))

Copilot uses AI. Check for mistakes.
Comment thread util/files-changed.sh
fi
done

printf '%s' ${FILES_CHANGED}
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable ${FILES_CHANGED} should be quoted as \"${FILES_CHANGED}\" to be consistent with the PR's shellcheck quoting improvements, even though it contains only numeric values.

Suggested change
printf '%s' ${FILES_CHANGED}
printf '%s' "${FILES_CHANGED}"

Copilot uses AI. Check for mistakes.
* Remove [INTERNAL] tag and rename H1 to hipFile
* Add H2 entries for each script
Copilot AI review requested due to automatic review settings November 18, 2025 19:53
@derobins derobins force-pushed the derobins/shellcheck_fixes branch from 522a64b to 243369c Compare November 18, 2025 19:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread util/README.md Outdated
@derobins derobins marked this pull request as ready for review November 18, 2025 20:30
Copilot AI review requested due to automatic review settings November 18, 2025 20:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread util/files-changed.sh
fi
done

printf '%s' ${FILES_CHANGED}
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable FILES_CHANGED should be quoted here to follow the same shellcheck improvements applied to other variables in this file. This ensures consistent behavior when the variable is empty or contains special characters.

Suggested change:

printf '%s' "${FILES_CHANGED}"
Suggested change
printf '%s' ${FILES_CHANGED}
printf '%s' "${FILES_CHANGED}"

Copilot uses AI. Check for mistakes.
Comment thread util/README.md

## llvm-coverage.sh

Code coverage script used by CI.
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The README.md documents all shell scripts but doesn't mention the docker/ subdirectory which contains three DOCKERFILE files (ais_ci_rocky, ais_ci_suse, ais_ci_ubuntu). Consider adding a section documenting the docker subdirectory and its purpose for completeness.

Example:

## docker/

Contains Dockerfiles for CI environments on different Linux distributions (Rocky, SUSE, Ubuntu).
Suggested change
Code coverage script used by CI.
Code coverage script used by CI.
## docker/
Contains Dockerfiles for CI environments on different Linux distributions (Rocky, SUSE, Ubuntu).

Copilot uses AI. Check for mistakes.
@derobins derobins merged commit 016af24 into develop Nov 18, 2025
78 of 85 checks passed
@derobins derobins deleted the derobins/shellcheck_fixes branch November 18, 2025 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants