From: Kevin Brown (kevin@frobozz.sccsi.com)
Date: 08/02/93


From: kevin@frobozz.sccsi.com (Kevin Brown)
Subject: Bug in bash 1.12 (was Re: Performance version of CNews)
Date: Tue, 3 Aug 1993 04:31:41 GMT

In article <1993Aug2.215256.1519@paperboy.ids.net> green@ids.net (Andy Green) writes:
>Howdy - does anyone know if there's a "ready to make" performance version
>of Cnews around that will compile and run under Linux? If so, I'd love to go
>out and grab the source :-)

I'm currently running C-news on my system with (so far) only one glitch, that
being in a shell script (doexplode). It's not the script's fault, it's the
fault of bash (which has a bug). This bug is probably well known to people
running C-news. It surprises me that it hasn't been fixed yet. Anyway, the
following little script causes bash to yield incorrect results:

    #! /bin/bash -x

    cd /tmp
    for f in directory/[0-9]*
    do
            case "$f" in
            "directory/[0-9]*")
    # if test "$f" = "directory/[0-9]*" ; then
                    echo "Not doing $f"
                    break
    # fi
            ;; # no work
            esac
            echo "Doing $f"
    done

If "directory" is empty, the script yields the following result:

    + cd /tmp
    + echo Doing directory/[0-9]*
    Doing directory/[0-9]*

whereas it *should* do:

    + cd /tmp
    + echo Not doing directory/[0-9]*
    Not doing directory/[0-9]*
    + break

    
If "directory" has things in it (say, 0, 1, and 2), the script yields the
following result:

    + cd /tmp
    + echo Not doing directory/0
    Not doing directory/0
    + break

but it *should* do:

    + cd /tmp
    + echo Doing directory/0
    Doing directory/0
    + echo Doing directory/1
    Doing directory/1
    + echo Doing directory/2
    Doing directory/2

Anyway, if you use "test" instead of the case statement, things work as you
would expect.

>Andy

-- 

Kevin Brown kevin@frobozz.sccsi.com nuchat.sccsi.com!frobozz!kevin