Skip to content

Conversation

liweidong1722
Copy link

Previously only /etc/default/grub was sourced, ignoring fragments in /etc/default/grub.d. This patch sources all *.cfg files after the main grub file, allowing configuration fragments to override defaults.

Copy link

openshift-ci bot commented Sep 29, 2025

Hi @liweidong1722. Thanks for your PR.

I'm waiting for a ostreedev member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the grub2 boot script to source configuration fragments from /etc/default/grub.d/*.cfg after the main /etc/default/grub file. This allows for more modular configuration and overrides. The implementation is straightforward, but I've suggested a minor improvement to make it more robust by ensuring only regular files are sourced, preventing potential errors if a directory or special file matches the pattern.

. /etc/default/grub

for f in /etc/default/grub.d/*.cfg; do
[ -e "$f" ] && . "$f"

Choose a reason for hiding this comment

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

medium

To make the script more robust, it's better to check if $f is a regular file using [ -f "$f" ] instead of just checking for existence with [ -e "$f" ]. This prevents the script from attempting to source a directory or other special file that happens to end with .cfg, which would result in an error.

Suggested change
[ -e "$f" ] && . "$f"
[ -f "$f" ] && . "$f"

Previously only /etc/default/grub was sourced, ignoring fragments in
/etc/default/grub.d. This patch sources all *.cfg files after the main
grub file, allowing configuration fragments to override defaults.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant