[net.bugs.4bsd] 4.?bsd 'ls' and 'du' show up a problem with 'fsck' and special files

ado@elsie.UUCP (Arthur David Olson) (03/25/86)

Here's some surprising output I got on a 4.1bsd system running on an 11/750
(where, for the sake of brevity, I've "mv"ed some files from the "/dev"
directory to a subdirectory named "/dev/wrong"):

	Script started on Mon Mar 24 17:11:39 1986
	Warning: no access to tty; thus no job control in this shell...
	% /bin/ls -l /dev/wrong
	total 888248
	c--------- 1 root    4, 16 Jan  9 10:11 rhp2a
	c--------- 1 root    4, 17 Jan  9 10:11 rhp2b
	cr-------- 1 root    4, 18 Jan  9 10:11 rhp2c
	% /usr/ucb/ls -l /dev/wrong
	total 888248
	c--------- 1 root      4, 16 Jan  9 10:11 rhp2a
	c--------- 1 root      4, 17 Jan  9 10:11 rhp2b
	cr-------- 1 root      4, 18 Jan  9 10:11 rhp2c
	% /bin/du /dev/wrong
	888249	/dev/wrong
	% 
	script done on Mon Mar 24 17:12:00 1986

As it turned out, the surprising "total" figures came about because:

	1.  The inodes associated with the above special files had
	    erroneous non-zero "file size" elements.
	2.  "fsck" failed to either complain about or fix (read:  zero)
	    the non-zero sizes.  (Alternately:  the kernel returned the
	    non-zero sizes of these special files when the files were
	    "stat"ed, rather than always returning a zero size value for
	    special files.)
	3.  "/bin/ls", "/usr/ucb/ls", and "/bin/du" all made use
	    of the incorrect file sizes in computing disk usage totals.

I'd appreciate knowing if anyone else out there gets wild output from
	/bin/du /dev
--especially if you get them on 4.2 or 4.3 systems.  I'd also appreciate any
insights as to where the "right" place (fsck?  the kernel? ls and du?) to fix
the problem is.
--
Bugs is a Warner Brothers trademark.
Bug is a Volkswagen trademark.
--
	UUCP: ..decvax!seismo!elsie!ado		ARPA: elsie!ado@seismo.ARPA
	DEC, VAX, Elsie & Ado are Digital, Borden & Shakespeare trademarks.