sys/shell: handle correctly long strings that overflow buffer#11054
Closed
fedepell wants to merge 1 commit intoRIOT-OS:masterfrom
Closed
sys/shell: handle correctly long strings that overflow buffer#11054fedepell wants to merge 1 commit intoRIOT-OS:masterfrom
fedepell wants to merge 1 commit intoRIOT-OS:masterfrom
Conversation
Contributor
|
This is a duplicate of #10635, which has been sitting idly for over two months. |
Contributor
Author
|
Sorry didn't see the other PR. closing! |
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.
Contribution description
On very long input lines to the shell that are bigger than the shell buffer passed to the
shell_runfunction (usuallySHELL_DEFAULT_BUFSIZE) the shell process will exit.My expected behaviour is that it will just discard or ignore the very long string and keep running. This was the original behaviour indeed but #10105 changed it as the return code of
getcharforEOFis -1 which is the same value that was being used to signal a too long string. The solution is therefore trivially to use another error value for this case (I did a define for the sake of readability and possible future use).The PR also adds an automated test for this case.
Testing procedure
Execute a shell and send a very long string. In the old version shell will just exit, in the new chars will be discarded.
Or run the new version of automated tests under
tests/shell