[colug-432] my shell is better^H^H^H^H^H^Hdifferent than yours: NSFW (but not for the reason you might think)

Eric Floehr eric at intellovations.com
Tue Dec 6 10:45:42 EST 2011

On a 1GB Fedora 16 XFCE instance I had lying around (kernel

$ time bash -c "read line < /dev/zero"
bash: xrealloc: cannot allocate 1023406192 bytes (24576 bytes allocated)

real    0m24.726s
user    0m7.219s
sys    0m12.226s

A 768MB OpenSUSE 12.1 PR5 stock install:

> time bash -c "read line < /dev/zero"
bash: xrealloc: cannot allocate 1570377840 bytes (40960 bytes allocated)

real    0m30.079s
user    0m9.693s
sys    0m10.197s

And finally a 512MB LMDE XFCE stock install:

$ time bash -c "read line < /dev/zero"
bash: xrealloc: ../../bash/builtins/../../bash/builtins/read.def:525:
cannot allocate 536871024 bytes (1073770496 bytes allocated)

real    0m20.388s
user    0m4.284s
sys    0m8.017s

Since I was feeling completely adventurous, I proceeded to shell into my
256MB Synology NAS which is running kernel:

> time bash -c "read line < /dev/zero"
bash: xrealloc: ./read.def:444: cannot reallocate 268435568 bytes (0 bytes
Command exited with non-zero status 2
real    0m 36.27s
user    0m 23.74s
sys     0m 3.28s

So appears to work on a modern Linux distro all the way down to 256MB.


On Tue, Dec 6, 2011 at 10:22 AM, Judd Montgomery <judd at jpilot.org> wrote:

> On Tue, Dec 06, 2011 at 08:39:40AM -0500, Jeff Frontz wrote:
> > On the AST (AT&T Software Technology) user's mailing list, Glen Fowler
> recently posted this snippet:
> >
> > > ... the seemingly good idea of "no limits" is not always a good idea
> > > proof of concept: try this with bash on a system that you can reboot
> with a physical button:
> > >
> > >        bash -c 'read line < /dev/zero'
> > >
> >
> > The context was why doesn't ksh let you read an arbitrarily long line of
> text with the built-in "read" command (and why that limitation is on
> purpose, but unfortunately undocumented).
> >
> >
> > Jeff
> >
> >
> I'll call the bluff and try it on a machine with 8 GB of RAM, 5 PDF
> files open, 20 or so terminals, 12 ssh sessions, lots of command
> histories, email, and browsers.
> $ time bash -c "read line < /dev/zero"
> bash: xrealloc: ../../bash/builtins/../../bash/builtins/read.def:525:
> cannot allocate 18446744071562068080 bytes (4295020544 bytes allocated)
> real    0m29.841s
> user    0m26.120s
> sys     0m3.720s
> What am I supposed to do with the power button?  Maybe it would crush
> a machine with less RAM, but I suspect the Linux kernel would kill the
> process on a low RAM machine (which is a gripe some have).  Anyone
> want to try?  I could in a VM.
> Does Glen have a problem with languages like C and assembly that give
> the programmer too much power?  Does he approve of Java because it
> prevents the programmer from doing "bad things?"
> Judd
> _______________________________________________
> colug-432 mailing list
> colug-432 at colug.net
> http://lists.colug.net/mailman/listinfo/colug-432
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.colug.net/pipermail/colug-432/attachments/20111206/5565d39f/attachment.html 

More information about the colug-432 mailing list