From owner-freebsd-questions Tue Oct 5 10:24:30 1999 Delivered-To: freebsd-questions@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id 9B3CF15606 for ; Tue, 5 Oct 1999 10:24:28 -0700 (PDT) (envelope-from bright@wintelcom.net) Received: from localhost (bright@localhost) by fw.wintelcom.net (8.9.3/8.9.3) with ESMTP id KAA18832; Tue, 5 Oct 1999 10:42:10 -0700 (PDT) Date: Tue, 5 Oct 1999 10:42:10 -0700 (PDT) From: Alfred Perlstein To: x@asdf.com Cc: freebsd-questions@FreeBSD.ORG Subject: Re: recursive cat weirdness In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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