Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14213

Re: Sequence Brace Expansion Crash

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: Sequence Brace Expansion Crash
Date 2018-06-03 14:48 -0400
Organization ITS, Case Western Reserve University
Message-ID <mailman.1072.1528051706.1292.bug-bash@gnu.org> (permalink)
References <CAGbX=_V_2OvOA-5DJ6iPCvCoZy9W8j1Y4K+LnCT=Cfh=v9H3eQ@mail.gmail.com>

Show all headers | View raw


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/

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: Sequence Brace Expansion Crash Chet Ramey <chet.ramey@case.edu> - 2018-06-03 14:48 -0400

csiph-web