bug-bash
[Top][All Lists]
Advanced

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

Re: Sequence Brace Expansion Crash


From: Chet Ramey
Subject: Re: Sequence Brace Expansion Crash
Date: Sun, 3 Jun 2018 14:48:15 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

On 6/3/18 12:18 AM, Thomas Fischer wrote:

> Bash Version: 4.4
> Patch Level: 19
> Release Status: release
> 
> Description:
> I was testing brace expansion, and found that if bash uses too much memory
> during the expansion, it will simply be killed.
> 
> Repeat-By:
> echo {a..z}{a..z}{a..z}{a..z}{a..z}{a..z}
> 
> Amusingly, this is the only command I've used that has actually caused a
> swap.
> 
> 
> Fix:
> There should probably be a check somewhere, so that when too much memory is
> used, an error is thrown rather than crashing. 

Once you've allocated as much memory as your data size resource limit says
you can, there's not much use in continuing.


> Or computing the
> permutations of the expansion and exiting before the calculation might work.

It's not very useful or efficient to do this for every brace expansion
because someone might run one that's nonsensical.

-- 
``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]