Bug 18104

Summary: a source file in sh(1) lacks #include <errno.h>
Product: Base System Reporter: mellon <mellon>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 5.0-CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description mellon 2000-04-20 04:40:00 UTC
	When sh(1) is compiled with DEBUG defined, as it usually isn't,
	show.c won't compile as it uses errno but lacks the include.
	The offending function, opentrace(), is inside a #ifdef DEBUG block.

How-To-Repeat: 
	cd /usr/src/bin/sh 
	DEBUG_FLAGS=-DDEBUG make
Comment 1 mellon 2000-04-20 07:55:33 UTC
> 	When sh(1) is compiled with DEBUG defined, as it usually isn't,
> 	show.c won't compile as it uses errno but lacks the include.
> 	The offending function, opentrace(), is inside a #ifdef DEBUG block.

I've goofed here, in fact; sh(1) still won't build with DEBUG since --
get that! -- the function trace() defined in show.c conflicts with 
trace() in lib_trace.o of libtermcap.a of ncurses fame.

I've renamed the sh function, and retested everything. When build with
DEBUG_FLAGS=-DDEBUG=2 , it'll create a file 'trace' in the current 
directory and will write tons of good info there. Would someone please
review/commit?

Index: shell.h
===================================================================
RCS file: /freebsd/cvs/src/bin/sh/shell.h,v
retrieving revision 1.11
diff -u -r1.11 shell.h
--- shell.h	1999/08/27 23:15:24	1.11
+++ shell.h	2000/04/20 06:44:37
@@ -77,7 +77,7 @@
 
 
 #ifdef DEBUG
-#define TRACE(param)	trace param
+#define TRACE(param)	sh_trace param
 #else
 #define TRACE(param)
 #endif
Index: show.c
===================================================================
RCS file: /freebsd/cvs/src/bin/sh/show.c,v
retrieving revision 1.11
diff -u -r1.11 show.c
--- show.c	1999/11/29 19:11:01	1.11
+++ show.c	2000/04/20 06:51:56
@@ -48,6 +48,7 @@
 #else
 #include <varargs.h>
 #endif
+#include <errno.h>
 
 #include "shell.h"
 #include "parser.h"
@@ -301,9 +302,9 @@
 
 void
 #ifdef __STDC__
-trace(const char *fmt, ...)
+sh_trace(const char *fmt, ...)
 #else
-trace(va_alist)
+sh_trace(va_alist)
 	va_dcl
 #endif
 {
Index: show.h
===================================================================
RCS file: /freebsd/cvs/src/bin/sh/show.h,v
retrieving revision 1.7
diff -u -r1.7 show.h
--- show.h	1999/08/27 23:15:25	1.7
+++ show.h	2000/04/20 06:44:53
@@ -36,7 +36,7 @@
 
 void showtree __P((union node *));
 #ifdef DEBUG
-void trace __P((const char *, ...));
+void sh_trace __P((const char *, ...));
 void trargs __P((char **));
 void trputc __P((int));
 void trputs __P((char *));

-- 
Anatoly Vorobey,
mellon@pobox.com http://pobox.com/~mellon/
"Angels can fly because they take themselves lightly" - G.K.Chesterton
Comment 2 Martin Cracauer freebsd_committer freebsd_triage 2000-04-20 10:56:28 UTC
State Changed
From-To: open->closed

Fixe in -current. 
Will be in 4.x before 4.1