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

Judd Montgomery judd at jpilot.org
Tue Dec 6 10:22:45 EST 2011


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


More information about the colug-432 mailing list