Skip to content

Conversation

@coiby
Copy link
Member

@coiby coiby commented Nov 20, 2025

This PR resolves #108 and #118 to enable complete xtrace in kdumpctl and mkdumprd.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @coiby, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the debugging capabilities of the kdump system by integrating xtrace functionality within the kdumpctl and mkdumprd scripts. It allows for more detailed output during the execution of these critical components, which will significantly aid in diagnosing and resolving issues.

Highlights

  • Enable xtrace detection in kdumpctl: The kdumpctl script now checks if xtrace is active and exports a debug variable accordingly.
  • Conditional dracut debugging in mkdumprd: The mkdumprd script will now pass the --debug flag to dracut if the debug variable is set, otherwise it will use --quiet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@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 enables xtrace to be propagated from kdumpctl to mkdumprd by checking if xtrace is enabled in kdumpctl and exporting a debug variable. This allows mkdumprd to enable its own tracing and pass a debug flag to dracut. The implementation is correct and achieves the intended goal. I have one suggestion to improve the readability of how the xtrace option is checked.

kdumpctl Outdated
Comment on lines 3 to 5
if [[ "$-" == *"x"* ]]; then
export debug=1
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

For better readability and explicitness, you could use shopt -q xtrace to check if the xtrace option is enabled. This is generally considered more readable than checking the special $- variable.

Suggested change
if [[ "$-" == *"x"* ]]; then
export debug=1
fi
if shopt -q xtrace; then
export debug=1
fi

Copy link
Member Author

Choose a reason for hiding this comment

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

shopt -q xtrace

bash: shopt: xtrace: invalid shell option name

Use `shopt -q -o xtrace" to resolve the above error,

-o     Restricts the values of optname to be those defined for the -o option to the set builtin

kdumpctl Outdated
Comment on lines 2 to 7

shopt -q -o xtrace && export debug=1

KEXEC=/sbin/kexec

KDUMP_KERNELVER=""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @coiby,

this won't fix #108 entirely. Especially it won't fix the problem with rd.debug in the initrd. For me this issue is a bug in the kdump-logger.sh not kdumpctl. So I'd also fix it in there. Simply moving the line to kdump-logger.sh or dlog_init should fix it for all users. What do you think?

Thanks
Philipp

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for pointing out this issue! I've moved this code to kdump-logger.sh with slight change since kdump-logger.sh is supposed to POSIX-compliant.

Comment on lines -35 to +42
dracut_args+=(--quiet)
if [[ -n $debug ]]; then
dracut_args+=(--debug)
else
dracut_args+=(--quiet)
fi
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @coiby,

I had an other look and while the change is fine I'm a little bit worried about both dracut and kdumpctl using debug as a variable. In particular the fact that when we export debug in kdumpctl dracut will overwrite 'our' variable. So I'm wondering if it makes sense to also call dracut in a sub-shell in addition to the change proposed. With that we wouldn't need to worry about changes in dracut causing trouble in the future. What do you think?

Thanks
Philipp

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for raising the concern! Although dracut won't overwrite our variable because we call it with --debug, it's better to avoid using this variable in our code. So I make mkdumprd and mkfadumprd accepts --debug argument to enable xtrace in new version.

@coiby coiby force-pushed the xtrace branch 3 times, most recently from 08d68ff to 5cde42d Compare December 1, 2025 10:22
coiby added 2 commits December 5, 2025 14:40
Resolves: rhkdump#108

Functions like dwarn in kdump-logger.sh disable xtrace temporarily and
only re-enable xtrace when debug is set. Automatically set debug
environment variable to resolve this issue.

Signed-off-by: Coiby Xu <coxu@redhat.com>
…s xtrace

Resolves: rhkdump#118

Since dracut commit 5042681("fix(dracut.sh): initialize variables that
get exported"), debug=1 won't enable xtrace in dracut. Let's call dracut
with --debug explicitly in mkdumprd and mkfadumprd.

Also enable xtrace in mkdumprd and mkfadumprd by passing --debug
argument when kdumpctl enables xtrace.

Signed-off-by: Coiby Xu <coxu@redhat.com>
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.

logger function like dinfo turn off xtrace unless environment variable debug set

2 participants