Skip to content

Conversation

@jimparis
Copy link
Contributor

@jimparis jimparis commented Apr 5, 2019

A transport may receive multiple bytes of data between shell_thread wakeups, but state_collect is only called once per wakeup. So it must process all data, and only return when all data from the transport has been consumed. This is mostly handled correctly, but there were two places where state_collect would return early instead.

Since one of those places was after executing a command, this bug was easy to reproduce by pasting multiple lines of data at once. The actual behavior is messy depending on timing and whether the shell_uart RX buffer overflows -- basically it hangs without processing all input, then processes old input when new input comes in, etc.

With this I can now paste multiple line commands into the shell.

Fixes #15260

A transport may receive multiple bytes of data between shell_thread
wakeups, but state_collect is only called once per wakeup.  So it must
process all data, and only return when all data from the transport has
been consumed.  This is mostly handled correctly, but there were two
places where state_collect would return early instead.

Signed-off-by: Jim Paris <jim@jtan.com>
Copy link
Contributor

@jakub-uC jakub-uC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great finding! Thank you for this patch.

@jakub-uC jakub-uC requested a review from carlescufi April 6, 2019 15:12
@jakub-uC jakub-uC added the bug The issue is a bug, or the PR is fixing a bug label Apr 6, 2019
@jakub-uC jakub-uC added this to the v1.14.0 milestone Apr 6, 2019
@jakub-uC jakub-uC added the area: Shell Shell subsystem label Apr 6, 2019
@nashif
Copy link
Member

nashif commented Apr 8, 2019

@jimparis can you open a bug for this? This is needed right now to make it go into 1.14.

@jimparis
Copy link
Contributor Author

jimparis commented Apr 8, 2019

@jimparis can you open a bug for this? This is needed right now to make it go into 1.14.

Sure #15260

@jakub-uC jakub-uC added the priority: medium Medium impact/importance bug label Apr 8, 2019
@nashif nashif merged commit 38ecf5b into zephyrproject-rtos:master Apr 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Shell Shell subsystem bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants