system/uorb: Select the printf extension the format strings need. - #3792
Merged
xiaoxiang781216 merged 1 commit intoSep 20, 2026
Merged
Conversation
Every topic's format string is printed through orb_info() or orb_fprintf(), and both reach the data through "%pB", which is a NuttX extension rather than a standard conversion. UORB_FORMAT turns that code on without turning the extension on, so a configuration that enables the listener but not the debug output builds cleanly, runs, and prints a pointer where the reading should be: sensor_voltage(now:4294968998000):0xc0203c98B The address is the va_format the extension was supposed to expand, and the trailing B is the conversion character being taken as ordinary text. Nothing warns, because to the compiler and to printf this is a valid format string that means something else. DEBUG_UORB already selects the extension, so the fault is invisible to anyone who turned that on. The two are independent options and only one of them declared what it needed. Move the select onto UORB_FORMAT, which is the option that decides whether the format strings are compiled in at all. Signed-off-by: Justin Hammond <justin@dynam.ac>
cederom
approved these changes
Sep 20, 2026
cederom
left a comment
Contributor
There was a problem hiding this comment.
Thank you @Fishwaldo :-)
cederom
requested review from
acassis,
linguini1,
michallenc,
raiden00pl,
simbit18 and
xiaoxiang781216
September 20, 2026 11:27
acassis
approved these changes
Sep 20, 2026
xiaoxiang781216
approved these changes
Sep 20, 2026
Contributor
|
Shouldn't we use "depends on"? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
UORB_FORMATcompiles in the per-topic format strings, which reach their data through%pB. That is a NuttX printf extension, not a standard conversion, andUORB_FORMATdoes not select it.A configuration that enables the listener but not the debug output therefore builds cleanly, runs, and prints the pointer instead of the reading:
The address is the
va_formatthe extension was meant to expand, and the trailingBis the conversion character being taken as ordinary text. Nothing warns, because to the compiler and to printf this is a valid format string that means something else.DEBUG_UORBalready selects the extension, so the fault is invisible to anyone who has that on. The two are independent options and only one of them declared what it needed. Move theselectontoUORB_FORMAT, the option that decides whether the format strings exist at all.Impact
One line of
system/uorb/Kconfig. Affects configurations withUORB_FORMAT=yandDEBUG_UORB=n, which gainLIBC_PRINT_EXTENSION. Configurations that already setDEBUG_UORBare unchanged, since it selects the extension today.Testing
Reproduced on an ESWIN EIC7700 EVB with
UORB_FORMAT=yandDEBUG_UORB=n:uorb_listenerprinted0xc0203c98Bfor every sample. With this change the same build prints the value: