LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Bash semi-crash (http://www.linuxquestions.org/questions/linux-general-1/bash-semi-crash-4175416458/)

Andy Alkaline 07-13-2012 03:07 AM

Bash semi-crash
 
My nephew was aimlessly typing into his gnome-terminal (logged into his account on my computer) and accidentally caused my Mint desktop to almost freeze. I told him try it on my Debian Squeeze desktop feeling pretty confident I'd be able to break out of it. It started causing a slow down as my RAM was getting used up and swap partition getting full.

So I was able to prevent things from going to far, but wanted to replicate what he did so I'd know the exact cause.

Code:

echo I like applesauce!
Hit enter. Then held the "!" key down so it would fill up about three lines and then hit enter. Then press the up arrow, hit enter again. It seems to increase the command exponentially, so it only takes a few times of hitting the up arrow and hitting enter before your shell is inundated.

Had some slowdown afterward anytime I opened a new shell or logged out because my ~/.bash_history was 384 megabytes, apparently. On Mint, I couldn't even move the mouse until I was able to kill the process through ssh (took a minute to connect over the LAN, usually instantaneous).

This happened on
GNU bash, version 4.1.5(1)-release (i486-pc-linux-gnu)
GNU bash, version 4.2.20(1)-release (i486-pc-linux-gnu)

Anyway to build bash and configure it to limit the length of the command line?

Here's a sample:

Quote:

andy@dimensionE310:~ (0 jobs) $ echo I like applesauce!
I like applesauce!

andy@dimensionE310:~ (0 jobs) $ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!
I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!

andy@dimensionE310:~ (0 jobs) $ echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!
echo I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauce!
I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauceecho I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce!echo I like applesauce! I like applesauce!
andy@dimensionE310:~ (0 jobs) $

Didier Spaier 07-13-2012 03:52 AM

Quote:

Originally Posted by Andy Alkaline (Post 4726733)
Anyway to build bash and configure it to limit the length of the command line?

No AFAIK as it depend on the kernel, not bash. To know the actual value:
Code:

getconf ARG_MAX
To know more, see here.

So my advise would be to configure your keyboard in such a way as it doesn't repeat a key-press, or not too fast ;)

Valery Reznic 07-14-2012 02:44 AM

I think you are batter off limiting bash_history size and not command line size (yes, command line size limit belong to kernel)

See 'man bash' and scroll to HISTFILESIZE

Andy Alkaline 07-14-2012 11:44 PM

HISTFILESIZE is the best solution I've come across so far, thanks for confirming.

So I created /etc/profile.d/histfilesize.sh

Quote:

root@dimensionE310 (0 jobs):~# cat /etc/profile.d/histfilesize.sh
export HISTFILESIZE=0
And my nephew is a pretty good kid, so I don't think I'll have to worry about this issue further. :)


All times are GMT -5. The time now is 09:26 AM.