Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #11820

Comparison problem with case modification expansion in bash-4.3

Path csiph.com!au2pb.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.glorb.com!usenet.stanford.edu!not-for-mail
From Corentin Peuvrel <cpeuvrel@pom-monitoring.com>
Newsgroups gnu.bash.bug
Subject Comparison problem with case modification expansion in bash-4.3
Date Tue, 3 Nov 2015 15:03:56 +0100
Lines 27
Approved bug-bash@gnu.org
Message-ID <mailman.1560.1446559468.7904.bug-bash@gnu.org> (permalink)
References <55DC9992.8070209@pom-monitoring.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
X-Trace usenet.stanford.edu 1446559469 29957 208.118.235.17 (3 Nov 2015 14:04:29 GMT)
X-Complaints-To action@cs.stanford.edu
Cc Julien Thomas <jthomas@pom-monitoring.com>
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
X-Virus-Scanned amavisd-new at exosec.local
X-Enigmail-Draft-Status N1110
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0
In-Reply-To <55DC9992.8070209@pom-monitoring.com>
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic]
X-Received-From 91.90.99.101
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.14
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:11820

Show key headers only | View raw


Hi,

I think I found a bug in bash-4.3 (4.3.42 in fedora 21), that seems to exists for a long time (at least from 4.1.2 in Centos 6).

I found a fairly simple way to reproduce it : you have to initialize a variable to an empty string, and do a comparaison to it while doing the case modification expansion ${var,,}

This doesn't work :
# foo="" ; [[ bar == *"${foo,,}"* ]] && echo ok

While this works fine :
# foo="" ; [[ bar == *"${foo}"* ]] && echo ok
ok

If you unset the variable, it works as we want :
# unset foo ; [[ bar == *"${foo,,}"* ]] && echo ok
ok

If the variable is not empty, it also works normally :
# foo="A" ; [[ bar == *"${foo,,}"* ]] && echo ok
ok

I hope it's not already known, but I couldn't find anything on the net.

Thank you,

Corentin Peuvrel

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Comparison problem with case modification expansion in bash-4.3 Corentin Peuvrel <cpeuvrel@pom-monitoring.com> - 2015-11-03 15:03 +0100

csiph-web