-
-
Notifications
You must be signed in to change notification settings - Fork 191
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
Improve DEBUG and DO_WITH_DEBUG output handling to also keep output of DO_WITH_DEBUG commands #1642
Improve DEBUG and DO_WITH_DEBUG output handling to also keep output of DO_WITH_DEBUG commands #1642
Conversation
…f kexec -l when BOARD is in DEBUG+TRACE mode (configuration settings menu + flash) Signed-off-by: Thierry Laurion <[email protected]>
Without debug on qemu-coreboot-whiptail-tpm2-hotp
No observed regression and really big step forward to have useful user generated bug reports. :) |
Thanks for splitting this up, taking a look 👀 |
DO_WITH_DEBUG traces command exit status (if failed), stdout/stderr (if not empty), and PATH (if command was not found). The caller still observes the exit status, and stdout/stderr still go to the caller as well. This way, DO_WITH_DEBUG can be inserted anywhere with minimal spam in the logs and without affecting the script. Signed-off-by: Jonathon Hall <[email protected]>
@tlaurion Suggestion here: JonathonHall-Purism@015af7e TL;DR - DO_WITH_DEBUG can be inserted anywhere with no impact to the script (exit status / stdout / stderr all stay the same from the script's perspective) and with minimal spam (trace exit status only when nonzero, trace PATH only for exit status 127, trace output only when non-empty, etc.) This way you can add/remove a DO_WITH_DEBUG just about anywhere without risking subtle breakage due to stdout/stderr being consumed, splitting or not splitting a single argument, etc. I improved the documentation and examples in the comment too, so have a look over there 🙂 Specifically:
I didn't test Heads logic extensively yet (help appreciated!) but I did test DO_WITH_DEBUG itself. Silent success - traces command, nothing else:
Silent failure - traces command and exit status, caller still sees status:
stdout - caller still observes output, traced with label:
stderr - still printed normally, caller observes exit status
command does not exist - stderr still printed, PATH shown, caller observes status
Also ran all of the above with |
Oh and one more I just remembered - masking a parameter (showing it still executes with the unmasked value) and output that doesn't end in a line break:
|
"$1 err:" looked like an error, but often there's output on stderr that's diagnostic (like kexec -d). "$1 stderr:" is clearer. Signed-off-by: Jonathon Hall <[email protected]>
`eval "$kexeccmd"` should become `DO_WITH_DEBUG eval "$kexeccmd"` when adding DO_WITH_DEBUG, command invocation is still the same, still needs eval. Restore DO_WITH_DEBUG in front of kexec-parse-boot that had been removed. Signed-off-by: Jonathon Hall <[email protected]>
LOG() is added to log to the log only (not kmsg, more verbose than TRACE). DO_WITH_DEBUG only captures stdout/stderr to the log with LOG(). kexec-boot silences stderr from kexec, we don't want it on the console. No need to repeat the kexec command when asking in debug to continue boot, it's no longer hidden behind verbose output from kexec. Signed-off-by: Jonathon Hall <[email protected]>
Log the board and version when entering the recovery shell. Extract the firmware version logic from init. Currently this is the only way to get the debug log. If we add a way from the GUI, we may want to log the board and version somewhere else too. Signed-off-by: Jonathon Hall <[email protected]>
…what state is the USB Security dongle Signed-off-by: Thierry Laurion <[email protected]>
From out of band discussion:
|
Testing first prior of merging. |
8671bd5
to
fde8ee8
Compare
…ard configs. Next step is creating fbwhiptail/whiptail/tpm1/tpm2 mk files and include them in all boards Signed-off-by: Thierry Laurion <[email protected]>
fde8ee8
to
89a0c10
Compare
Ci builds, if failing, would be CI related. Merging. |
Outcome of this PR:
TODO:
mount-usb --mode rw
cp /tmp/debug.log /media
umount /media
SRC #1642 (comment):
And then
Old
Goal here was to have
kexec -l
output to kmesg so also to console when BOARD is in DEBUG+TRACE mode (configuration settings menu + flash)@JonathonHall-Purism please review
A variation of this commit is under #1640 to troubleshoot #1641 more easily and permit users to provide /tmp/debug.log