[Top][All Lists]

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

Re: BUG: echo call function

From: John McKown
Subject: Re: BUG: echo call function
Date: Wed, 4 Mar 2015 06:56:13 -0600

That is interesting. But it makes sense to me. And I would not
consider it a bug. BASH is doing what you told it to do. It is a
recursive call. But I do think that Chet would agree that crashing the
OS is a "bad thing" [grin]. I'm just not too sure what he could do
about it. If it were my system, I would look at the process limits set
on your user id. Each recursive invocation creates a new process.
Until the system "reacts poorly" (crashing is a type of acting
poorly), or you try to exceed your process limit. But if you don't
have a limit on the number of fork()'d processes, this latter resource
restriction would not stop the recursion. I have pasted a transcript
below which I hope helps a bit.

$uname -a
Linux my-home-system 3.18.3-201.fc21.x86_64 #1 SMP Mon Jan 19 15:59:31
UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 15204
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 4096
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
$ ulimit -u 5 #limit the number of fork()'d processes
$ function example() {
> echo $(example)
> }
$ example
bash: fork: retry: Resource temporarily unavailable
bash: fork: retry: Resource temporarily unavailable
^Cbash: fork: retry: Resource temporarily unavailable
^C^C^C^Cbash: fork: retry: Resource temporarily unavailable

bash: fork: Resource temporarily unavailable

I think this may be a "your bullet, your gun, your foot" type problem.

On Tue, Mar 3, 2015 at 9:17 PM, x Slack x Ruan <address@hidden> wrote:
> Good evening.
> My name is Ruan, was doing some scripting with bash, to launch a script my
> system crashed and restarted.
> When I look at the command syntax.
>     function example () {
>                            echo `example`
> }
> example
> The echo generates an infinite loop calling the function without stopping, I
> could see the top command.
> Thousands of bash were being opened, I would report this bug.
> One question, I tried to fix myself but I did not really bash the error
> files.
> In this case how it could contribute?
> Thank U

He's about as useful as a wax frying pan.

10 to the 12th power microphones = 1 Megaphone

Maranatha! <><
John McKown

reply via email to

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