bug-bash
[Top][All Lists]
Advanced

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

Re: coredump from C-c-ed function


From: Chet Ramey
Subject: Re: coredump from C-c-ed function
Date: Tue, 23 Jan 2018 08:54:10 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.5.2

On 1/23/18 3:30 AM, xftroxgpx wrote:

> Bash Version: 4.4
> Patch Level: 12
> Release Status: release
> 
> Description:
> bash coredumps by interrupting a called a function via C-c
> 
> Repeat-By:
> 1. get interactive bash shell
> 2. paste this function definition at command prompt
> function dv3() {
>   local ec=1
>   time while test "$ec" -ne "0"; do
>     sleep 1
>     ls /$RANDOM
>     ec="$?"
>   done
> }
> 3. now call it: $ dv3
> 4. C-c at any point

$ ./bash
$ echo $BASH_VERSION
4.4.12(2)-release
$ function dv3() {
>   local ec=1
>   time while test "$ec" -ne "0"; do
>     sleep 1
>     ls /$RANDOM
>     ec="$?"
>   done
> }
$ type dv3
dv3 is a function
dv3 ()
{
    local ec=1;
    time while test "$ec" -ne "0"; do
        sleep 1;
        /bin/ls -F /$RANDOM;
        ec="$?";
    done
}
$ dv3
/bin/ls: cannot access /10692: No such file or directory
/bin/ls: cannot access /8614: No such file or directory
/bin/ls: cannot access /22963: No such file or directory
^C

real    0m3.189s
user    0m0.002s
sys     0m0.008s
$

(I have an alias for ls.)
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

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