Rahix / tbot

Automation/Testing tool for Embedded Linux Development
https://tbot.tools
GNU General Public License v3.0
84 stars 21 forks source link

linux.util: Fix wait_for_shell hang #82

Closed surajkrishnan14 closed 6 months ago

surajkrishnan14 commented 1 year ago

This change modifies tbot's wait_for_shell() to evaluate simple math instead of the existing echo TBOT''LOGIN. If a portion of the previously used echo command is dropped (including one single quote character but not both), then the shell interprets the command to be a multiline command. All subsequent retries of the echo command are then interpreted as part of the command, instead of new commands, and this loop essentially continues forever.

Using expr 41 + 1 and expecting 42 achieves the same objective of determining if the shell is ready but is protected against dropped characters resulting in an infinite loop.

Rahix commented 6 months ago

Due to silence here I've instead implemented my suggestion from above in hopes that this increases robustness of tbot a bit. See commit 6c0b22083596 ("machine: linux: Make wait_for_shell() more robust") and thanks for your contribution anyway :)