Do not try to continue reading shell commands if input source is closed#10105
Do not try to continue reading shell commands if input source is closed#10105x3ro merged 1 commit intoRIOT-OS:masterfrom
Conversation
4622f85 to
f3e781f
Compare
|
@mroethke would you like to give this PR a try? |
|
I can confirm that this fixes my issue. |
|
@PeterKietzmann would you be in for a quick review? ^_^ |
|
ACK from my side. I've added related labels. Out of my head I don't know if there is any other/better solution to shut down. Actually I never really looked into the shell implementation. I'd say let's keep this open for 1-2 days and if no one complains, I'm gonna merge then. |
miri64
left a comment
There was a problem hiding this comment.
I'm also fine with this change. In theory any terminal around should catch an EOF (tested with pyterm and serial_aggregator), so this is only relevant for raw native where there is no terminal program around the input. There it works as expected when hitting Ctrl+D
|
so, can we merge this one? ;) |
|
If someone gives a proper ACK, I guess. Still like to have the opinion of someone more knowledgeable with the inner workings of the shell though. @kaspar030 @OlegHahm? |
|
Please no! Why does the shell turn off the node? That's not good at all, if only for the added dependency. |
|
The shell loop should probably exit on reading EOF. |
Now that you say it, this makes more sense to me indeed. |
|
@kaspar030 How would you cause this on a real node (i.e. not native)? Note that it is not turned off when a node receives an EOF, but when |
The problem is not that it can't (or may not) be caused on a real node, the problem is that the current proposal is pulling in a dependency ( |
|
So should we modify |
No, that's an additional functionality. The terminal emulator should pass though EOF. That's why they have escape keys. The extra "magic" added by the terminal script already gave some headaches when trying non-shell code that communicated via UART, so I'd say it is good if EOFs are handled by RIOT in actual hardware too. @x3ro |
|
@x3ro any movement towards 2018.10 Release? |
|
Ah I didn't realize this was marked for the release. I'll take another look at it tomorrow. |
|
@miri64 @kaspar030 @jcarrano Does this look better? |
tests/shell/main.c
Outdated
| shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE); | ||
| */ | ||
|
|
||
| pm_off(); |
There was a problem hiding this comment.
IMO this is change should get its own PR.
sys/include/shell.h
Outdated
| @@ -72,7 +72,7 @@ typedef struct shell_command_t { | |||
| * | |||
| * @returns This function does not return. | |||
There was a problem hiding this comment.
this message needs updating
|
@x3ro I'm OK with the proposed change in the shell. Could you address @kaspar030 comments? This bugfix is listed in the Release 2018.10, so would be very nice to have it :) |
|
ping @x3ro |
|
@jia200x want to give it another look? |
|
@kaspar030 comments were addressed. Re-tested with current master and with this PR, and works as expected. |
In RIOT native, sending CTRL+D to a shell started using shell_run would resulted in and endless prompt loop. I've been unable to trigger such a behaviour on actual hardware using a UART connection, but calling `pm_off` seemed like a better alternative than having an `#ifdef BOARD_NATIVE`. Fixes #9946
7da6d09 to
62cecc9
Compare
|
I just saw this one in master, and the commit message is not prepended by the module/file and the commit message does not match the implemented fix. |
|
It was also an API change in theory so would have waited for another ack I think. |
I wrongly ACK'd. Sorry. |
|
@cladmi Apologies for missing the commit message, I was under the impression that Murdock checks this, so I didn't pay much attention after squashing.
Nobody had any issues with the API change so far, and the issue has been open for a month. The changes today were purely removing things that reviewers did not feel like it belonged in the PR. From the API change side, it feels fairly well reviewed IMO. |
|
@x3ro to prevent forgetting to update messages, I tend to do my fix with For the API change, the thing is that it should normally have 2 maintainers ACKs, and should not be backported after the feature-freeze. Even more when this is for a native specific native ease of life improvement. |
Contribution description
In RIOT native, sending CTRL+D to a shell started using shell_run would resulted in and
endless prompt loop. I've been unable to trigger such a behaviour
on actual hardware using a UART connection, but calling
pm_offseemedlike a better alternative than having an
#ifdef BOARD_NATIVE.Testing procedure
task01for native.EOF)Expected:
The shell exits cleanly.
Actual:
An infinite loop of prompt characters is triggered
Issues/PRs references
Fixes #9946