Dear Maintainer,
* What led up to the situation?
A script that worked fine on Debian 11 caused terminal corruption on Debian 12.
* What exactly did you do (or not do) that was effective (or
ineffective)?
I was able to create a minimal test case to illustrate the problem.
* What was the outcome of this action?
The problem is that output loses carriage returns and echo is turned off for the terminal on script exit.
* What outcome did you expect instead?
I expected no terminal device corruption. stty sane does fix the terminal after the failure.
Here is a test case:
#!/bin/bash
for DIR in $(jot 5)
do { echo 1; sudo -u $USER -- echo test > /dev/null; echo 2; } | cat &
done
wait
Running this on my system outputs the '2' with line feeds and no carriage returns, and on exit, the terminal has echo turned off. stty sane fixes it.