-
Notifications
You must be signed in to change notification settings - Fork 21
Enable complete xtrace in kdumpctl and mkdumprd #126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @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 Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this 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
| if [[ "$-" == *"x"* ]]; then | ||
| export debug=1 | ||
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| if [[ "$-" == *"x"* ]]; then | |
| export debug=1 | |
| fi | |
| if shopt -q xtrace; then | |
| export debug=1 | |
| fi |
There was a problem hiding this comment.
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
|
|
||
| shopt -q -o xtrace && export debug=1 | ||
|
|
||
| KEXEC=/sbin/kexec | ||
|
|
||
| KDUMP_KERNELVER="" |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
| dracut_args+=(--quiet) | ||
| if [[ -n $debug ]]; then | ||
| dracut_args+=(--debug) | ||
| else | ||
| dracut_args+=(--quiet) | ||
| fi |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
08d68ff to
5cde42d
Compare
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>
This PR resolves #108 and #118 to enable complete xtrace in kdumpctl and mkdumprd.