Description of problem: Between bash 4.1.x and 4.2.0 the way bash handles case evaluations has changed. Version-Release number of selected component (if applicable): 4.2.0 How reproducible: Always Steps to Reproduce: 1. using the following script: case x"" in x) echo 'expected' ;; x??) echo 'this would be really odd' ;; x?) echo 'does this prove anything?' echo x""x ;; *) echo 'no match' ;; esac 2. call the script 3. Actual results: => does this prove anything? xx Expected results: => 'expected' Additional info:
bashbug-32 is unable to send this from mock I've tried manually sending it via bashbug etc... nothing seems to work. Perhaps as maintainer you have upstream contact? Subject: change in case evaluation handling Configuration Information [Automatically generated, do not change]: Machine: i386 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-redhat-linux-gnu' -DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -DDEBUG -DMALLOC_DEBUG -I. -I. -I./include -I./lib -D_GNU_SOURCE -DRECYCLES_PIDS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables uname output: Linux iridium.gnat.ca 2.6.35.11-83.fc14.x86_64 #1 SMP Mon Feb 7 07:06:44 UTC 2011 i686 i686 i386 GNU/Linux Machine Type: i386-redhat-linux-gnu Bash Version: 4.2 Patch Level: 0 Release Status: rc2 Description: The following script illustrates a regression in handline case evaluations case x"" in x) echo 'expected' ;; x??) echo 'this would be really odd' ;; x?) echo 'does this prove anything?' echo x""x ;; *) echo 'no match' ;; esac as output you get: => does this prove anything xx In bash 4.1.X you would get as output 'expected'. The issue was found by configure failing with lines like case x"$enable_feature" in where enable_feature hadn't been passed to configure so the variable was undefined. I should note that handling if [ x"$some_undefined_var" = x ]; continues to function the same way as previous versions Repeat-By: using the following script (named test_script for me): ====================================== #!/bin/sh case x"$mytest" in xyes) echo "yes" ;; xno) echo "no" ;; x) echo "empty" ;; *) echo "not supported" ;; esac mytest=$1 case x"$mytest" in xyes) echo "yes" ;; xno) echo "no" ;; x) echo "empty" ;; *) echo "not supported" ;; esac exit; ========================================= and call it with sh test_script yes sh test_script no sh test_script whatever sh test_script 4.1.X has the following output: - sh test_script yes empty yes - sh test_script no empty no - sh test_script whatever empty not supported - sh test_script empty empty 4.2.0 has the following output: - sh test_script yes not supported yes - sh test_script no not supported no - sh test_script whatever not supported not supported - sh test_script not supported not supported
Thanks for the report. Reported upstream.
Sooner or later it will be visible at http://lists.gnu.org/archive/html/bug-bash/2011-03/threads.html
thanks - I'll keep tabs on that.
Created attachment 482143 [details] Patch from upstream Can you please try this patch? It comes from upstream.
Created attachment 482160 [details] How bash was built Just the git diff of current bash git head to my checkout and changes.
Worse... Using http://fpaste.org/C018/ mock-chroot> sh test yes empty empty mock-chroot> sh test empty empty mock-chroot> sh test no empty empty mock-chroot> sh test whatever empty empty Vs F14: > sh test yes empty yes > sh test empty empty > sh test no empty no > sh test whatever empty not supported
Also you can see my bash package used for testing at http://iridium.gnat.ca/~gnat/smock/yum/fedora-15/i386
I get the same results in F14 and rawhide bash (with the patch). The site http://iridium.gnat.ca/~gnat/smock/yum/fedora-15/i386 is not accessible for me.
(In reply to comment #5) > Created attachment 482143 [details] > Patch from upstream > > Can you please try this patch? It comes from upstream. This patch seems to work for me (patch applied against bash-4.2.6-1.fc15 src.rpm)
bash-4.2.7-1.fc15 has been submitted as an update for Fedora 15. https://admin.fedoraproject.org/updates/bash-4.2.7-1.fc15
bash-4.2.7-1.fc15 has been pushed to the Fedora 15 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with su -c 'yum --enablerepo=updates-testing update bash'. You can provide feedback for this update here: https://admin.fedoraproject.org/updates/bash-4.2.7-1.fc15
bash-4.2.7-1.fc15 has been pushed to the Fedora 15 stable repository. If problems still persist, please make note of it in this bug report.