compulab-yokneam / meta-compulab-bsp

CompuLab Yocto Meta Layer
4 stars 7 forks source link

imx8plus: The /etc/profile.d/resize.sh messes up Bash commands over SSH #8

Open mirzaCet opened 1 year ago

mirzaCet commented 1 year ago

Our build and deployment system execute Bash commands remotely over SSH on the imx8plus system. The resize command sets the terminal size for the current session, which includes the number of rows and columns that are displayed in the terminal window. The problem is that, perhaps, our commands can exceed the terminal size, so they wrap up in new line, and consequently break our pipeline / commands. In effect, some weird characters are printed out on standard output and the session breaks without further explanation. I haven't dug much deeper into it, but the problem is there, and the resize is the cause.

One solution would be to skip the resize for SSH sessions.

if [ -z "$SSH_CLIENT" ] && [ -z "$SSH_TTY" ]; then
    # We're not running over SSH connection, i.e. in a local terminal, so run the resize command
    shopt -s checkwinsize
    command -v resize &>/dev/null && resize
fi