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


Groups > gnu.bash.bug > #14469

Extglob *?(a)b matches every string

From Mark Polyakov <mark@markasoftware.com>
Newsgroups gnu.bash.bug
Subject Extglob *?(a)b matches every string
Date 2018-08-11 21:26 -0700
Message-ID <mailman.5030.1534063184.1292.bug-bash@gnu.org> (permalink)

Show all headers | View raw


   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.

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


Thread

Extglob *?(a)b matches every string Mark Polyakov <mark@markasoftware.com> - 2018-08-11 21:26 -0700

csiph-web