Subject: bin/9981: rcorder thinks ktrace.out is executable
To: None <gnats-bugs@gnats.netbsd.org>
From: Andrew Brown <atatat@atatdot.net>
List: netbsd-bugs
Date: 04/25/2000 10:57:12
>Number:         9981
>Category:       bin
>Synopsis:       rcorder thinks ktrace.out is executable
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 25 10:58:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     TheMan
>Release:        1.4X as of...20000424
>Organization:
	just me.
>Environment:
System: NetBSD ebola 1.4X NetBSD 1.4X (RESTON) #2: Mon Apr 24 07:57:34 PDT 2000 root@ebola:/usr/src/sys/arch/i386/compile/RESTON i386

>Description:

	i was trying to fix something.  i don't even remember what now.
	but i happened to be in /etc/rc.d when i ran ktrace vi, so the
	ktrace.out file ended up in /etc/rc.d.  of course.

	then the machine crashed.  i tried doing again what i had just
	done, but it didn't crash again.  good or bad...your call.  but
	i saw a message on the console that confused me momentarily,
	and then irked me.

	/etc/rc.d/ktrace.out: 1: Syntax error: word unexpected (expecting ")")

	imho, rcorder should only emit filenames if they're executable or
	named something.sh (which i presume the new rc.d system deals with,
	correctly, yes?).

>How-To-Repeat:

	cd /etc/rc.d
	ktrace cat
	^D
	reboot

>Fix:

--- rcorder.c-orig	Tue Nov 23 00:28:22 1999
+++ rcorder.c	Tue Apr 25 13:50:35 2000
@@ -366,6 +366,11 @@
 
 	directive_flag = 0;
 
+	if (access(filename, X_OK) == -1 &&
+	    ((buf = strrchr(filename, '.')) == NULL ||
+	     strcmp(buf, ".sh") != 0))
+		return;
+
 	if ((fp = fopen(filename, "r")) == NULL) {
 		warn("could not open %s", filename);
 		return;
>Release-Note:
>Audit-Trail:
>Unformatted: