On a 1GB Fedora 16 XFCE instance I had lying around (kernel 3.1.0-0.rc6.git0.3.fc16.i686):<br><br>$ time bash -c "read line < /dev/zero"<br>bash: xrealloc: cannot allocate 1023406192 bytes (24576 bytes allocated)<br>
<br>real 0m24.726s<br>user 0m7.219s<br>sys 0m12.226s<br><br>A 768MB OpenSUSE 12.1 PR5 stock install:<br><br>> time bash -c "read line < /dev/zero"<br>bash: xrealloc: cannot allocate 1570377840 bytes (40960 bytes allocated)<br>
<br>real 0m30.079s<br>user 0m9.693s<br>sys 0m10.197s<br><br>And finally a 512MB LMDE XFCE stock install:<br><br>$ time bash -c "read line < /dev/zero"<br>
bash: xrealloc: ../../bash/builtins/../../bash/builtins/read.def:525: cannot allocate 536871024 bytes (1073770496 bytes allocated)<br>
<br>
real 0m20.388s<br>
user 0m4.284s<br>
sys 0m8.017s<br>
<br><br>Since I was feeling completely adventurous, I proceeded to shell into my 256MB Synology NAS which is running 2.6.32.12 kernel:<br><br><div>> time bash -c "read line < /dev/zero"</div><div>bash: xrealloc: ./read.def:444: cannot reallocate 268435568 bytes (0 bytes allocated)</div>
<div>Command exited with non-zero status 2</div><div>real 0m 36.27s</div><div>user 0m 23.74s</div><div>sys 0m 3.28s</div><div><br></div>
<br>So appears to work on a modern Linux distro all the way down to 256MB.<br><br>-Eric<br><br><br><div class="gmail_quote">On Tue, Dec 6, 2011 at 10:22 AM, Judd Montgomery <span dir="ltr"><<a href="mailto:judd@jpilot.org" target="_blank">judd@jpilot.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Tue, Dec 06, 2011 at 08:39:40AM -0500, Jeff Frontz wrote:<br>
> On the AST (AT&T Software Technology) user's mailing list, Glen Fowler recently posted this snippet:<br>
><br>
> > ... the seemingly good idea of "no limits" is not always a good idea<br>
> > proof of concept: try this with bash on a system that you can reboot with a physical button:<br>
> ><br>
> > bash -c 'read line < /dev/zero'<br>
> ><br>
><br>
> 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).<br>
><br>
><br>
> Jeff<br>
><br>
><br>
I'll call the bluff and try it on a machine with 8 GB of RAM, 5 PDF<br>
files open, 20 or so terminals, 12 ssh sessions, lots of command<br>
histories, email, and browsers.<br>
<br>
$ time bash -c "read line < /dev/zero"<br>
bash: xrealloc: ../../bash/builtins/../../bash/builtins/read.def:525: cannot allocate 18446744071562068080 bytes (4295020544 bytes allocated)<br>
<br>
real 0m29.841s<br>
user 0m26.120s<br>
sys 0m3.720s<br>
<br>
What am I supposed to do with the power button? Maybe it would crush<br>
a machine with less RAM, but I suspect the Linux kernel would kill the<br>
process on a low RAM machine (which is a gripe some have). Anyone<br>
want to try? I could in a VM.<br>
<br>
Does Glen have a problem with languages like C and assembly that give<br>
the programmer too much power? Does he approve of Java because it<br>
prevents the programmer from doing "bad things?"<br>
<br>
Judd<br>
_______________________________________________<br>
colug-432 mailing list<br>
<a href="mailto:colug-432@colug.net" target="_blank">colug-432@colug.net</a><br>
<a href="http://lists.colug.net/mailman/listinfo/colug-432" target="_blank">http://lists.colug.net/mailman/listinfo/colug-432</a><br>
</blockquote></div><br>