Date: Wed, 19 Jul 1995 14:22:50 -0600 (MDT) From: Ade Barkah <mbarkah@hemi.com> To: hackers@freebsd.org Subject: Being curious with `cat * > file' Message-ID: <199507192022.OAA10037@hemi.com>
next in thread | raw e-mail | index | archive | help
Hello,
What should `cat * > output` do ? Should it gracefully concatenate
all the files together into a file called `output', or will it
attempt to cat the output into itself so many times until the
file system is filled ?
In FreeBSD 2.0.5-950622-SNAP, the results are somewhat random:
sometimes graceful, other times it fills up the file system.
Is this a bug, feature, or is doing `cat * > output` considered
an error ?
The "problem" appears on two 2.0.5 machines here.
Here's a sample session:
[The particular shell is tcsh in my home directory. However,
I can reproduce the problem with /bin/csh in /root (say, I
just logged in as root.)]
barkah: {1} mkdir test1
barkah: {2} cd test1
barkah: {3} cat >> testfile <<!
test file
barkah: {4} cat * > output
barkah: {5} ls -l
total 4
-rw-rw-r-- 1 mbarkah userm 10 Jul 19 13:50 output
-rw-rw-r-- 1 mbarkah userm 10 Jul 19 13:50 testfile
[Looks great up to this point, works as expected]
barkah: {6} cat * > output2
[Job killed with ctrl-c at this point]
barkah: {7} ls -l
total 916
-rw-rw-r-- 1 mbarkah userm 10 Jul 19 13:50 output
-rw-rw-r-- 1 mbarkah userm 454360 Jul 19 13:50 output2
^^^^^^
-rw-rw-r-- 1 mbarkah userm 10 Jul 19 13:50 testfile
[Look how huge that output2 file is!]
barkah: {8} tail -5 output2
test file
test file
test file
test file
test file
[And now for some random info]
barkah: {9} uname -a
FreeBSD barkah.hemi.com 2.0.5-950622-SNAP FreeBSD 2.0.5-950622-SNAP #0: Wed Jul
12 19:10:26 MDT 1995 root@barkah.hemi.com:/usr/src/sys/compile/KERNEL i386
barkah: {10} df -k .
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/sd1s1f 1523098 533437 867813 38% /usr2
barkah: {11} grep usr2 /etc/fstab
/dev/sd1s1f /usr2 ufs rw 1 1
barkah: {12} dmesg | grep aha0:1:0
(aha0:1:0): "HP 2.13 GB #A1 9002" type 0 fixed SCSI 2
sd1(aha0:1:0): Direct-Access 2033MB (4165272 512 byte sectors)
Thanks for any ideas,
-Ade Barkah
--------------------------------------------------------------------
Inet: mbarkah@hemi.com - HEMISPHERE ONLINE - www: <http://hemi.com/>
--------------------------------------------------------------------
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199507192022.OAA10037>
