NetBSD Problem Report #3446

Received: (qmail-queue invoked from smtpd); 3 Apr 1997 19:53:08 -0000
Message-Id: <199704031944.OAA19159@istari.sandelman.ottawa.on.ca>
Date: Thu, 3 Apr 1997 14:44:22 -0500 (EST)
From: "Michael C. Richardson" <mcr@istari.sandelman.ottawa.on.ca>
Reply-To: mcr@istari.sandelman.ottawa.on.ca
To: gnats-bugs@gnats.netbsd.org
Subject: enhancement to config
X-Send-Pr-Version: 3.95

>Number:         3446
>Category:       kern
>Synopsis:       config looks for, and includes files.CONFIG
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 03 12:05:02 +0000 1997
>Closed-Date:    Thu Mar 27 13:39:34 +0000 2008
>Last-Modified:  Thu Mar 27 13:39:34 +0000 2008
>Originator:     Michael C. Richardson
>Release:        1.2
>Organization:
Sandelman Software Works
>Environment:
System: NetBSD istari.sandelman.ottawa.on.ca 1.2D NetBSD 1.2D (SSW) #1: Wed Apr 2 16:21:04 EST 1997 mcr@lox.sandelman.ottawa.on.ca:/sandel/netbsd/src/sys/arch/i386/compile/SSW i386
Architecture: i386

>Description:
	config has been modified to look for a file in the same directory
	as the kernel configuration file that provides additional device
	definitions. The file is named files.SYSTEMNAME. This is useful
	with -s and -b to develope custom kernels without having to have
	write permissions on the kernel source.

>How-To-Repeat:

>Fix:
*** /w/netbsd/src/usr.sbin/config/gram.y	Mon Feb  3 07:25:59 1997
--- gram.y	Thu Apr  3 14:26:24 1997
***************
*** 146,151 ****
--- 146,152 ----
  	dev_defs dev_eof		/* sys/conf/files */
  	dev_defs dev_eof		/* sys/arch/${MACHINE_ARCH}/... */
  	dev_defs dev_eof		/* sys/arch/${MACHINE}/... */
+ 	dev_defs dev_eof		/* possible files.CONFIG */
  					{ check_maxpart(); }
  	specs;				/* rest of machine description */

***************
*** 442,451 ****
--- 443,482 ----
  	const char *mcharch;
  {
  	char buf[MAXPATHLEN];
+ 	const char *last_component;
+ 	char        configpath[MAXPATHLEN];

  	machine = mch;
  	machinearch = mcharch;

+ 	last_component=strrchr(conffile, '/');
+ 	if(last_component)
+ 	  {
+ 	    configpath[0]='\0';
+ 	    strncat(configpath, conffile, last_component-conffile);
+ 	    
+ 	    /* advance past / */
+ 	    last_component++;
+ 	  }
+ 	else
+ 	  {
+ 	    last_component = conffile;
+ 	    getcwd(configpath, sizeof(configpath));
+ 	  }
+ 	
+ 
+ 	(void)snprintf(buf, MAXPATHLEN, "%s/files.%s", configpath, last_component);
+ 	if(access(buf, F_OK) == 0)
+ 	  {
+ 	    if (include(buf, ENDFILE) != 0)
+ 	      exit(1);
+ 	  }
+ 	else
+ 	  {
+ 	    if(include(_PATH_DEVNULL, ENDFILE) != 0)
+ 	      exit(1);
+ 	  }
+ 
  	(void)sprintf(buf, "arch/%s/conf/files.%s", machine, machine);
  	if (include(buf, ENDFILE) != 0)
  		exit(1);
***************
*** 460,465 ****
--- 491,497 ----

  	if (include("conf/files", ENDFILE) != 0)
  		exit(1);
+ 
  }

  static void

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: fair 
State-Changed-When: Thu Jun 18 18:19:10 PDT 1998 
State-Changed-Why:  
I think this is adequately answered by the "include" config directive, 
don't you? 

From: "Michael C. Richardson" <mcr@sandelman.ottawa.on.ca>
To: fair@NetBSD.ORG
Cc:  Subject: Re: kern/3446 
Date: Thu, 18 Jun 1998 11:17:04 -0400

 -----BEGIN PGP SIGNED MESSAGE-----


 >>>>> "fair" == fair  <fair@NetBSD.ORG> writes:

     fair> Synopsis: config looks for, and includes files.CONFIG

     fair> State-Changed-From-To: open->feedback State-Changed-By: fair
     fair> State-Changed-When: Thu Jun 18 18:19:10 PDT 1998 State-Changed-Why:
     fair> I think this is adequately answered by the "include" config
     fair> directive, don't you?

   Well, I don't entirely agree. Yes, it is possible, but it requires
 reworking a lot of config files, and that means more work to follow 
 NetBSD.
   Please don't make life more difficult for people that want to base products
 on NetBSD. 

   The grammar says:

 Configuration:
 	topthings			/* dirspecs, include "std.arch" */
 	machine_spec			/* "machine foo" from machine descr. */
 	dev_defs dev_eof		/* sys/conf/files */
 	dev_defs dev_eof		/* sys/arch/${MACHINE_ARCH}/... */
 	dev_defs dev_eof		/* sys/arch/${MACHINE}/... */
         dev_defs dev_eof                /* possible files.CONFIG */
 					{ check_maxpart(); }
 	specs;				/* rest of machine description */

   Therefore, one can include things *before* the "machine foo", and before
 all the devices definitions are created, or at "specs", which is too late
 define any new files to include.

   The files.CONFIG is used for the SSH IPsec code. I'd rather stop
 maintaining a parallel version of config.

   If you are looking at this, would also consider my "aux-conf." hack to
 conf.c?

    :!mcr!:            |  Sandelman Software Works Corporation, Ottawa, ON  
    Michael Richardson |	SSH IPsec: http://www.ssh.fi/. Secure, strong, international
  Personal: <A HREF="http://www.sandelman.ottawa.on.ca/People/Michael_Richardson/Bio.html">mcr@sandelman.ottawa.on.ca</A>. PGP key available.
  Corporate: <A HREF="http://www.sandelman.ottawa.on.ca/SSW/">sales@sandelman.ottawa.on.ca</A>. 










 -----BEGIN PGP SIGNATURE-----
 Version: 2.6.3ia
 Charset: latin1
 Comment: Processed by Mailcrypt 3.4, an Emacs/PGP interface

 iQB1AwUBNYkvO9iXVu0RiA21AQH6fgL8DR4boz8r7BElxk8jnVxThQRAtEtGsqu6
 YsV1+KnyoRTKTHWBmCOfh8h4Vi96Ga+uDXomTs2FXYcGPM/XnK52DEkntQ2tf0Ex
 LgukPDufqzjswytvbUyCh/boGPP8Ddb/
 =nZUL
 -----END PGP SIGNATURE-----
State-Changed-From-To: feedback->open 
State-Changed-By: fair 
State-Changed-When: Mon Aug 10 21:56:43 PDT 1998 
State-Changed-Why:  
Feedback was given; now someone has to take this and deal with it. 
State-Changed-From-To: open->feedback
State-Changed-By: tls@netbsd.org
State-Changed-When: Sat, 23 Sep 2006 22:55:15 +0000
State-Changed-Why:
Do you still want this change?


State-Changed-From-To: feedback->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Thu, 27 Mar 2008 13:39:34 +0000
State-Changed-Why:
Feedback timeout. Feel free to resubmit the patch in a new PR if you still
want it.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.