From mellon@happy.checkpoint.com  Wed Apr 19 20:33:40 2000
Return-Path: <mellon@happy.checkpoint.com>
Received: from happy.checkpoint.com (happy.checkpoint.com [199.203.156.41])
	by hub.freebsd.org (Postfix) with ESMTP id CC5D537B6E3
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 19 Apr 2000 20:33:33 -0700 (PDT)
	(envelope-from mellon@happy.checkpoint.com)
Received: (from mellon@localhost)
	by happy.checkpoint.com (8.9.3/8.9.3) id GAA67396;
	Thu, 20 Apr 2000 06:32:19 GMT
	(envelope-from mellon)
Message-Id: <200004200632.GAA67396@happy.checkpoint.com>
Date: Thu, 20 Apr 2000 06:32:19 GMT
From: mellon@pobox.com
Sender: mellon@happy.checkpoint.com
Reply-To: mellon@pobox.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: missing include file in sh(1)
X-Send-Pr-Version: 3.2

>Number:         18104
>Category:       bin
>Synopsis:       a source file in sh(1) lacks #include <errno.h>
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Apr 19 20:40:00 PDT 2000
>Closed-Date:    Thu Apr 20 11:56:28 MEST 2000
>Last-Modified:  Tue Nov 27 18:32:27 PST 2001
>Originator:     Anatoly Vorobey
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:
	
	-CURRENT

>Description:

	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

>Fix:

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:31:22
@@ -48,6 +48,7 @@
 #else
 #include <varargs.h>
 #endif
+#include <errno.h>
 
 #include "shell.h"
 #include "parser.h"



>Release-Note:
>Audit-Trail:

From: Anatoly Vorobey <mellon@pobox.com>
To: FreeBSD-gnats-submit@FreeBSD.ORG
Cc:  
Subject: Re: bin/18104: missing include file in sh(1)
Date: Thu, 20 Apr 2000 06:55:33 +0000

 > 	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
 
State-Changed-From-To: open->closed 
State-Changed-By: cracauer 
State-Changed-When: Thu Apr 20 11:56:28 MEST 2000 
State-Changed-Why:  
Fixe in -current. 
Will be in 4.x before 4.1 
>Unformatted:
