Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 177755

Summary: bash-3.2_p15-r1: regular expression test broken
Product: Gentoo Linux Reporter: Evert <evert.gentoo>
Component: Current packagesAssignee: Gentoo Linux bug wranglers <bug-wranglers>
Status: RESOLVED DUPLICATE    
Severity: major CC: martin
Priority: High    
Version: unspecified   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Evert 2007-05-09 08:36:45 UTC
After upgrading from bash-3.1_p17 to bash-3.2_p15-r1, the regular expression test seems to broken.


First:
$ echo $BASH_VERSION 
3.1.17(1)-release
$ $ [[ str =~ "str" ]] && echo match || echo nomatch
match
$ [[ str =~ "t" ]] && echo match || echo nomatch
match
$ [[ str =~ "^str" ]] && echo match || echo nomatch
match


Now:
$ echo $BASH_VERSION 
3.2.15(1)-release
$ [[ str =~ "str" ]] && echo match || echo nomatch
match
$ [[ str =~ "t" ]] && echo match || echo nomatch
match
$ [[ str =~ "^str" ]] && echo match || echo nomatch
nomatch

This breaks all bash scripts which make use of this ext regexp test feature.


Reproducible: Always

Steps to Reproduce:




# emerge --info
Portage 2.1.2.2 (default-linux/x86/2006.1, gcc-4.1.1, glibc-2.3.6-r4, 2.6.20.4 i686)
=================================================================
System uname: 2.6.20.4 i686 Intel(R) Pentium(R) 4 CPU 2.80GHz
Gentoo Base System release 1.12.9
Timestamp of tree: Wed, 09 May 2007 05:30:10 +0000
dev-java/java-config: 1.3.7, 2.0.31-r5
dev-lang/python:     2.4.4
dev-python/pycrypto: 2.0.1-r5
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.16.1-r3
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.17-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -mtune=i686 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/java-config/vms/ /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-O2 -mtune=i686 -pipe"
DISTDIR="/data/linux/gentoo/distfiles"
FEATURES="distlocks metadata-transfer sandbox sfperms strict"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LANG="C"
LINGUAS="en en_US en_GB nl de"
MAKEOPTS="-j2"
PKGDIR="/data/linux/gentoo/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/compile"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac alsa apache2 apm berkdb bitmap-fonts cli cracklib crypt cups dri dvd dvdr dvdread encode esd fortran gdbm gif gnome gpm gstreamer gtk iconv imlib ipv6 isdnlog java jpeg ldap libg++ mad midi mikmod mmx mng mozilla mp3 mpeg mplayer ncurses nls nptl nptlonly nsplugin ogg opengl oss pam pcre pdf perl png ppds pppd python qt qt3 qt4 quicktime readline reflection samba sdl session spell spl sse ssl svg tcpd tiff truetype truetype-fonts type1-fonts unicode v4l v4l2 vcd vorbis wmf x86 xml xorg xv zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en en_US en_GB nl de" USERLAND="GNU" VIDEO_CARDS="vesa fbdev i810"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Martin Väth 2007-05-09 09:32:55 UTC
AFAIK this is intended behavior in bash 3.2 for quoted arguments: It matches for strings.

$ [[ ^str =~ \^str ]] && [[ ! str =~ \^str ]] && [[ ^str =~ "^str" ]] && [[ ! str =~ "^str" ]] && [[ str =~ ^str ]] && echo all as expected
all as expected
Comment 2 Jakub Moc (RETIRED) gentoo-dev 2007-05-09 10:43:16 UTC

*** This bug has been marked as a duplicate of bug 163527 ***