Package: bash
Version: 5.2.15-2+b2
Severity: normal

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.

-- System Information:
Debian Release: 12.1
  APT prefers stable-debug
  APT policy: (500, 'stable-debug'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.1.0-10-amd64 (SMP w/48 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages bash depends on:
ii  base-files   12.4+deb12u1
ii  debianutils  5.7-0.4
ii  libc6        2.36-9+deb12u1
ii  libtinfo6    6.4-4

Versions of packages bash recommends:
ii  bash-completion  1:2.11-6

Versions of packages bash suggests:
pn  bash-doc  <none>

-- Configuration Files:
/etc/bash.bashrc changed:
[ -z "$PS1" ] && return
shopt -s checkwinsize
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi
if ! [ -n "${SUDO_USER}" -a -n "${SUDO_PS1}" ]; then
  PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
if [ -x /usr/lib/command-not-found -o -x 
/usr/share/command-not-found/command-not-found ]; then
        function command_not_found_handle {
                # check because c-n-f could've been removed in the meantime
                if [ -x /usr/lib/command-not-found ]; then
                   /usr/lib/command-not-found -- "$1"
                   return $?
                elif [ -x /usr/share/command-not-found/command-not-found ]; then
                   /usr/share/command-not-found/command-not-found -- "$1"
                   return $?
                else
                   printf "%s: command not found\n" "$1" >&2
                   return 127
                fi
        }
fi
shopt -s histappend


-- no debconf information

Reply via email to