-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
shell: fix unsafe API calls and add configurable autoflush behavior #84290
shell: fix unsafe API calls and add configurable autoflush behavior #84290
Conversation
c6785c0
to
ac27480
Compare
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.
Can you split this into 2 commits?
- addition of
CONFIG_SHELL_PRINTF_AUTOFLUSH
- Changing the timeout
c223c7b
to
f1488c3
Compare
@pdgendt done |
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.
commit message should not include github references https://docs.zephyrproject.org/latest/contribute/guidelines.html#adding-links
Introduced a new Kconfig option `SHELL_PRINTF_AUTOFLUSH` to allow configuring the autoflush behavior of shell printing functions. Updated `Z_SHELL_FPRINTF_DEFINE` to use the `CONFIG_SHELL_PRINTF_AUTOFLUSH` setting instead of hardcoding the autoflush behavior to `true`. Signed-off-by: Jakub Rzeszutko <[email protected]>
Fixes an issue where the shell API could block indefinitely when called from threads other than the shell's processing thread, especially when the transport (e.g. USB CDC ACM) was unavailable or inactive. Replaced `k_mutex_lock` calls with an indefinite timeout (`K_FOREVER`) by using a fixed timeout (`K_MSEC(SHELL_TX_MTX_TIMEOUT_MS)`) in shell API functions to prevent indefinite blocking. Link: zephyrproject-rtos#84274 Signed-off-by: Jakub Rzeszutko <[email protected]>
f1488c3
to
04fa35e
Compare
@kartben Fixed, I missed that new rule |
Fixes an issue where the shell API could block indefinitely when called from threads other than the shell's processing thread, especially when the transport (e.g. USB CDC ACM) was unavailable or inactive.
Changes made:
k_mutex_lock
calls with an indefinite timeout (K_FOREVER
) by using a fixed timeout (K_MSEC(SHELL_TX_MTX_TIMEOUT_MS)
) in shell API functions to prevent indefinite blocking.SHELL_PRINTF_AUTOFLUSH
to allow configurable autoflush behavior for shell printing functions.Z_SHELL_FPRINTF_DEFINE
to use theCONFIG_SHELL_PRINTF_AUTOFLUSH
setting instead of hardcoding the autoflush behavior totrue
.Links: #84274