Re: memory leak in bash only during boot up in Bash-3.2.48

2018-12-22 Thread ABHISHEK PALIWAL
Hi Chet,

>What is the hard limit on the number of processes for a process started in
>this environment? (The value of `ulimit -n'.)

Here are the Hard and soft limits for open files and max user processes.
root@localhost:/root> ulimit -Hn
1024
root@localhost:/root> ulimit -Hu
516046
root@localhost:/root> ulimit -Su
1024
root@localhost:/root> ulimit -Sn
1024

Regards,
Abhishek

On Fri, Dec 21, 2018 at 10:20 PM Chet Ramey  wrote:

> On 12/19/18 12:54 AM, abhishpaliwal wrote:
> > create a shell script from below given code. name it testing.sh.
> >
> > #!/bin/bash
> >  logger "Started testing"
> >  while(true); do
> > while (true); do ls > /dev/null ; done
> >  done
> >
> > Steps.
> > # chmod 755 /root/testing.sh
> > modify any /etc/init.d/"service" file add "/root/testing.sh" inside the
> > start case.
> > "service" is any service file starting during start up.
> > Make sure above service is started during the startup.
>
> What is the hard limit on the number of processes for a process started in
> this environment? (The value of `ulimit -n'.)
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/
>


-- 




Regards
Abhishek Paliwal


Re: Error on arithmetic evaluation of `~0`.

2018-12-22 Thread Chet Ramey
On 12/19/18 10:31 PM, Bize Ma wrote:
> This is the third time I am reporting this issue.

Not really, but let's go on.

> 
> This fails:
> 
> var=(hello); echo "${var[~0]}"
> syntax error: operand expected ...

Yes. The comment in the code says:

"Right now, the code
 suppresses tilde expansion when expanding in a pure arithmetic
 context, but allows it when expanding an array subscript.  This is
 for backwards compatibility, but I figure nobody's relying on it"

I suppose backwards compatibility here is less important at this point.

> 
> While this works:
> 
> var=(hello); echo "${var[ ~0]}"
> hello

Because negative array subscripts count backwards from the end of the
array.

> It is also interesting that this fails:
> 
> var=hello; echo "${var[ ~0]}"
> bash: var: bad array subscript
> 
> Isn't `var[0]` valid and equivalent to `var` ?

Yes, but ~0 (-1) is not the same as 0.

> This was "supposed" to be resolved in a dev version,
> but is still present on bash 5.

The other arithmetic contexts you reported (the "pure" arithmetic contexts
the comment above references) were changed; this was left for backwards
compatibility. Like I said above, it looks like it's time to deemphasize
that.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



Re: Error on arithmetic evaluation of `~0`.

2018-12-22 Thread Chet Ramey
On 12/20/18 8:12 AM, Greg Wooledge wrote:

> The issue you're reporting appears to be present in arithmetic contexts
> in general, not only arrays:
> 
> wooledg:~$ echo $((~0))
> bash: /home/wooledg: syntax error: operand expected (error token is 
> "/home/wooledg")

This is what was fixed post-bash-4.4. I left the array subscript expansion
unchanged for backwards compatibility.

> It appears that bash is performing tilde expansion when there's no
> whitespace in front of the tilde, or bitwise negation if there is
> whitespace.

Because tilde expansion only happens on the first character of a string,
or following an unquoted `=' or `:'.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/