Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Oct 1999 10:42:10 -0700 (PDT)
From:      Alfred Perlstein <bright@wintelcom.net>
To:        x@asdf.com
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: recursive cat weirdness
Message-ID:  <Pine.BSF.4.05.9910051037210.6368-100000@fw.wintelcom.net>
In-Reply-To: <Pine.LNX.4.02A.9910041658360.19654-100000@cobalt.novagate.net>

next in thread | previous in thread | raw e-mail | index | archive | help

On Mon, 4 Oct 1999 x@asdf.com wrote:

> Hello!
> 
> A co-worker found something interesting today by accident. He tried it on
> a FreeBSD 1.2.6 machine, and i just tried it on my 3.3 machine.
> 
> You make two files that can have as many lines as you want. Just one line
> of garbage will do. Then you
> 
> cat file1 file2 > file2
> 
> it just hangs and starts eating CPU. Then after you Ctrl C out and check,
> the file2 has gotten huge (well, at least if you let it run long enough).

Yup, this is standard unix behavior, another fun gotcha is this:

Using 'cat' on the script output file while in the middle of creating
that script, yes I saw a student sit slack jawed in the lab as his
terminal's screen scrolled on endlessly.

me:      "What did you do?"
student: "Nothing"
"Oh really..." (reaches for cluebat) *wham*
"Ow, whatcha do that for?"
"do what?"

> I tried this on a version of Linux and it wouldn't let me by saying
> something like "output file is input file".

That's pretty odd, I'd like to know where that error checking was
hacked in.

> I guess this is not a big deal but if someone wanted to be a jerk they
> could just make two little files and eat up your disk space and CPU until
> you noticed it running.

Yup, and then you can delete thier account unless they provide for a
good reason for doing so.

(hint: quotas)

-Alfred



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.05.9910051037210.6368-100000>