bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Extglob *?(a)b matches every string


From: Mark Polyakov
Subject: Extglob *?(a)b matches every string
Date: Sat, 11 Aug 2018 21:26:56 -0700

   Configuration Information [Automatically generated, do not change]:
   Machine: x86_64
   OS: linux-gnu
   Compiler: gcc
   Compilation CFLAGS:A  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
   -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu'
   -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
   -DSHELL -DHAVE_CONFIG_HA A  -I.A  -I../. -I.././include -I.././libA
   -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4
   -Wformat -Werror=format-security -Wall
   uname output: Linux hullabaloo 2.6.32-042stab127.2 #1 SMP Thu Jan 4
   16:41:44 MSK 2018 x86_64 x86_64 x86_64 GNU/Linux
   Machine Type: x86_64-pc-linux-gnu
   A
   Bash Version: 4.3
   Patch Level: 46
   Release Status: release
   A
   Description:
   A A A  An extglob pattern such as `*?(anything)something_else` will
   match any string, even though it should only match strings that end
   with something_else. I suspect there are a number of other extglob
   patterns involving ?() that are buggy but have not tested extensively.
   This *only* happens on 4.3. I have also tested 4.0, 4.2, and 4.4, all
   of which parse the glob correctly.
   A
   Repeat-By:
   A A A  Run `shopt -s extglob`, followed by `[[ 'hello' == *?(l)x ]] &&
   echo 'yes'`. This should not echo anything, but in fact does echo
   "yes". The bug is reproducible anywhere extglobs are used, for example:
   echo *?(foo)bar echoes everything in PWD
   meow=hello; echo ${meow##*?(bloop)blap} will echo an empty string
   because the pattern erroneously matches the whole string, removing it
   in its entirety.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]