bug-bash
[Top][All Lists]
Advanced

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

Re: bash-5.0: case command bug


From: Drab Martin
Subject: Re: bash-5.0: case command bug
Date: Fri, 18 Jan 2019 19:46:43 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

On 1/18/19 1:44 PM, Chet Ramey wrote:
On 1/17/19 6:21 PM, Drab Martin wrote:
Hi,

I have a problem with bash 5.0:

-----
machine1 ~ # bash --version
GNU bash, version 5.0.0(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

machine1 ~ # case "a-b" in *-*-*) echo "This is a BUG" ;; *) echo "This is
not a BUG" ;; esac
This is a BUG

I tried this on Gentoo.

address@hidden ~/build/bash-5.0 $ cat x1
case "a-b" in *-*-*) echo "This is a BUG" ;; *) echo "This is not a BUG" ;;
esac
address@hidden ~/build/bash-5.0 $ ./bash ./x1
This is not a BUG
address@hidden ~/build/bash-5.0 $ uname -a
Linux ip-172-31-8-83.ec2.internal 4.9.76-gentoo-r1 #1 SMP Mon Mar 5
06:42:49 UTC 2018 x86_64 Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz
GenuineIntel GNU/Linux
address@hidden ~/build/bash-5.0 $ ./bash --version
GNU bash, version 5.0.0(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
address@hidden ~/build/bash-5.0 $ ./bash
bash-5.0$ case "a-b" in *-*-*) echo "This is a BUG" ;; *) echo "This is not
a BUG" ;; esac
This is not a BUG
bash-5.0$ exit
exit

So you installed bash-5.0 as /bin/bash? And kept the /bin/sh symlink?
And still got these results?

address@hidden ~/build/bash-5.0 $ sed 2q
/usr/share/gnuconfig/config.sub
#! /bin/sh
# Configuration validation subroutine script.
address@hidden ~/build/bash-5.0 $ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Mar  1  2018 /bin/sh -> bash

Because when I run bash-5.0 against that configure script, I get:

address@hidden ~/build/bash-5.0 $ ./bash
/usr/share/gnuconfig/config.sub x86_64-pc-linux-gnu
x86_64-pc-linux-gnu


Hi Chet,

well, this is odd, because I tried again (manually patched the config.sub, so that it worked even if the bug is there) and tried re-compiling bash-5.0 the standard way in Gentoo and the bug is still there.

--------
machine1 ~ # emerge -av1 bash
...
Calculating dependencies       ... done!
[ebuild R ] app-shells/bash-5.0::gentoo USE="net nls plugins (readline) -afs -bashlogger -examples -mem-scramble" 0 KiB

...
machine1 ~ # uname -a
Linux xenomorph 4.19.9-gentoo #1 SMP PREEMPT Sun Dec 16 00:43:14 CET 2018 x86_64 Intel(R) Core(TM) i7-3820QM CPU @ 2.70GHz GenuineIntel GNU/Linux

machine1 ~ # ls -l /bin/bash
-rwxr-xr-x 1 root root 1364664 Jan 18 19:20 /bin/bash
machine1 ~ # ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Jan 18 19:20 /bin/sh -> bash
machine1 ~ # /bin/bash --version
GNU bash, version 5.0.0(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
machine1 ~ # /bin/bash -c 'case "a-b" in *-*-*) echo "This is a BUG" ;; *) echo 
"This is not a BUG" ;; esac'
This is a BUG
machine1 ~ # /usr/share/gnuconfig/config.sub.orig x86_64-pc-linux-gnu
Invalid configuration `x86_64-pc-linux-gnu': machine `x86_64-pc' not recognized
--------

The config.sub.orig is the renamed original, which I had to temporarily replace 
with the patched variant.

--------
machine1 ~ # diff -Nau /usr/share/gnuconfig/config.sub.orig 
/usr/share/gnuconfig/config.sub
--- /usr/share/gnuconfig/config.sub.orig        2019-01-18 04:42:40.962952315 
+0100
+++ /usr/share/gnuconfig/config.sub     2019-01-18 19:17:18.879097624 +0100
@@ -361,10 +361,10 @@
          basic_machine=$basic_machine-pc
          ;;
        # Object if more than one company name word.
-       *-*-*)
-               echo Invalid configuration \`$1\': machine \`$basic_machine\' not 
recognized 1>&2
-               exit 1
-               ;;
+#      *-*-*)
+#              echo Invalid configuration \`$1\': machine \`$basic_machine\' not 
recognized 1>&2
+#              exit 1
+#              ;;
        # Recognize the basic CPU types with company name.
        580-* \
        | a29k-* \
--------

Could it perhaps be a problem of some library, bash is using to work with the text or something? Or a problem of miscompiling GCC perhaps?

--------
machine1 ~ # gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/8.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-8.2.0-r6/work/gcc-8.2.0/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/8.2.0 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.2.0 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.2.0/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.2.0/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include/g++-v8 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/8.2.0/python --enable-objc-gc --enable-languages=c,c++,objc,obj-c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 8.2.0-r6 p1.7' --disable-esp --enable-libstdcxx-time --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-altivec --disable-fixed-point --enable-targets=all --enable-libgomp --disable-libmudflap --disable-libssp --disable-libmpx --enable-systemtap --enable-vtable-verify --enable-libvtv --enable-lto --with-isl --disable-isl-version-check --enable-libsanitizer --enable-default-pie --enable-default-ssp
Thread model: posix
gcc version 8.2.0 (Gentoo 8.2.0-r6 p1.7)
machine1 ~ # grep "^CFLAGS=" /etc/make.conf
CFLAGS="-O3 -march=native -minline-all-stringops -funroll-all-loops -fsched-pressure -fsched-spec-load -fipa-pta -fvariable-expansion-in-unroller -ftree-vectorize -ftree-loop-distribution -ftree-loop-if-convert-stores -pipe"
--------

Allright, I got it. It is a problem of faulty GCC 8.2 compiler. Just recompiled bash-5.0 with CFLAGS="-O2 -march=native -pipe" and it works fine, now. Sorry to bother you with this. Will try to report bug to the GCC, when I have a bit more time. Thanks anyway.

Best regards,
Martin



reply via email to

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