Subject: bin/11904: tail segfaults and core dumps on I/O error
To: None <gnats-bugs@gnats.netbsd.org>
From: None <fair@clock.org>
List: netbsd-bugs
Date: 01/06/2001 10:56:13
>Number:         11904
>Category:       bin
>Synopsis:       tail segfaults and core dumps on I/O error
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 06 10:56:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Erik E. Fair
>Release:        1.3.2
>Organization:
	International Organization of Internet Clock Watchers
>Environment:
	
System: NetBSD cesium.clock.org 1.3.2 NetBSD 1.3.2 (CESIUM) #0: Sat Sep 12 19:30:08 PDT 1998 root@:/usr/src/sys/arch/sparc/compile/CESIUM sparc

SPARC LX (50 MHz microSPARC I CPU), 96MB RAM, 8GB disk
/var/run/dmesg.boot available upon request.

>Description:
	tail core dumps when the file is it reading gives an I/O
	error due to a bad block.  I have a shell script that I
	use to watch my web logs in a screen window:

	#!/bin/sh
	exec tail $* /var/log/httpd.access_log | egrep $USER

	My disks are getting old, and the other day, a bad block
	showed up in /var in the httpd.access_log. When the script
	above was invoked, tail core dumped when it read the bad
	block.

	This is not acceptable behavior on the part of any program
	that reads files; it should gracefully error out.

	Aside from fixing this particular program, it might be a
	good idea to create a filesystem or other test-rig that
	can deliver an I/O error to any arbitrary program, since
	tail is unlikely to be the only program with this class of
	problem - the rest of the userland should be tested, too,
	so that UNIX is more robust in the face of system failure.

>How-To-Repeat:
	
>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted: