bash evaluation change...
Nathanael D. Noblet
nathanael at gnat.ca
Thu Mar 3 18:05:44 UTC 2011
On 03/03/2011 10:18 AM, Nathanael D. Noblet wrote:
> On 03/02/2011 11:55 PM, Toshio Kuratomi wrote:
>
>> I'd say, report this as a bug and see where it leads. It's certainly not
>> expected behaviour even if it is intentional.
>
>
> https://bugzilla.redhat.com/show_bug.cgi?id=681940
>
>
> as well I submitted to bash upstream with bashbug which submits to a
> mailling list of all things...
I can't submit using the bashbug-32 from mock... here's what I was
*trying* to submit if anyone feels like submitting to bash upstream for
me? I will also put this in the bug incase the bash maintainer has an
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
More information about the devel
mailing list