Package: bash
Version: 5.1-2+b3
Severity: normal

Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?

Some bash scripts failed.

Here is a script reproducing the bug:
-----
#!/bin/bash

if [ "$FIRST_LEVEL" != "no" ] ; then
    export FIRST_LEVEL=no
    for i in {1..100} ; do
        $BASH $0 $i || exit
    done
    exit
fi

s="§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§"
s="$s$s$s$s$s$s$s$s$s"
s="${s:0:256}"
prefix=1
for prefix in 1 ; do
    str="1$s"
    s1=$(echo "$str")
    s2=$str
    if [ "$s1" != "$s2" ] ; then
        echo $LANG $prefix $1
        echo ${s1:256} | od -t x1c
        echo ${s2:256} | od -t x1c
        exit 1
    fi
done
----
With LANG=en_US.utf8 it shows the bug.
With LANG=C it produces no error

   * What exactly did you do (or not do) that was effective (or
     ineffective)?
If i put LANG=C in the script it run as expected.

I have tried with upstream bash and found:
if I use --without-bash-malloc on configure I get the bug.
if I do not use --without-bash-malloc on configure the bug disappears.

My gcc: gcc (Debian 10.2.1-6) 10.2.1 20210110

My libc6: Version: 2.31-13

The bug do show at every run, that why I try 100 times in the script.

*** End of the template - remove these template lines ***


-- System Information:
Debian Release: 11.0
  APT prefers stable-security
  APT policy: (500, 'stable-security'), (500, 'proposed-updates'), (500,
'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.10.0-8-amd64 (SMP w/4 CPU threads)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages bash depends on:
ii  base-files   11.1
ii  debianutils  4.11.2
ii  libc6        2.31-13
ii  libtinfo6    6.2+20201114-2

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

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

Reply via email to